{{/* # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. */}} {{- if .Values.manifests.region_statefulset }} {{- $envAll := . }} {{- $serviceAccountName := "maas-region" }} {{- $mounts_maas_region := .Values.pod.mounts.maas_region.maas_region }} {{- $mounts_maas_region_init := .Values.pod.mounts.maas_region.init_container }} {{ tuple $envAll "region_controller" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: maas-region annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: serviceName: maas-region-ui replicas: {{ .Values.pod.replicas.region }} updateStrategy: type: 'RollingUpdate' template: metadata: labels: {{ tuple $envAll "maas" "region" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: {{ dict "envAll" $envAll "podName" "maas-region" "containerNames" (list "maas-region") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "maas" "region" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }} initContainers: {{ tuple $envAll "region_controller" $mounts_maas_region_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: {{- if .Values.conf.cache.enabled }} - name: maas-cache image: {{ .Values.images.tags.maas_cache }} imagePullPolicy: {{ .Values.images.pull_policy }} {{- end }} - name: maas-region image: {{ .Values.images.tags.maas_region }} imagePullPolicy: {{ .Values.images.pull_policy }} tty: true {{ tuple $envAll $envAll.Values.pod.resources.maas_region | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} ports: - name: region-api containerPort: {{ tuple "maas_region" "podport" "region_api" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: region-proxy containerPort: {{ tuple "maas_region" "podport" "region_proxy" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: tcpSocket: port: {{ tuple "maas_region" "podport" "region_api" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }} securityContext: privileged: true command: - /tmp/start.sh volumeMounts: - mountPath: /sys/fs/cgroup name: host-sys-fs-cgroup readOnly: true - mountPath: /run name: pod-run - mountPath: /run/lock name: pod-run-lock - mountPath: /tmp name: pod-tmp - name: maas-region-secret mountPath: /var/lib/maas/secret subPath: REGION_SECRET readOnly: true - name: maas-etc mountPath: /etc/bind/named.conf.options subPath: named.conf.options readOnly: true - name: maas-etc mountPath: /etc/maas/regiond.conf subPath: regiond.conf readOnly: true {{- if .Values.conf.curtin.override }} - name: maas-etc mountPath: /etc/maas/preseeds/curtin_userdata subPath: curtin_userdata readOnly: true {{- end }} {{- if .Values.conf.drivers }} - name: maas-etc mountPath: /etc/maas/drivers.yaml subPath: drivers.yaml readOnly: true {{- end }} - name: maas-bin mountPath: /tmp/start.sh subPath: start.sh readOnly: true - name: maas-etc mountPath: /etc/nsswitch.conf subPath: nsswitch.conf readOnly: true {{- if .Values.conf.maas.ntp.disable_ntpd_region }} - name: maas-bin mountPath: /usr/sbin/ntpd subPath: ntpd.sh readOnly: true {{- end }} {{- if $mounts_maas_region.volumeMounts }}{{ toYaml $mounts_maas_region.volumeMounts | indent 12 }}{{ end }} volumes: - name: host-sys-fs-cgroup hostPath: path: /sys/fs/cgroup - name: pod-run emptyDir: {} - name: pod-run-lock emptyDir: {} - name: pod-tmp emptyDir: {} - name: maas-etc configMap: name: maas-etc defaultMode: 0444 - name: maas-bin configMap: name: maas-bin defaultMode: 0555 - name: maas-region-secret secret: secretName: {{ .Values.secrets.maas_region.name }} {{- if $mounts_maas_region.volumes }}{{ toYaml $mounts_maas_region.volumes | indent 8 }}{{ end }} ... {{- end }}