apiVersion: apps/v1
kind: Deployment
metadata:
  name: "egress-ip-assign"
  labels:
    name: "egress-ip-assign"
spec:
  replicas: 1
  selector:
    matchLabels:
      name: "egress-ip-assign"
  template:
    metadata:
      labels:
        name: "egress-ip-assign"
    spec:
      # Pin it on k8s2 so it becomes the gateway node
      nodeSelector:
        cilium.io/ci-node: k8s2
      hostNetwork: true
      containers:
      - name: egress-ip
        image: docker.io/library/busybox:1.31.1
        command: ["/bin/sh","-c"]
        securityContext:
          privileged: true
        env:
        - name: EGRESS_IP
          value: "INPUT_EGRESS_IP/24"
        args:
        - "ip address add $EGRESS_IP dev enp0s8; sleep inf"
        lifecycle:
          preStop:
            exec:
              command:
              - "/bin/sh"
              - "-c"
              - "ip address del $EGRESS_IP dev enp0s8"
