apiVersion: batch/v1
kind: Job
metadata:
  name: openvswitch-set-external-ip
  namespace: {{ kolla_kubernetes_namespace }}
spec:
  template:
    spec:
      hostNetwork: True
      nodeSelector:
{%- set selector = kolla_kubernetes_hostlabel_network |
                   default(kolla_kubernetes_hostlabel_controller)
%}
          {{ selector.key }}: {{ selector.value }}
      containers:
        - image: "{{ openvswitch_vswitchd_image_full }}"
          name: main
          securityContext:
            privileged: true
          command:
            - /bin/bash
            - -xec
            - |
              ip addr add {{ kolla_kubernetes_external_bridge_ip | default(kolla_kubernetes_external_vip) }}/{{ kolla_kubernetes_external_subnet | default("24") }} dev {{ neutron_bridge_name }};
              ip link set {{ neutron_bridge_name }} up;
      restartPolicy: OnFailure
