Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | */}} |
| 14 | |
| 15 | {{- define "apiProbeTemplate" }} |
| 16 | httpGet: |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 17 | scheme: {{ tuple "identity" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 18 | path: /v3/ |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 19 | port: {{ tuple "identity" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 20 | {{- end }} |
| 21 | |
| 22 | {{- if .Values.manifests.deployment_api }} |
| 23 | {{- $envAll := . }} |
| 24 | |
| 25 | {{- $mounts_keystone_api := .Values.pod.mounts.keystone_api.keystone_api }} |
| 26 | {{- $mounts_keystone_api_init := .Values.pod.mounts.keystone_api.init_container }} |
| 27 | |
| 28 | {{- $serviceAccountName := "keystone-api" }} |
| 29 | {{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 30 | --- |
| 31 | apiVersion: apps/v1 |
| 32 | kind: Deployment |
| 33 | metadata: |
| 34 | name: keystone-api |
| 35 | annotations: |
| 36 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 37 | labels: |
| 38 | {{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 39 | spec: |
| 40 | replicas: {{ .Values.pod.replicas.api }} |
| 41 | selector: |
| 42 | matchLabels: |
| 43 | {{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 44 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 45 | template: |
| 46 | metadata: |
| 47 | labels: |
| 48 | {{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 49 | annotations: |
| 50 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 51 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 52 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
Oleksandr K. | 4a0e28f | 2024-11-21 03:23:41 +0100 | [diff] [blame] | 53 | {{ tuple "keystone_api" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 54 | {{ dict "envAll" $envAll "podName" "keystone-api" "containerNames" (list "keystone-api") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 55 | spec: |
| 56 | {{ dict "envAll" $envAll "application" "keystone" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 57 | serviceAccountName: {{ $serviceAccountName }} |
| 58 | affinity: |
| 59 | {{ tuple $envAll "keystone" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 60 | nodeSelector: |
| 61 | {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 62 | {{ if $envAll.Values.pod.tolerations.keystone.enabled }} |
| 63 | {{ tuple $envAll "keystone" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 64 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 65 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} |
| 66 | initContainers: |
| 67 | {{ tuple $envAll "api" $mounts_keystone_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 68 | containers: |
| 69 | - name: keystone-api |
| 70 | {{ tuple $envAll "keystone_api" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 71 | {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 72 | {{ dict "envAll" $envAll "application" "keystone" "container" "keystone_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 73 | command: |
| 74 | - /tmp/keystone-api.sh |
| 75 | - start |
| 76 | lifecycle: |
| 77 | preStop: |
| 78 | exec: |
| 79 | command: |
| 80 | - /tmp/keystone-api.sh |
| 81 | - stop |
| 82 | ports: |
| 83 | - name: ks-pub |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 84 | containerPort: {{ tuple "identity" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 85 | {{ dict "envAll" $envAll "component" "api" "container" "api" "type" "readiness" "probeTemplate" (include "apiProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | trim | indent 10 }} |
| 86 | {{ dict "envAll" $envAll "component" "api" "container" "api" "type" "liveness" "probeTemplate" (include "apiProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | trim | indent 10 }} |
| 87 | volumeMounts: |
| 88 | - name: pod-tmp |
| 89 | mountPath: /tmp |
| 90 | - name: etckeystone |
| 91 | mountPath: /etc/keystone |
Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 92 | {{- range $k, $v := .Values.conf.ks_domains }} |
| 93 | - name: keystone-etc |
| 94 | mountPath: /etc/keystone/domains/keystone.{{ $k }}.conf |
| 95 | subPath: keystone.{{ $k }}.conf |
| 96 | readOnly: true |
| 97 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 98 | - name: logs-apache |
| 99 | mountPath: /var/log/apache2 |
| 100 | - name: run-apache |
| 101 | mountPath: /var/run/apache2 |
| 102 | - name: wsgi-keystone |
| 103 | mountPath: /var/www/cgi-bin/keystone |
| 104 | - name: keystone-etc |
| 105 | mountPath: /etc/keystone/keystone.conf |
| 106 | subPath: keystone.conf |
| 107 | readOnly: true |
| 108 | - name: keystone-etc |
| 109 | mountPath: /etc/apache2/ports.conf |
| 110 | subPath: ports.conf |
| 111 | readOnly: true |
| 112 | {{- if .Values.conf.keystone.DEFAULT.log_config_append }} |
| 113 | - name: keystone-etc |
| 114 | mountPath: {{ .Values.conf.keystone.DEFAULT.log_config_append }} |
| 115 | subPath: {{ base .Values.conf.keystone.DEFAULT.log_config_append }} |
| 116 | readOnly: true |
| 117 | {{- end }} |
| 118 | - name: keystone-etc |
| 119 | mountPath: /etc/keystone/policy.yaml |
| 120 | subPath: policy.yaml |
| 121 | readOnly: true |
| 122 | - name: keystone-etc |
| 123 | mountPath: /etc/keystone/access_rules.json |
| 124 | subPath: access_rules.json |
| 125 | readOnly: true |
| 126 | - name: keystone-etc |
| 127 | mountPath: /etc/keystone/sso_callback_template.html |
| 128 | subPath: sso_callback_template.html |
| 129 | readOnly: true |
| 130 | - name: keystone-etc |
| 131 | mountPath: {{ .Values.conf.software.apache2.conf_dir }}/wsgi-keystone.conf |
| 132 | subPath: wsgi-keystone.conf |
| 133 | readOnly: true |
| 134 | - name: keystone-etc |
| 135 | mountPath: {{ .Values.conf.software.apache2.mods_dir }}/mpm_event.conf |
| 136 | subPath: mpm_event.conf |
| 137 | readOnly: true |
| 138 | {{- if .Values.conf.security }} |
| 139 | - name: keystone-etc |
| 140 | mountPath: {{ .Values.conf.software.apache2.conf_dir }}/security.conf |
| 141 | subPath: security.conf |
| 142 | readOnly: true |
| 143 | {{- end }} |
| 144 | - name: keystone-bin |
| 145 | mountPath: /tmp/keystone-api.sh |
| 146 | subPath: keystone-api.sh |
| 147 | readOnly: true |
| 148 | {{- if .Values.endpoints.ldap.auth.client.tls.ca }} |
| 149 | - name: keystone-ldap-tls |
| 150 | mountPath: /etc/keystone/ldap/tls.ca |
| 151 | subPath: tls.ca |
| 152 | readOnly: true |
| 153 | {{- end }} |
| 154 | {{- if eq .Values.conf.keystone.token.provider "fernet" }} |
| 155 | - name: keystone-fernet-keys |
| 156 | mountPath: {{ .Values.conf.keystone.fernet_tokens.key_repository }} |
| 157 | {{- end }} |
| 158 | - name: keystone-credential-keys |
| 159 | mountPath: {{ .Values.conf.keystone.credential.key_repository }} |
Oleksandr K. | 4a0e28f | 2024-11-21 03:23:41 +0100 | [diff] [blame] | 160 | {{- dict "enabled" .Values.tls.oslo_db "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 161 | {{- dict "enabled" .Values.tls.identity "name" .Values.secrets.tls.identity.api.internal "path" "/etc/keystone/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 162 | {{- dict "enabled" $envAll.Values.tls.oslo_messaging "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
| 163 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 164 | {{ if $mounts_keystone_api.volumeMounts }}{{ toYaml $mounts_keystone_api.volumeMounts | indent 12 }}{{ end }} |
| 165 | volumes: |
| 166 | - name: pod-tmp |
| 167 | emptyDir: {} |
| 168 | - name: etckeystone |
| 169 | emptyDir: {} |
| 170 | - name: wsgi-keystone |
| 171 | emptyDir: {} |
| 172 | - name: logs-apache |
| 173 | emptyDir: {} |
| 174 | - name: run-apache |
| 175 | emptyDir: {} |
| 176 | - name: keystone-etc |
| 177 | secret: |
| 178 | secretName: keystone-etc |
| 179 | defaultMode: 0444 |
| 180 | - name: keystone-bin |
| 181 | configMap: |
| 182 | name: keystone-bin |
| 183 | defaultMode: 0555 |
| 184 | {{- if .Values.endpoints.ldap.auth.client.tls.ca }} |
| 185 | - name: keystone-ldap-tls |
| 186 | secret: |
| 187 | secretName: keystone-ldap-tls |
| 188 | {{- end }} |
| 189 | {{- if eq .Values.conf.keystone.token.provider "fernet" }} |
| 190 | - name: keystone-fernet-keys |
| 191 | secret: |
| 192 | secretName: keystone-fernet-keys |
| 193 | {{- end }} |
| 194 | - name: keystone-credential-keys |
| 195 | secret: |
| 196 | secretName: keystone-credential-keys |
Oleksandr K. | 4a0e28f | 2024-11-21 03:23:41 +0100 | [diff] [blame] | 197 | {{- dict "enabled" .Values.tls.oslo_db "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 198 | {{- dict "enabled" .Values.tls.identity "name" .Values.secrets.tls.identity.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 199 | {{- dict "enabled" $envAll.Values.tls.oslo_messaging "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
| 200 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 201 | {{ if $mounts_keystone_api.volumes }}{{ toYaml $mounts_keystone_api.volumes | indent 8 }}{{ end }} |
| 202 | {{- end }} |