{{/* Copyright 2018 AT&T Intellectual Property. All other 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. */}} {{- $envAll := . }} {{- $labels := tuple $envAll "kubernetes" "haproxy-anchor" | include "helm-toolkit.snippets.kubernetes_metadata_labels" -}} --- apiVersion: apps/v1 kind: DaemonSet metadata: name: haproxy-anchor labels: {{ $labels | indent 4 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: selector: matchLabels: {{ $labels | indent 6 }} {{ tuple $envAll "haproxy_anchor" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: labels: {{ $labels | indent 8 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} {{ dict "envAll" $envAll "podName" "haproxy-anchor" "containerNames" (list "haproxy-perms" "anchor") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: {{ dict "envAll" $envAll "application" "haproxy_anchor" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} priorityClassName: system-node-critical tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule - key: CriticalAddonsOnly operator: Exists terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.haproxy_anchor.timeout }} serviceAccountName: haproxy-anchor initContainers: - name: haproxy-perms image: {{ .Values.images.tags.anchor }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ dict "envAll" $envAll "application" "haproxy" "container" "haproxy_perms" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.haproxy_anchor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/perms_update.sh volumeMounts: - name: pod-tmp mountPath: /tmp - name: haproxy-bin mountPath: /tmp/perms_update.sh subPath: perms_update.sh readOnly: false - name: host mountPath: /host mountPropagation: HostToContainer containers: - name: anchor image: {{ .Values.images.tags.anchor }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ dict "envAll" $envAll "application" "haproxy_anchor" "container" "anchor" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.haproxy_anchor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - name: HAPROXY_HEADER value: /tmp/etc/haproxy.cfg.header - name: HAPROXY_CONF value: /host{{ .Values.conf.haproxy.host_config_dir }}/haproxy.cfg - name: NEXT_HAPROXY_CONF value: "$(HAPROXY_CONF)-next" - name: HAPROXY_SERVER_OPTS value: {{ .Values.conf.haproxy.server_opts | quote }} - name: KUBE_CA value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - name: KUBE_TOKEN value: /var/run/secrets/kubernetes.io/serviceaccount/token - name: KUBE_URL value: {{ .Values.conf.anchor.kubernetes_url | quote }} - name: RUNASUSER value: {{ .Values.pod.security_context.haproxy.pod.runAsUser | quote }} command: - /tmp/bin/anchor.sh lifecycle: preStop: exec: command: - /tmp/bin/pre_stop.sh volumeMounts: - name: haproxy-bin mountPath: /tmp/bin - name: haproxy-etc mountPath: /tmp/etc - name: host mountPath: /host mountPropagation: HostToContainer - name: pod-tmp mountPath: /tmp volumes: - name: haproxy-bin configMap: name: haproxy-bin defaultMode: 0555 - name: haproxy-etc configMap: name: haproxy-etc defaultMode: 0444 - name: host hostPath: path: / - name: pod-tmp emptyDir: {}