diff --git a/charts/aserto/Chart.lock b/charts/aserto/Chart.lock index 49621ab..e49e78c 100644 --- a/charts/aserto/Chart.lock +++ b/charts/aserto/Chart.lock @@ -23,5 +23,8 @@ dependencies: - name: aserto-lib repository: file://../aserto-lib version: 0.2.1 -digest: sha256:3f436ac7dfb9062fb8fb780d8bee9d03c72cfb871e1b53de562f277ddfc6d493 -generated: "2025-01-20T10:06:46.030495-05:00" +- name: multi-tenant-scim + repository: file://../multi-tenant-scim + version: 0.0.1 +digest: sha256:dd5cc7966bdbc8c5cb731339a97d2ef3d1764b81e8aa624ea76abdc539824093 +generated: "2025-01-24T11:04:50.423851638+02:00" diff --git a/charts/aserto/Chart.yaml b/charts/aserto/Chart.yaml index 36ed2c9..ab55d97 100644 --- a/charts/aserto/Chart.yaml +++ b/charts/aserto/Chart.yaml @@ -59,3 +59,7 @@ dependencies: - name: aserto-lib version: 0.2.1 repository: file://../aserto-lib + - name: multi-tenant-scim + version: 0.0.1 + repository: file://../multi-tenant-scim + condition: multi-tenant-scim.enabled diff --git a/charts/authorizer/templates/_helpers.tpl b/charts/authorizer/templates/_helpers.tpl index b202838..ef8f5bc 100644 --- a/charts/authorizer/templates/_helpers.tpl +++ b/charts/authorizer/templates/_helpers.tpl @@ -72,7 +72,7 @@ Local cluster address OPA discovery configuration */}} {{- define "authorizer.opaDiscovery" -}} -url: https://{{ include "aserto-lib.discoveryAddress" . }}/api/ +url: http://{{ include "aserto-lib.discoveryAddress" . }}/api/ credentials: bearer: token: ${AUTHORIZER_DISCOVERY_ROOT_KEY} diff --git a/charts/console/templates/deployment.yaml b/charts/console/templates/deployment.yaml index 7d6ee87..526c8f4 100644 --- a/charts/console/templates/deployment.yaml +++ b/charts/console/templates/deployment.yaml @@ -51,7 +51,7 @@ spec: value: {{ include "console.port" . | quote }} {{- with (include "aserto-lib.controllerClient" .) | fromYaml }} - name: DS0_SERVICE_URL - value: {{ .address }} + value: {{ .no_tls | default false | ternary "http" "https" }}://{{ .address }} - name: DS0_TENANT_ID value: {{ .tenant_id }} {{- end }} diff --git a/charts/controller/templates/config.yaml b/charts/controller/templates/config.yaml index d9e8c0f..8093b7c 100644 --- a/charts/controller/templates/config.yaml +++ b/charts/controller/templates/config.yaml @@ -78,6 +78,28 @@ stringData: - /grpc.reflection.v1.ServerReflection/ServerReflectionInfo - /grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo - /aserto.directory.reader.v3.Reader/Check + - /aserto.directory.store.v2.Store/GetAPIKeyIdentity + - /aserto.directory.store.v2.Store/ListUserTenants + + tenant_id_field: + id: + - /aserto.directory.store.v2.Store/Info + - /aserto.directory.store.v2.Store/ListTenantMembers + tenant_id: + - /aserto.directory.store.v2.Store/AssignRoleToTenant + - /aserto.directory.store.v2.Store/CreateAPIKey + - /aserto.directory.store.v2.Store/DeleteAPIKey + - /aserto.directory.store.v2.Store/DeleteConfig + - /aserto.directory.store.v2.Store/DeleteSecret + - /aserto.directory.store.v2.Store/GetAPIKeyIdentity + - /aserto.directory.store.v2.Store/GetConfig + - /aserto.directory.store.v2.Store/GetSecret + - /aserto.directory.store.v2.Store/ListAPIKeys + - /aserto.directory.store.v2.Store/ListConfigs + - /aserto.directory.store.v2.Store/ListSecrets + - /aserto.directory.store.v2.Store/RemoveRoleFromTenant + - /aserto.directory.store.v2.Store/SetConfig + - /aserto.directory.store.v2.Store/SetSecret {{- end }} authentication: @@ -135,3 +157,10 @@ stringData: oidc: true {{- end }} + {{- with .Values.secretsVault }} + secrets_vault: + address: {{ .address }} + insecure: {{ .insecure | default false }} + root_path: {{ .rootPath | default "/" }} + token: "" + {{- end }} diff --git a/charts/controller/templates/deployment.yaml b/charts/controller/templates/deployment.yaml index c18c0c3..c91449e 100644 --- a/charts/controller/templates/deployment.yaml +++ b/charts/controller/templates/deployment.yaml @@ -128,6 +128,21 @@ spec: key: password {{- end }} + {{- if .Values.secretsVault }} + {{- if .Values.secretsVault.token }} + - name: DIRECTORY_SECRETS_VAULT_TOKEN + value: {{ .Values.secretsVault.token }} + {{- else -}} + {{- with .Values.secretsVault.tokenSecret }} + - name: DIRECTORY_SECRETS_VAULT_TOKEN + valueFrom: + secretKeyRef: + name: {{ .name }} + key: {{ .key }} + {{- end }} + {{- end }} + {{- end }} + {{- range $_, $tenant := .Values.tenants -}} {{- with $tenant.keysSecret }} - name: {{ printf "TENANT_%s_WRITER_KEY" (replace "." "_" $tenant.name | upper) }} diff --git a/charts/controller/test/no-tls.values.yaml b/charts/controller/test/no-tls.values.yaml index 1add422..a216ad5 100644 --- a/charts/controller/test/no-tls.values.yaml +++ b/charts/controller/test/no-tls.values.yaml @@ -1,6 +1,6 @@ --- image: - tag: 0.33.11-b041fc2e-amd64 + tag: 0.33.11-108fc18c-amd64 imagePullSecrets: - name: ghcr-creds diff --git a/charts/controller/test/tls.values.yaml b/charts/controller/test/tls.values.yaml index f1874de..3f937b4 100644 --- a/charts/controller/test/tls.values.yaml +++ b/charts/controller/test/tls.values.yaml @@ -1,6 +1,6 @@ --- image: - tag: 0.33.11-b041fc2e-amd64 + tag: 0.33.11-108fc18c-amd64 imagePullSecrets: - name: ghcr-creds diff --git a/charts/controller/values.yaml b/charts/controller/values.yaml index 614f8c5..06ac3f0 100644 --- a/charts/controller/values.yaml +++ b/charts/controller/values.yaml @@ -71,6 +71,18 @@ tenants: # writerKey: writer # readerKey: reader +# secretsVault: +# [Optional] Vault token +# token: "" +# [Optional] Kubernetes secret containing the vault token +# tokenSecret: +# # Secret name +# name: "" +# # Secret key +# key: "token" +# address: "https://127.0.0.1:8200" +# rootPath: "/" +# insecure: true # Set the service log level (trace/debug/info/warn/error). # The default is 'info'. diff --git a/charts/directory/templates/config.yaml b/charts/directory/templates/config.yaml index 8521d7e..0e42145 100644 --- a/charts/directory/templates/config.yaml +++ b/charts/directory/templates/config.yaml @@ -133,4 +133,3 @@ stringData: - /aserto.directory.store.v2.Store/PurgeDeletedTenants authenticators_enabled: root_key: true - diff --git a/charts/directory/templates/deployment.yaml b/charts/directory/templates/deployment.yaml index 9a2326b..1ee65d8 100644 --- a/charts/directory/templates/deployment.yaml +++ b/charts/directory/templates/deployment.yaml @@ -98,7 +98,7 @@ spec: readOnly: true {{- end }} env: - {{- with include "directory.controllerKeyEnv" (list . "read") }} + {{- with include "directory.controllerKeyEnv" (list . "readStore") }} - name: DIRECTORY_CONTROLLER_CLIENT_API_KEY {{- . | nindent 14 }} {{- end }} diff --git a/charts/directory/test/no-tls.values.yaml b/charts/directory/test/no-tls.values.yaml index f0777d3..3bd9134 100644 --- a/charts/directory/test/no-tls.values.yaml +++ b/charts/directory/test/no-tls.values.yaml @@ -1,6 +1,6 @@ --- image: - tag: 0.33.11-b041fc2e-amd64 + tag: 0.33.11-108fc18c-amd64 imagePullSecrets: - name: ghcr-creds diff --git a/charts/directory/test/tls.values.yaml b/charts/directory/test/tls.values.yaml index d6f1fbb..c486c10 100644 --- a/charts/directory/test/tls.values.yaml +++ b/charts/directory/test/tls.values.yaml @@ -1,6 +1,6 @@ --- image: - tag: 0.33.11-b041fc2e-amd64 + tag: 0.33.11-108fc18c-amd64 imagePullSecrets: - name: ghcr-creds diff --git a/charts/discovery/templates/config.yaml b/charts/discovery/templates/config.yaml index 916a04c..edf2cd3 100644 --- a/charts/discovery/templates/config.yaml +++ b/charts/discovery/templates/config.yaml @@ -52,7 +52,6 @@ stringData: {{- end }} {{- with .Values.oidc -}} - foobar: no oidc: {{- include "aserto-lib.oidcConfig" . | nindent 8 }} {{- end }} diff --git a/charts/discovery/templates/deployment.yaml b/charts/discovery/templates/deployment.yaml index 866bd5a..f2a3582 100644 --- a/charts/discovery/templates/deployment.yaml +++ b/charts/discovery/templates/deployment.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -31,24 +32,16 @@ spec: items: - key: config.yaml path: config.yaml + {{- with (include "aserto-lib.grpcConfig" . | fromYaml).certSecret }} - name: grpc-certs - {{- with include "aserto-lib.grpcConfig" . | fromYaml }} - {{- if .certSecret }} secret: - secretName: {{ .certSecret }} - {{- else }} - emptyDir: {} - {{- end }} - {{- end }} + secretName: {{ . }} + {{- end }} + {{- with (include "aserto-lib.httpsConfig" . | fromYaml).certSecret }} - name: https-certs - {{- with (include "aserto-lib.httpsConfig" . | fromYaml) }} - {{- if .certSecret }} secret: - secretName: {{ .certSecret }} - {{- else }} - emptyDir: {} - {{- end }} - {{- end }} + secretName: {{ . }} + {{- end }} {{- with ((include "aserto-lib.controllerClientCfg" . | fromYaml).caCertSecret).name }} - name: controller-grpc-certs @@ -77,16 +70,17 @@ spec: - name: config mountPath: /config readOnly: true + {{- with (include "aserto-lib.grpcConfig" . | fromYaml).certSecret }} - name: grpc-certs mountPath: /grpc-certs - {{- if (include "aserto-lib.grpcConfig" . | fromYaml).certSecret }} readOnly: true - {{- end }} + {{- end }} + {{- with (include "aserto-lib.httpsConfig" . | fromYaml).certSecret }} - name: https-certs mountPath: /https-certs - {{- if (include "aserto-lib.httpsConfig" . | fromYaml).certSecret }} readOnly: true - {{- end }} + {{- end }} + {{- with ((include "aserto-lib.controllerClientCfg" . | fromYaml).caCertSecret).name }} - name: controller-grpc-certs @@ -102,7 +96,7 @@ spec: key: {{ .secretKey }} {{- end }} - {{- with include "aserto-lib.controllerKeyEnv" (list . "read") }} + {{- with include "aserto-lib.controllerKeyEnv" (list . "readStore") }} - name: DISCOVERY_DS0_API_KEY {{- . | nindent 14 }} {{- end }} diff --git a/charts/discovery/test/no-tls.values.yaml b/charts/discovery/test/no-tls.values.yaml index c8e719d..a08d41b 100644 --- a/charts/discovery/test/no-tls.values.yaml +++ b/charts/discovery/test/no-tls.values.yaml @@ -11,10 +11,7 @@ apiKey: controller: address: "topaz.discovery-no-tls.svc.cluster.local:8282" - apiKeys: - read: controller-root-key - write: controller-root-key - store: controller-root-key + apiKeysSecret: controller-keys noTLS: true registries: diff --git a/charts/discovery/test/tests.yaml b/charts/discovery/test/tests.yaml index 9b92d71..0708cb8 100644 --- a/charts/discovery/test/tests.yaml +++ b/charts/discovery/test/tests.yaml @@ -19,6 +19,12 @@ tests: - name: discovery-ghcr-token values: token: ghuser:$GITHUB_TOKEN + - name: controller-keys + values: + read: controller-root-key + write: controller-root-key + readStore: controller-root-key + writeStore: controller-root-key run: - | ${TOPAZ:-topaz} ds set manifest charts/discovery/test/manifest.yaml \ diff --git a/charts/multi-tenant-scim/.helmignore b/charts/multi-tenant-scim/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/multi-tenant-scim/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/multi-tenant-scim/Chart.lock b/charts/multi-tenant-scim/Chart.lock new file mode 100644 index 0000000..5cf6c99 --- /dev/null +++ b/charts/multi-tenant-scim/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: aserto-lib + repository: file://../aserto-lib + version: 0.2.1 +digest: sha256:83c950a4ee60c07dbc8e045f6645365ca35eced4f1aa329f51c8e2de1de28f93 +generated: "2025-01-22T16:42:47.031829421+02:00" diff --git a/charts/multi-tenant-scim/Chart.yaml b/charts/multi-tenant-scim/Chart.yaml new file mode 100644 index 0000000..41f7ecb --- /dev/null +++ b/charts/multi-tenant-scim/Chart.yaml @@ -0,0 +1,35 @@ +--- +apiVersion: v2 +name: multi-tenant-scim +description: A Helm chart for the Aserto Multi Tenant SCIM Gateway +icon: https://www.aserto.com/images/aserto-logo.png + +maintainers: + - name: Aserto + url: https://github.com/aserto-dev + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.0.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.0.1" + +dependencies: + - name: aserto-lib + version: 0.2.1 + repository: file://../aserto-lib diff --git a/charts/multi-tenant-scim/templates/NOTES.txt b/charts/multi-tenant-scim/templates/NOTES.txt new file mode 100644 index 0000000..1378ca7 --- /dev/null +++ b/charts/multi-tenant-scim/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "multi-tenant-scim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "multi-tenant-scim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "multi-tenant-scim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "multi-tenant-scim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export HTTPS_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + export GRPC_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[1].containerPort}") + echo "gRPC Service exposed on http://127.0.0.1:8282" + echo "REST Service exposed on http://127.0.0.1:8383" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8282:$GRPC_PORT 8383:$HTTPS_PORT +{{- end }} diff --git a/charts/multi-tenant-scim/templates/_helpers.tpl b/charts/multi-tenant-scim/templates/_helpers.tpl new file mode 100644 index 0000000..0118923 --- /dev/null +++ b/charts/multi-tenant-scim/templates/_helpers.tpl @@ -0,0 +1,66 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "multi-tenant-scim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "multi-tenant-scim.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "multi-tenant-scim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "multi-tenant-scim.labels" -}} +helm.sh/chart: {{ include "multi-tenant-scim.chart" . }} +{{ include "multi-tenant-scim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "multi-tenant-scim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "multi-tenant-scim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "multi-tenant-scim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "multi-tenant-scim.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "multi-tenant-scim.port" -}} +{{ .Values.port | default "8080" }} +{{- end }} diff --git a/charts/multi-tenant-scim/templates/config.yaml b/charts/multi-tenant-scim/templates/config.yaml new file mode 100644 index 0000000..d9511b6 --- /dev/null +++ b/charts/multi-tenant-scim/templates/config.yaml @@ -0,0 +1,33 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "multi-tenant-scim.fullname" . }}-config + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} +stringData: + config.yaml: | + --- + logging: + prod: true + log_level: {{ .Values.logLevel | default "info" }} + + server: + listen_address: ":{{ include "multi-tenant-scim.port" . }}" + {{- with .Values.certSecret -}} + certs: + tls_key_path: '/https-certs/tls.key' + tls_cert_path: '/https-certs/tls.crt' + tls_ca_cert_path: '/https-certs/ca.crt' + {{- end }} + auth: + basic: + enabled: true + passthrough: true + bearer: + enabled: true + passthrough: true + directory: + {{- include "aserto-lib.directoryClient" . | nindent 6 }} + controller: + {{- include "aserto-lib.controllerClient" . | nindent 6 }} \ No newline at end of file diff --git a/charts/multi-tenant-scim/templates/deployment.yaml b/charts/multi-tenant-scim/templates/deployment.yaml new file mode 100644 index 0000000..48c850a --- /dev/null +++ b/charts/multi-tenant-scim/templates/deployment.yaml @@ -0,0 +1,99 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "multi-tenant-scim.fullname" . }} + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "multi-tenant-scim.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "multi-tenant-scim.selectorLabels" . | nindent 8 }} + spec: + {{- include "aserto-lib.imagePullSecrets" . | nindent 6 }} + serviceAccountName: {{ include "multi-tenant-scim.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config + secret: + secretName: {{ include "multi-tenant-scim.fullname" . }}-config + items: + - key: config.yaml + path: config.yaml + - name: https-certs + {{- with (include "aserto-lib.httpsConfig" . | fromYaml) }} + {{- if .certSecret }} + secret: + secretName: {{ .certSecret }} + {{- else }} + emptyDir: {} + {{- end }} + {{- end }} + + {{- with ((include "aserto-lib.controllerClient" . | fromYaml).caCertSecret).name }} + - name: controller-grpc-certs + secret: + secretName: {{ . }} + items: + - key: ca.crt + path: ca.crt + {{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + args: ["run", "--config", "/config/config.yaml"] + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: mtscim + containerPort: {{ include "multi-tenant-scim.port" . }} + volumeMounts: + - name: config + mountPath: /config + readOnly: true + {{- with .Values.certSecret }} + - name: https-certs + mountPath: /https-certs + readOnly: true + {{- end }} + {{- with ((include "aserto-lib.directoryClientCfg" . | fromYaml).caCertSecret).name }} + - name: directory-grpc-certs + mountPath: /directory-grpc-certs + readOnly: true + {{- end }} + {{- with ((include "aserto-lib.controllerClientCfg" . | fromYaml).caCertSecret).name }} + - name: controller-grpc-certs + mountPath: /controller-grpc-certs + readOnly: true + {{- end }} + env: + {{- with include "aserto-lib.controllerKeyEnv" (list . "readStore") }} + - name: ASERTO_SCIM_CONTROLLER_API_KEY + {{ . | nindent 14 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/multi-tenant-scim/templates/hpa.yaml b/charts/multi-tenant-scim/templates/hpa.yaml new file mode 100644 index 0000000..e6958b2 --- /dev/null +++ b/charts/multi-tenant-scim/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "multi-tenant-scim.fullname" . }} + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "multi-tenant-scim.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/multi-tenant-scim/templates/ingress.yaml b/charts/multi-tenant-scim/templates/ingress.yaml new file mode 100644 index 0000000..c131894 --- /dev/null +++ b/charts/multi-tenant-scim/templates/ingress.yaml @@ -0,0 +1,58 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "multi-tenant-scim.fullname" . -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + - path: / + {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: Prefix + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + name: {{ .port }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ .port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/multi-tenant-scim/templates/service.yaml b/charts/multi-tenant-scim/templates/service.yaml new file mode 100644 index 0000000..fb640c6 --- /dev/null +++ b/charts/multi-tenant-scim/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "multi-tenant-scim.fullname" . }} + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - name: mtscim + port: {{ include "multi-tenant-scim.port" . }} + targetPort: mtscim + selector: + {{- include "multi-tenant-scim.selectorLabels" . | nindent 4 }} diff --git a/charts/multi-tenant-scim/templates/serviceaccount.yaml b/charts/multi-tenant-scim/templates/serviceaccount.yaml new file mode 100644 index 0000000..99d5c95 --- /dev/null +++ b/charts/multi-tenant-scim/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "multi-tenant-scim.serviceAccountName" . }} + labels: + {{- include "multi-tenant-scim.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/multi-tenant-scim/values.yaml b/charts/multi-tenant-scim/values.yaml new file mode 100644 index 0000000..b0d52fa --- /dev/null +++ b/charts/multi-tenant-scim/values.yaml @@ -0,0 +1,110 @@ +--- +# Default values for directory. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: ghcr.io/aserto-dev/multi-tenant-scim + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + # tag: x.y.z + +# Set the service log level (trace/debug/info/warn/error) +logLevel: info + +port: 8080 + +# The service doesn't use TLS by default. +# Specify the name of a certificate of type kubernetes.io/tls to enable TLS. +certSecret: + +# auth: +# secretName: scim-password +# secretKey: password +# basic: +# enabled: true +# username: scim +# bearer: +# enabled: true + +rootDirectory: + disableTLSVerification: false + caCertSecret: "" + # address: "{{ .Release.Name }}-aserto-directory.aserto.svc.cluster.local:8282" + +replicaCount: 1 + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: directory.example.com + port: https + - host: grpc.directory.example.com + port: grpc + paths: + - path: / + pathType: Prefix + tls: [] + # - secretName: directory-example-com-tls + # hosts: + # - directory.example.com + # - secretName: grpc-directory-example-com-tls + # hosts: + # - grpc.directory.example.com + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}