{%- set resourceName = kolla_kubernetes.cli.args.resource_name %} {%- set netHostTrue = "yes" %} {%- import "services/common/common-lib.yml.j2" as lib with context %} apiVersion: extensions/v1beta1 kind: DaemonSet metadata: name: keepalived labels: component: keepalived system: keepalived namespace: {{ kolla_kubernetes_namespace }} spec: template: metadata: labels: component: keepalived system: keepalived annotations: pod.alpha.kubernetes.io/init-containers: '[ { "name": "initialize-keepalived-config", "image": "{{ keepalived_image_full }}", "command": [ "sh", "-c", "cp -a /srv/configmap/..data/* /srv/pod-main-config/; API_INTERFACE={{ api_interface }}; F=/var/lib/kolla-kubernetes/keepalived/api_interface; [ -f $F ] && API_INTERFACE=$(<$F); sed -i ''s|interface.*|interface ''$API_INTERFACE''|g'' /srv/pod-main-config/keepalived.conf; sed -i ''s|\\(dev*\\).*|\\1 ''$API_INTERFACE''|g'' /srv/pod-main-config/keepalived.conf; " ], "volumeMounts": [ { "name": "keepalived-configmap", "mountPath": "/srv/configmap" }, { "name": "pod-main-config", "mountPath": "/srv/pod-main-config" }, { "name": "host-var-lib-kk", "mountPath": "/var/lib/kolla-kubernetes" } ] } ]' spec: hostNetwork: True nodeSelector: {%- set selector = kolla_kubernetes_hostlabel_keepalived | default(kolla_kubernetes_hostlabel_controller) %} {{ selector.key }}: {{ selector.value }} containers: - image: "{{ keepalived_image_full }}" name: main securityContext: privileged: true env: - name: KOLLA_CONFIG_STRATEGY value: {{ config_strategy }} volumeMounts: {{ lib.common_volume_mounts(indent=12) }} - mountPath: {{ container_config_directory }} name: pod-main-config readOnly: true - mountPath: /lib/modules name: host-lib-modules - mountPath: /run name: host-run volumes: {{ lib.common_volumes(indent=8) }} - name: pod-main-config emptyDir: {} - name: keepalived-configmap configMap: name: keepalived - name: host-lib-modules hostPath: path: /lib/modules - name: host-run hostPath: path: /run - name: host-var-lib-kk hostPath: path: /var/lib/kolla-kubernetes