From 0d91f6f91d02e5aeefa0143a8e55508f9776ba81 Mon Sep 17 00:00:00 2001 From: ace Date: Thu, 10 Apr 2025 00:21:11 +0300 Subject: [PATCH] add kanidm helm chart --- kanidm/.helmignore | 23 +++ kanidm/Chart.yaml | 24 ++++ kanidm/templates/NOTES.txt | 22 +++ kanidm/templates/_helpers.tpl | 62 ++++++++ kanidm/templates/configmap.yaml | 121 ++++++++++++++++ kanidm/templates/deployment.yaml | 133 +++++++++++++++++ kanidm/templates/hpa.yaml | 32 +++++ kanidm/templates/ingress.yaml | 61 ++++++++ kanidm/templates/pvc.yaml | 26 ++++ kanidm/templates/role.yaml | 26 ++++ kanidm/templates/rolebinging.yaml | 15 ++ kanidm/templates/service.yaml | 15 ++ kanidm/templates/serviceaccount.yaml | 13 ++ kanidm/templates/tests/test-connection.yaml | 15 ++ kanidm/values.yaml | 151 ++++++++++++++++++++ 15 files changed, 739 insertions(+) create mode 100644 kanidm/.helmignore create mode 100644 kanidm/Chart.yaml create mode 100644 kanidm/templates/NOTES.txt create mode 100644 kanidm/templates/_helpers.tpl create mode 100644 kanidm/templates/configmap.yaml create mode 100644 kanidm/templates/deployment.yaml create mode 100644 kanidm/templates/hpa.yaml create mode 100644 kanidm/templates/ingress.yaml create mode 100644 kanidm/templates/pvc.yaml create mode 100644 kanidm/templates/role.yaml create mode 100644 kanidm/templates/rolebinging.yaml create mode 100644 kanidm/templates/service.yaml create mode 100644 kanidm/templates/serviceaccount.yaml create mode 100644 kanidm/templates/tests/test-connection.yaml create mode 100644 kanidm/values.yaml diff --git a/kanidm/.helmignore b/kanidm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/kanidm/.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/kanidm/Chart.yaml b/kanidm/Chart.yaml new file mode 100644 index 0000000..38d9da2 --- /dev/null +++ b/kanidm/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: kanidm +description: A Helm chart for Kubernetes + +# 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.1.0 + +# 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: "1.16.0" diff --git a/kanidm/templates/NOTES.txt b/kanidm/templates/NOTES.txt new file mode 100644 index 0000000..f80bcfe --- /dev/null +++ b/kanidm/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 }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kanidm.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "kanidm.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kanidm.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 "kanidm.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/kanidm/templates/_helpers.tpl b/kanidm/templates/_helpers.tpl new file mode 100644 index 0000000..2b54e17 --- /dev/null +++ b/kanidm/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "kanidm.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 "kanidm.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 "kanidm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kanidm.labels" -}} +helm.sh/chart: {{ include "kanidm.chart" . }} +{{ include "kanidm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kanidm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kanidm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kanidm.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "kanidm.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/kanidm/templates/configmap.yaml b/kanidm/templates/configmap.yaml new file mode 100644 index 0000000..3653830 --- /dev/null +++ b/kanidm/templates/configmap.yaml @@ -0,0 +1,121 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ include "kanidm.fullname" . }}-config + labels: + {{- include "kanidm.labels" . | nindent 4 }} +data: + server.toml: | + # The webserver bind address. Requires TLS certificates. + # If the port is set to 443 you may require the + # NET_BIND_SERVICE capability. + # Defaults to "127.0.0.1:8443" + bindaddress = "{{ .Values.kanidm.bindaddress }}" + # + {{- if .Values.kanidmLdap.enabled }} + # The read-only ldap server bind address. Requires + # TLS certificates. If set to 636 you may require + # the NET_BIND_SERVICE capability. + # Defaults to "" (disabled) + dapbindaddress = "{{ .Values.kanidmLdap.dapbindaddress }}" + {{- else }} + # ldapbindaddress = "[::]:3636" + {{- end }} + # + # HTTPS requests can be reverse proxied by a loadbalancer. + # To preserve the original IP of the caller, these systems + # will often add a header such as "Forwarded" or + # "X-Forwarded-For". If set to true, then this header is + # respected as the "authoritative" source of the IP of the + # connected client. If you are not using a load balancer + # then you should leave this value as default. + # Defaults to false + trust_x_forward_for = {{ .Values.kanidm.trust_x_forward_for }} + # + # The path to the kanidm database. + db_path = "{{ .Values.kanidm.db_path }}" + # + # If you have a known filesystem, kanidm can tune the + # database page size to match. Valid choices are: + # [zfs, other] + # If you are unsure about this leave it as the default + # (other). After changing this + # value you must run a vacuum task. + # - zfs: + # * sets database pagesize to 64k. You must set + # recordsize=64k on the zfs filesystem. + # - other: + # * sets database pagesize to 4k, matching most + # filesystems block sizes. + {{- if .Values.kanidm.db_fs_type }} + db_fs_type = "{{ .Values.kanidm.db_fs_type }}" + {{- else }} + # db_fs_type = "zfs" + {{- end }} + # + # The number of entries to store in the in-memory cache. + # Minimum value is 256. If unset + # an automatic heuristic is used to scale this. + # You should only adjust this value if you experience + # memory pressure on your system. + {{- if .Values.kanidm.db_arc_size }} + db_arc_size = {{ .Values.kanidm.db_arc_size }} + {{- else }} + # db_arc_size = 2048 + {{- end }} + # + # TLS chain and key in pem format. Both must be present. + # If the server receives a SIGHUP, these files will be + # re-read and reloaded if their content is valid. + tls_chain = "{{ .Values.kanidm.tls_chain }}" + tls_key = "{{ .Values.kanidm.tls_key }}" + # + # The log level of the server. May be one of info, debug, trace + # + # NOTE: this can be overridden by the environment variable + # `KANIDM_LOG_LEVEL` at runtime + # Defaults to "info" + log_level = "{{ .Values.kanidm.log_level }}" + # + # The DNS domain name of the server. This is used in a + # number of security-critical contexts + # such as webauthn, so it *must* match your DNS + # hostname. It is used to create + # security principal names such as `william@idm.example.com` + # so that in a (future) trust configuration it is possible + # to have unique Security Principal Names (spns) throughout + # the topology. + # + # ⚠️ WARNING ⚠️ + # + # Changing this value WILL break many types of registered + # credentials for accounts including but not limited to + # webauthn, oauth tokens, and more. + # If you change this value you *must* run + # `kanidmd domain rename` immediately after. + domain = "{{ tpl .Values.kanidm.domain $ }}" + # + # The origin for webauthn. This is the url to the server, + # with the port included if it is non-standard (any port + # except 443). This must match or be a descendent of the + # domain name you configure above. If these two items are + # not consistent, the server WILL refuse to start! + # origin = "https://idm.example.com" + origin = "https://{{ tpl .Values.kanidm.domain $ }}:8443" + # + {{- if .Values.kanidmOnlineBackup.enabled }} + [online_backup] + # The path to the output folder for online backups + path = "{{ .Values.kanidmOnlineBackup.path }}" + # The schedule to run online backups (see https://crontab.guru/) + # every day at 22:00 UTC (default) + schedule = "{{ .Values.kanidmOnlineBackup.schedule }}" + # four times a day at 3 minutes past the hour, every 6th hours + # schedule = "03 */6 * * *" + # We also support non standard cron syntax, with the following format: + # sec min hour day of month month day of week year + # (it's very similar to the standard cron syntax, it just allows to specify the seconds + # at the beginning and the year at the end) + # Number of backups to keep (default 7) + versions = {{ .Values.kanidmOnlineBackup.versions }} + {{- end }} diff --git a/kanidm/templates/deployment.yaml b/kanidm/templates/deployment.yaml new file mode 100644 index 0000000..3cc1657 --- /dev/null +++ b/kanidm/templates/deployment.yaml @@ -0,0 +1,133 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "kanidm.fullname" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "kanidm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "kanidm.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "kanidm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + shareProcessNamespace: true + initContainers: + - name: {{ .Chart.Name }}-certs + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: + - bash + - -c + - kanidmd cert-generate + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: kanidm-data + mountPath: "/data" + - name: kanidm-config + mountPath: /data/server.toml + subPath: server.toml + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + - name: {{ .Chart.Name }}-db-pass + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: + - bash + - -c + - | + zypper install -y gawk kubernetes-client + /sbin/kanidmd server -c /data/server.toml & + serverPID=$! + until curl -k --output /dev/null --silent --head --fail https://localhost:8443; do + printf '.' + sleep 5 + done + ADMIN_PASS=$(kanidmd recover-account admin 2>/dev/null | gawk 'match($0, /new_password:(.*)/, a) { gsub(/ |"/, "", a[1]); print a[1]}') + IDM_ADMIN_PASS=$(kanidmd recover-account idm_admin 2>/dev/null | gawk 'match($0, /new_password:(.*)/, a) { gsub(/ |"/, "", a[1]); print a[1]}') + kill $serverPID + kubectl delete secret kanidm-passwords --ignore-not-found + kubectl create secret generic kanidm-passwords --from-literal=admin="$ADMIN_PASS" --from-literal=idm_admin="$IDM_ADMIN_PASS" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: kanidm-data + mountPath: "/data" + - name: kanidm-config + mountPath: /data/server.toml + subPath: server.toml + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: kanidm-data + mountPath: "/data" + - name: kanidm-config + mountPath: /data/server.toml + subPath: server.toml + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - name: kanidm-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "kanidm.fullname" .) }}-data + {{- else }} + emptyDir: {} + {{- end }} + - name: kanidm-config + configMap: + name: {{ include "kanidm.fullname" . }}-config + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- 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/kanidm/templates/hpa.yaml b/kanidm/templates/hpa.yaml new file mode 100644 index 0000000..8234969 --- /dev/null +++ b/kanidm/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "kanidm.fullname" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "kanidm.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/kanidm/templates/ingress.yaml b/kanidm/templates/ingress.yaml new file mode 100644 index 0000000..d4b3cb4 --- /dev/null +++ b/kanidm/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "kanidm.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- 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 "kanidm.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: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/kanidm/templates/pvc.yaml b/kanidm/templates/pvc.yaml new file mode 100644 index 0000000..1097802 --- /dev/null +++ b/kanidm/templates/pvc.yaml @@ -0,0 +1,26 @@ +--- +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "kanidm.fullname" . }}-data + labels: + {{- include "kanidm.labels" . | nindent 4 }} +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/kanidm/templates/role.yaml b/kanidm/templates/role.yaml new file mode 100644 index 0000000..ae030be --- /dev/null +++ b/kanidm/templates/role.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "kanidm.fullname" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} +rules: + - apiGroups: [""] + resources: ["pods"] + verbs: ["list", "get", "watch", "create", "delete"] + - apiGroups: [""] + resources: ["pods/exec"] + verbs: ["create"] + - apiGroups: [""] + resources: ["pods/log"] + verbs: ["get"] + - apiGroups: [""] + resources: ["pods/attach"] + verbs: ["list", "get", "create", "delete", "update"] + - apiGroups: [""] + resources: ["secrets"] + verbs: ["list", "get", "create", "delete", "update"] + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["list", "get", "create", "delete", "update"] diff --git a/kanidm/templates/rolebinging.yaml b/kanidm/templates/rolebinging.yaml new file mode 100644 index 0000000..042b4bc --- /dev/null +++ b/kanidm/templates/rolebinging.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ include "kanidm.fullname" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + name: {{ include "kanidm.fullname" . }} + kind: Role +subjects: +- kind: ServiceAccount + name: {{ include "kanidm.fullname" . }} + namespace: {{ .Release.Namespace }} diff --git a/kanidm/templates/service.yaml b/kanidm/templates/service.yaml new file mode 100644 index 0000000..0bf4f90 --- /dev/null +++ b/kanidm/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "kanidm.fullname" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "kanidm.selectorLabels" . | nindent 4 }} diff --git a/kanidm/templates/serviceaccount.yaml b/kanidm/templates/serviceaccount.yaml new file mode 100644 index 0000000..db80a07 --- /dev/null +++ b/kanidm/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "kanidm.serviceAccountName" . }} + labels: + {{- include "kanidm.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/kanidm/templates/tests/test-connection.yaml b/kanidm/templates/tests/test-connection.yaml new file mode 100644 index 0000000..5516800 --- /dev/null +++ b/kanidm/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "kanidm.fullname" . }}-test-connection" + labels: + {{- include "kanidm.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "kanidm.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/kanidm/values.yaml b/kanidm/values.yaml new file mode 100644 index 0000000..9faa1d7 --- /dev/null +++ b/kanidm/values.yaml @@ -0,0 +1,151 @@ +# Default values for kanidm. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: docker.io/kanidm/server + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1.5.0" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +kanidm: + bindaddress: "[::]:8443" + domain: "idm.example.com" + #origin: "https://{{ .Values.kanidm.domain }}:8443 + trust_x_forward_for: true + db_path: "/data/kanidm.db" + #db_fs_type: "zfs" + #db_arc_size: "2048" + tls_chain: "/data/chain.pem" + tls_key: "/data/key.pem" + log_level: "debug" + +kanidmLdap: + enabled: false + dapbindaddress: "[::]:3636" + +kanidmOnlineBackup: + enabled: true + path: "/data/kanidm/backups/" + schedule: "00 22 * * *" + versions: "7" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # 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: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8443 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +persistence: + enabled: true + annotations: {} + ## PeerTube data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + + accessMode: ReadWriteOnce + size: 1Gi + +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 + +livenessProbe: + httpGet: + scheme: HTTPS + path: / + port: http +readinessProbe: + httpGet: + scheme: HTTPS + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {}