Skip to content

Commit

Permalink
Fix directory API keys configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ronenh committed Jan 22, 2025
1 parent f90211b commit 0e97e62
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 33 deletions.
18 changes: 10 additions & 8 deletions charts/aserto-lib/templates/_config.tpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{{- define "aserto-lib.controllerClientCfg" }}
{{- include "aserto-lib.mergeGlobal" (list . "controller") }}
{{- include "aserto-lib.mergeGlobal" (list . "controller") | fromYaml |
merge (dict "apiKeysSecret" "controller-keys") }}
{{- end }}

{{- define "aserto-lib.directoryClientCfg" }}
{{- include "aserto-lib.mergeGlobal" (list . "directory") }}
{{- include "aserto-lib.mergeGlobal" (list . "directory") | fromYaml |
merge (dict "apiKeysSecret" "directory-keys") }}
{{- end }}

{{- define "aserto-lib.discoveryCfg" }}
Expand Down Expand Up @@ -31,41 +33,41 @@ valueFrom:


{{- define "aserto-lib.controllerReadKeyEnv" -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "read" "controller-keys") }}
{{- end }}
{{- end }}


{{- define "aserto-lib.controllerWriteKeyEnv" -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "write" "controller-keys") }}
{{- end }}
{{- end }}


{{- define "aserto-lib.controllerStoreKeyEnv" -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.controllerClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "store" "controller-keys") }}
{{- end }}
{{- end }}

{{- define "aserto-lib.directoryReadKeyEnv" -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "read" "directory-keys") }}
{{- end }}
{{- end }}


{{- define "aserto-lib.directoryWriteKeyEnv" -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "write" "directory-keys") }}
{{- end }}
{{- end }}


{{- define "aserto-lib.directoryStoreKeyEnv" -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml | default dict -}}
{{- with include "aserto-lib.directoryClientCfg" . | fromYaml -}}
{{ include "aserto-lib.dsApiKeyEnv" (list . "store" "directory-keys") }}
{{- end }}
{{- end }}
Expand Down
6 changes: 1 addition & 5 deletions charts/directory/ci/minimal-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@ global:
- name: ghcr-creds

database:
host: tenant-db-host

sshAdminKeys:
keys: |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDf6
host: directory-postgres
8 changes: 0 additions & 8 deletions charts/directory/test/no-tls.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@ database:
credentialsSecret: pg-credentials
reader:
credentialsSecret: pg-directory-reader-credentials

cache:
sizeMB: 100

sshAdminKeys:
configMap:
name: directory-admin-keys
key: authorized_keys
8 changes: 4 additions & 4 deletions charts/directory/test/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tests:
run:
# Create a tenant.
- |
${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_writer" \
${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_store" \
-d '{"tenant": {"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1", "name": "test-tenant"}}' \
localhost:8282 aserto.directory.store.v2.Store.CreateTenant
Expand All @@ -49,7 +49,7 @@ tests:
cleanup:
# Delete tenant.
- |
${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_writer" \
${GRPCURL:=grpcurl} -plaintext -H "Authorization: basic apikey_store" \
-d '{"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1"}' \
localhost:8282 aserto.directory.store.v2.Store.DeleteTenant
Expand Down Expand Up @@ -95,7 +95,7 @@ tests:
run:
# Create a tenant.
- |
${GRPCURL:=grpcurl} -insecure -H "Authorization: basic apikey_writer" \
${GRPCURL:=grpcurl} -insecure -H "Authorization: basic apikey_store" \
-d '{"tenant": {"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1", "name": "test-tenant"}}' \
localhost:8282 aserto.directory.store.v2.Store.CreateTenant
Expand All @@ -114,6 +114,6 @@ tests:
- diff charts/directory/test/manifest.yaml $TMPDIR/manifest.yaml
cleanup:
- |
docker run --network="host" fullstorydev/grpcurl -insecure -H "Authorization: basic apikey_writer" \
${GRPCURL:=grpcurl} -insecure -H "Authorization: basic apikey_store" \
-d '{"id": "3dbaa470-9c7e-11ef-bf36-00fcb2a75cb1"}' \
localhost:8282 aserto.directory.store.v2.Store.DeleteTenant
8 changes: 0 additions & 8 deletions charts/directory/test/tls.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ database:
reader:
credentialsSecret: pg-directory-reader-credentials

cache:
sizeMB: 100

sshAdminKeys:
configMap:
name: directory-admin-keys
key: authorized_keys

grpc:
certSecret: grpc-cert

Expand Down

0 comments on commit 0e97e62

Please sign in to comment.