Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Copyright 2019 Intel Corporation. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | {{- if .Values.manifests.deployment }} |
| 18 | {{- $envAll := . }} |
| 19 | |
| 20 | {{- $mounts_placement := .Values.pod.mounts.placement.placement }} |
| 21 | {{- $mounts_placement_init := .Values.pod.mounts.placement.init_container }} |
| 22 | |
| 23 | {{- $serviceAccountName := "placement-api" }} |
| 24 | {{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 25 | --- |
| 26 | apiVersion: apps/v1 |
| 27 | kind: Deployment |
| 28 | metadata: |
| 29 | name: placement-api |
| 30 | annotations: |
| 31 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 32 | labels: |
| 33 | {{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 34 | spec: |
| 35 | replicas: {{ .Values.pod.replicas.api }} |
| 36 | selector: |
| 37 | matchLabels: |
| 38 | {{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 39 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 40 | template: |
| 41 | metadata: |
| 42 | labels: |
| 43 | {{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 44 | annotations: |
| 45 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 46 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 47 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 48 | {{ dict "envAll" $envAll "podName" "placement-api" "containerNames" (list "placement-api" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 49 | spec: |
Dong Ma | e11498d | 2025-02-12 03:36:18 +0000 | [diff] [blame] | 50 | {{ with .Values.pod.priorityClassName.placement }} |
| 51 | priorityClassName: {{ . }} |
| 52 | {{ end }} |
| 53 | {{ with .Values.pod.runtimeClassName.placement }} |
| 54 | runtimeClassName: {{ . }} |
| 55 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 56 | serviceAccountName: {{ $serviceAccountName }} |
| 57 | {{ dict "envAll" $envAll "application" "placement" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 58 | affinity: |
| 59 | {{ tuple $envAll "placement" "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 }} |
| 62 | {{ if $envAll.Values.pod.tolerations.placement.enabled }} |
| 63 | {{ tuple $envAll "placement" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 64 | {{ end }} |
| 65 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} |
| 66 | initContainers: |
| 67 | {{ tuple $envAll "api" $mounts_placement_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 68 | containers: |
| 69 | - name: placement-api |
| 70 | {{ tuple $envAll "placement" | 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" "placement" "container" "placement_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 73 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 74 | env: |
| 75 | - name: REQUESTS_CA_BUNDLE |
| 76 | value: "/etc/placement/certs/ca.crt" |
| 77 | {{- end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 78 | command: |
| 79 | - /tmp/placement-api.sh |
| 80 | - start |
| 81 | lifecycle: |
| 82 | preStop: |
| 83 | exec: |
| 84 | command: |
| 85 | - /tmp/placement-api.sh |
| 86 | - stop |
| 87 | ports: |
| 88 | - name: p-api |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 89 | containerPort: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 90 | readinessProbe: |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 91 | httpGet: |
| 92 | scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} |
| 93 | path: / |
| 94 | port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Oleksandr Kozachenko | 57dcd1e | 2023-10-04 17:34:56 +0200 | [diff] [blame] | 95 | initialDelaySeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 96 | periodSeconds: 10 |
| 97 | livenessProbe: |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 98 | httpGet: |
| 99 | scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} |
| 100 | path: / |
| 101 | port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Oleksandr Kozachenko | 57dcd1e | 2023-10-04 17:34:56 +0200 | [diff] [blame] | 102 | initialDelaySeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 103 | periodSeconds: 10 |
| 104 | volumeMounts: |
| 105 | - name: pod-tmp |
| 106 | mountPath: /tmp |
| 107 | - name: wsgi-placement |
| 108 | mountPath: /var/www/cgi-bin/placement |
| 109 | - name: placement-bin |
| 110 | mountPath: /tmp/placement-api.sh |
| 111 | subPath: placement-api.sh |
| 112 | readOnly: true |
| 113 | - name: placement-etc |
| 114 | mountPath: /etc/placement/placement.conf |
| 115 | subPath: placement.conf |
| 116 | readOnly: true |
Oleksandr Kozachenko | 57dcd1e | 2023-10-04 17:34:56 +0200 | [diff] [blame] | 117 | - name: placement-etc |
| 118 | mountPath: /etc/placement/placement-api-uwsgi.ini |
| 119 | subPath: placement-api-uwsgi.ini |
| 120 | readOnly: true |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 121 | {{- if .Values.conf.placement.DEFAULT.log_config_append }} |
| 122 | - name: placement-etc |
| 123 | mountPath: {{ .Values.conf.placement.DEFAULT.log_config_append }} |
| 124 | subPath: {{ base .Values.conf.placement.DEFAULT.log_config_append }} |
| 125 | readOnly: true |
| 126 | {{- end }} |
| 127 | - name: placement-etc |
| 128 | mountPath: /etc/placement/policy.yaml |
| 129 | subPath: policy.yaml |
| 130 | readOnly: true |
| 131 | - name: placement-etc |
| 132 | mountPath: /etc/apache2/conf-enabled/wsgi-placement.conf |
| 133 | subPath: wsgi-placement.conf |
| 134 | readOnly: true |
| 135 | {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 136 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.placement.api.internal "path" "/etc/placement/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 137 | {{ if $mounts_placement.volumeMounts }}{{ toYaml $mounts_placement.volumeMounts | indent 12 }}{{ end }} |
| 138 | volumes: |
| 139 | - name: pod-tmp |
| 140 | emptyDir: {} |
| 141 | - name: wsgi-placement |
| 142 | emptyDir: {} |
| 143 | - name: placement-bin |
| 144 | configMap: |
| 145 | name: placement-bin |
| 146 | defaultMode: 0555 |
| 147 | - name: placement-etc |
| 148 | secret: |
| 149 | secretName: placement-etc |
| 150 | defaultMode: 0444 |
| 151 | {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
Mohammed Naser | bcdd25c | 2023-01-18 03:38:47 +0000 | [diff] [blame] | 152 | {{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.placement.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 153 | {{ if $mounts_placement.volumes }}{{ toYaml $mounts_placement.volumes | indent 8 }}{{ end }} |
| 154 | {{- end }} |