---
apiVersion: apps/v1
items:
- apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    annotations:
      deprecated.daemonset.template.generation: "1"
      kubernetes.io/description: |
        This daemon set launches the Open vSwitch daemon.
      release.openshift.io/version: 4.6.52
    creationTimestamp: "2022-03-08T10:38:11Z"
    generation: 1
    managedFields:
    - apiVersion: apps/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:deprecated.daemonset.template.generation: {}
            f:kubernetes.io/description: {}
            f:release.openshift.io/version: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"b48e3238-e625-4cc0-acf5-5166b34864a9"}:
              .: {}
              f:apiVersion: {}
              f:blockOwnerDeletion: {}
              f:controller: {}
              f:kind: {}
              f:name: {}
              f:uid: {}
        f:spec:
          f:revisionHistoryLimit: {}
          f:selector:
            f:matchLabels:
              .: {}
              f:app: {}
          f:template:
            f:metadata:
              f:labels:
                .: {}
                f:app: {}
                f:component: {}
                f:openshift.io/component: {}
                f:type: {}
            f:spec:
              f:affinity:
                .: {}
                f:nodeAffinity:
                  .: {}
                  f:requiredDuringSchedulingIgnoredDuringExecution:
                    .: {}
                    f:nodeSelectorTerms: {}
              f:containers:
                k:{"name":"openvswitch"}:
                  .: {}
                  f:command: {}
                  f:image: {}
                  f:imagePullPolicy: {}
                  f:name: {}
                  f:readinessProbe:
                    .: {}
                    f:exec:
                      .: {}
                      f:command: {}
                    f:failureThreshold: {}
                    f:initialDelaySeconds: {}
                    f:periodSeconds: {}
                    f:successThreshold: {}
                    f:timeoutSeconds: {}
                  f:resources:
                    .: {}
                    f:requests:
                      .: {}
                      f:cpu: {}
                      f:memory: {}
                  f:securityContext:
                    .: {}
                    f:privileged: {}
                  f:terminationMessagePath: {}
                  f:terminationMessagePolicy: {}
                  f:volumeMounts:
                    .: {}
                    k:{"mountPath":"/etc/openvswitch"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/host"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/lib/modules"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/run"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/sys"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
              f:dnsPolicy: {}
              f:hostNetwork: {}
              f:nodeSelector:
                .: {}
                f:kubernetes.io/os: {}
              f:priorityClassName: {}
              f:restartPolicy: {}
              f:schedulerName: {}
              f:securityContext: {}
              f:serviceAccount: {}
              f:serviceAccountName: {}
              f:terminationGracePeriodSeconds: {}
              f:tolerations: {}
              f:volumes:
                .: {}
                k:{"name":"host-config-openvswitch"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-modules"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-run"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-slash"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-sys"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
          f:updateStrategy:
            f:rollingUpdate:
              .: {}
              f:maxUnavailable: {}
            f:type: {}
        f:status:
          f:currentNumberScheduled: {}
          f:desiredNumberScheduled: {}
          f:numberReady: {}
      manager: cluster-network-operator
      operation: Update
      time: "2022-03-08T10:50:14Z"
    name: ovs
    namespace: openshift-sdn
    ownerReferences:
    - apiVersion: operator.openshift.io/v1
      blockOwnerDeletion: true
      controller: true
      kind: Network
      name: cluster
      uid: b48e3238-e625-4cc0-acf5-5166b34864a9
    resourceVersion: "22529"
    selfLink: /apis/apps/v1/namespaces/openshift-sdn/daemonsets/ovs
    uid: bb69a0b2-e1b9-40de-be1a-2ef10cd41b70
  spec:
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: ovs
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: ovs
          component: network
          openshift.io/component: network
          type: infra
      spec:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: network.operator.openshift.io/external-openvswitch
                  operator: DoesNotExist
        containers:
        - command:
          - /bin/bash
          - -c
          - |
            #!/bin/bash
            set -euo pipefail
            export SYSTEMD_IGNORE_CHROOT=yes

            # systemctl cannot be used in a separate PID namespace to reach
            # the systemd running in PID 1. Therefore we need to use the dbus API
            systemctl_restart(){
              gdbus call \
                --system \
                --dest org.freedesktop.systemd1 \
                --object-path /org/freedesktop/systemd1/unit/"$(svc_encode_name ${1})"_2eservice \
                --method org.freedesktop.systemd1.Unit.Restart "replace"
            }
            svc_encode_name(){
              # systemd encodes some characters, so far we only need to encode
              # the character "-" but there may be more in the future.
              echo "${1//-/_2d}"
            }

            # Check to see if ovs is provided by the node:
            if [ -f /host/var/run/ovs-config-executed ]; then
              echo "openvswitch is running in systemd"
              # In some very strange corner cases, the owner for /run/openvswitch
              # can be wrong, so we need to clean up and restart.
              ovs_uid=$(chroot /host id -u openvswitch)
              ovs_gid=$(chroot /host id -g openvswitch)
              chown -R "${ovs_uid}:${ovs_gid}" /run/openvswitch
              if [[ ! -S /run/openvswitch/db.sock ]]; then
                systemctl_restart ovsdb-server
              fi
              # Don't need to worry about restoring flows; this can only change if we've rebooted
              exec tail -F /host/var/log/openvswitch/ovs-vswitchd.log /host/var/log/openvswitch/ovsdb-server.log
            else
              echo "openvswitch is running in container"
              # if another process is listening on the cni-server socket, wait until it exits
              retries=0
              while true; do
                if /usr/share/openvswitch/scripts/ovs-ctl status &>/dev/null; then
                  echo "warning: Another process is currently managing OVS, waiting 15s ..." 2>&1
                  sleep 15 & wait
                  (( retries += 1 ))
                else
                  break
                fi
                if [[ "${retries}" -gt 40 ]]; then
                  echo "error: Another process is currently managing OVS, exiting" 2>&1
                  exit 1
                fi
              done

              function quit {
                  # Save the flows
                  echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Saving flows ..." 2>&1
                  bridges=$(ovs-vsctl -- --real list-br)
                  TMPDIR=/var/run/openvswitch /usr/share/openvswitch/scripts/ovs-save save-flows $bridges > /var/run/openvswitch/flows.sh
                  echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Saved flows" 2>&1

                  # Don't allow ovs-vswitchd to clear datapath flows on exit
                  kill -9 $(cat /var/run/openvswitch/ovs-vswitchd.pid 2>/dev/null) 2>/dev/null || true
                  kill $(cat /var/run/openvswitch/ovsdb-server.pid 2>/dev/null) 2>/dev/null || true
                  exit 0
              }
              trap quit SIGTERM

              function deletePid {
                  rm /var/run/openvswitch/ovs-vswitchd.pid
                  rm /var/run/openvswitch/ovsdb-server.pid
              }
              trap deletePid EXIT

              chown -R openvswitch:openvswitch /var/run/openvswitch
              chown -R openvswitch:openvswitch /etc/openvswitch

              # launch OVS
              # Start the ovsdb so that we can prep it before we start the ovs-vswitchd
              /usr/share/openvswitch/scripts/ovs-ctl start --ovs-user=openvswitch:openvswitch --no-ovs-vswitchd --system-id=random --no-monitor

              # Set the flow-restore-wait to true so ovs-vswitchd will wait till flows are restored
              ovs-vsctl --no-wait set Open_vSwitch . other_config:flow-restore-wait=true

              # Restrict the number of pthreads ovs-vswitchd creates to reduce the
              # amount of RSS it uses on hosts with many cores
              # https://bugzilla.redhat.com/show_bug.cgi?id=1571379
              # https://bugzilla.redhat.com/show_bug.cgi?id=1572797
              if [[ `nproc` -gt 12 ]]; then
                  ovs-vsctl --no-wait set Open_vSwitch . other_config:n-revalidator-threads=4
                  ovs-vsctl --no-wait set Open_vSwitch . other_config:n-handler-threads=10
              fi

              # And finally start the ovs-vswitchd now the DB is prepped
              /usr/share/openvswitch/scripts/ovs-ctl start --ovs-user=openvswitch:openvswitch --no-ovsdb-server --system-id=random --no-monitor

              # Load any flows that we saved
              echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Loading previous flows ..." 2>&1
              if [[ -f /var/run/openvswitch/flows.sh ]]; then

                # There's a bug in the ovs-save script which causes flows.sh to specify
                # OpenFlow14, replace that to OpenFlow13 which is the only version we support.
                sed -i 's/OpenFlow[0-9][0-9]/OpenFlow13/g' /var/run/openvswitch/flows.sh

                echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Adding br0 if it doesn't exist ..." 2>&1
                /usr/bin/ovs-vsctl --may-exist add-br br0 -- set Bridge br0 fail_mode=secure protocols=OpenFlow13
                echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Created br0, now adding flows ..." 2>&1
                mv /var/run/openvswitch/flows.sh /var/run/openvswitch/flows-old.sh
                sh -x /var/run/openvswitch/flows-old.sh
                echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Done restoring the existing flows ..." 2>&1
                rm /var/run/openvswitch/flows-old.sh
              fi

              echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Remove other config ..." 2>&1
              ovs-vsctl --no-wait --if-exists remove Open_vSwitch . other_config flow-restore-wait=true
              echo "$(date -u "+%Y-%m-%d %H:%M:%S") info: Removed other config ..." 2>&1

              tail -F --pid=$(cat /var/run/openvswitch/ovs-vswitchd.pid) /var/log/openvswitch/ovs-vswitchd.log &
              tail -F --pid=$(cat /var/run/openvswitch/ovsdb-server.pid) /var/log/openvswitch/ovsdb-server.log &
              wait
            fi
          image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:980d20b31cdcd9db0a94e393b53799985ea399bbe8dbd552bf2e27e32cf0be7e
          imagePullPolicy: IfNotPresent
          name: openvswitch
          readinessProbe:
            exec:
              command:
              - /bin/bash
              - -c
              - |
                #!/bin/bash
                /usr/bin/ovs-vsctl -t 5 show > /dev/null
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 6
          resources:
            requests:
              cpu: 100m
              memory: 400Mi
          securityContext:
            privileged: true
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
          - mountPath: /lib/modules
            name: host-modules
            readOnly: true
          - mountPath: /run
            name: host-run
          - mountPath: /sys
            name: host-sys
            readOnly: true
          - mountPath: /etc/openvswitch
            name: host-config-openvswitch
          - mountPath: /host
            name: host-slash
            readOnly: true
        dnsPolicy: ClusterFirst
        hostNetwork: true
        nodeSelector:
          kubernetes.io/os: linux
        priorityClassName: system-node-critical
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        serviceAccount: sdn
        serviceAccountName: sdn
        terminationGracePeriodSeconds: 30
        tolerations:
        - operator: Exists
        volumes:
        - hostPath:
            path: /lib/modules
            type: ""
          name: host-modules
        - hostPath:
            path: /run
            type: ""
          name: host-run
        - hostPath:
            path: /sys
            type: ""
          name: host-sys
        - hostPath:
            path: /var/lib/openvswitch
            type: DirectoryOrCreate
          name: host-config-openvswitch
        - hostPath:
            path: /
            type: ""
          name: host-slash
    updateStrategy:
      rollingUpdate:
        maxUnavailable: 10%
      type: RollingUpdate
  status:
    currentNumberScheduled: 6
    desiredNumberScheduled: 6
    numberAvailable: 6
    numberMisscheduled: 0
    numberReady: 6
    observedGeneration: 1
    updatedNumberScheduled: 6
- apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    annotations:
      deprecated.daemonset.template.generation: "1"
      kubernetes.io/description: |
        This daemon set launches the OpenShift networking components (kube-proxy and openshift-sdn).
        It expects that OVS is running on the node.
      release.openshift.io/version: 4.6.52
    creationTimestamp: "2022-03-08T10:38:11Z"
    generation: 1
    managedFields:
    - apiVersion: apps/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:deprecated.daemonset.template.generation: {}
            f:kubernetes.io/description: {}
            f:release.openshift.io/version: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"b48e3238-e625-4cc0-acf5-5166b34864a9"}:
              .: {}
              f:apiVersion: {}
              f:blockOwnerDeletion: {}
              f:controller: {}
              f:kind: {}
              f:name: {}
              f:uid: {}
        f:spec:
          f:revisionHistoryLimit: {}
          f:selector:
            f:matchLabels:
              .: {}
              f:app: {}
          f:template:
            f:metadata:
              f:labels:
                .: {}
                f:app: {}
                f:component: {}
                f:openshift.io/component: {}
                f:type: {}
            f:spec:
              f:containers:
                k:{"name":"kube-rbac-proxy"}:
                  .: {}
                  f:command: {}
                  f:image: {}
                  f:imagePullPolicy: {}
                  f:name: {}
                  f:ports:
                    .: {}
                    k:{"containerPort":9101,"protocol":"TCP"}:
                      .: {}
                      f:containerPort: {}
                      f:hostPort: {}
                      f:name: {}
                      f:protocol: {}
                  f:resources:
                    .: {}
                    f:requests:
                      .: {}
                      f:cpu: {}
                      f:memory: {}
                  f:terminationMessagePath: {}
                  f:terminationMessagePolicy: {}
                  f:volumeMounts:
                    .: {}
                    k:{"mountPath":"/etc/pki/tls/metrics-certs"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                k:{"name":"sdn"}:
                  .: {}
                  f:command: {}
                  f:env:
                    .: {}
                    k:{"name":"K8S_NODE_IP"}:
                      .: {}
                      f:name: {}
                      f:valueFrom:
                        .: {}
                        f:fieldRef:
                          .: {}
                          f:apiVersion: {}
                          f:fieldPath: {}
                    k:{"name":"K8S_NODE_NAME"}:
                      .: {}
                      f:name: {}
                      f:valueFrom:
                        .: {}
                        f:fieldRef:
                          .: {}
                          f:apiVersion: {}
                          f:fieldPath: {}
                    k:{"name":"KUBERNETES_SERVICE_HOST"}:
                      .: {}
                      f:name: {}
                      f:value: {}
                    k:{"name":"KUBERNETES_SERVICE_PORT"}:
                      .: {}
                      f:name: {}
                      f:value: {}
                    k:{"name":"OPENSHIFT_DNS_DOMAIN"}:
                      .: {}
                      f:name: {}
                      f:value: {}
                  f:image: {}
                  f:imagePullPolicy: {}
                  f:lifecycle:
                    .: {}
                    f:preStop:
                      .: {}
                      f:exec:
                        .: {}
                        f:command: {}
                  f:name: {}
                  f:ports:
                    .: {}
                    k:{"containerPort":10256,"protocol":"TCP"}:
                      .: {}
                      f:containerPort: {}
                      f:hostPort: {}
                      f:name: {}
                      f:protocol: {}
                  f:readinessProbe:
                    .: {}
                    f:exec:
                      .: {}
                      f:command: {}
                    f:failureThreshold: {}
                    f:initialDelaySeconds: {}
                    f:periodSeconds: {}
                    f:successThreshold: {}
                    f:timeoutSeconds: {}
                  f:resources:
                    .: {}
                    f:requests:
                      .: {}
                      f:cpu: {}
                      f:memory: {}
                  f:securityContext:
                    .: {}
                    f:privileged: {}
                  f:terminationMessagePath: {}
                  f:terminationMessagePolicy: {}
                  f:volumeMounts:
                    .: {}
                    k:{"mountPath":"/config"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/env"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/etc/cni/net.d"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/etc/sysconfig"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/host"}:
                      .: {}
                      f:mountPath: {}
                      f:mountPropagation: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/host/opt/cni/bin"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/host/var/run/netns"}:
                      .: {}
                      f:mountPath: {}
                      f:mountPropagation: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/lib/modules"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/run/netns"}:
                      .: {}
                      f:mountPath: {}
                      f:mountPropagation: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/var/lib/cni/networks/openshift-sdn"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/var/run"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/var/run/dbus/"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/var/run/kubernetes/"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
                    k:{"mountPath":"/var/run/openshift-sdn"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                    k:{"mountPath":"/var/run/openvswitch/"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
                      f:readOnly: {}
              f:dnsPolicy: {}
              f:hostNetwork: {}
              f:hostPID: {}
              f:nodeSelector:
                .: {}
                f:kubernetes.io/os: {}
              f:priorityClassName: {}
              f:restartPolicy: {}
              f:schedulerName: {}
              f:securityContext: {}
              f:serviceAccount: {}
              f:serviceAccountName: {}
              f:terminationGracePeriodSeconds: {}
              f:tolerations: {}
              f:volumes:
                .: {}
                k:{"name":"config"}:
                  .: {}
                  f:configMap:
                    .: {}
                    f:defaultMode: {}
                    f:name: {}
                  f:name: {}
                k:{"name":"env-overrides"}:
                  .: {}
                  f:configMap:
                    .: {}
                    f:defaultMode: {}
                    f:name: {}
                    f:optional: {}
                  f:name: {}
                k:{"name":"etc-sysconfig"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-cni-bin"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-cni-conf"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-modules"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-run-netns"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-slash"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-lib-cni-networks-openshift-sdn"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run-dbus"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run-kubernetes"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run-netns"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run-openshift-sdn"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"host-var-run-ovs"}:
                  .: {}
                  f:hostPath:
                    .: {}
                    f:path: {}
                    f:type: {}
                  f:name: {}
                k:{"name":"sdn-metrics-certs"}:
                  .: {}
                  f:name: {}
                  f:secret:
                    .: {}
                    f:defaultMode: {}
                    f:optional: {}
                    f:secretName: {}
          f:updateStrategy:
            f:rollingUpdate:
              .: {}
              f:maxUnavailable: {}
            f:type: {}
        f:status:
          f:currentNumberScheduled: {}
          f:desiredNumberScheduled: {}
          f:numberReady: {}
      manager: cluster-network-operator
      operation: Update
      time: "2022-03-08T10:50:14Z"
    name: sdn
    namespace: openshift-sdn
    ownerReferences:
    - apiVersion: operator.openshift.io/v1
      blockOwnerDeletion: true
      controller: true
      kind: Network
      name: cluster
      uid: b48e3238-e625-4cc0-acf5-5166b34864a9
    resourceVersion: "22531"
    selfLink: /apis/apps/v1/namespaces/openshift-sdn/daemonsets/sdn
    uid: b00eb0b3-e2b2-46b1-b233-ccd1a93462cd
  spec:
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: sdn
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: sdn
          component: network
          openshift.io/component: network
          type: infra
      spec:
        containers:
        - command:
          - /bin/bash
          - -c
          - |
            #!/bin/bash
            set -euo pipefail

            # if another process is listening on the cni-server socket, wait until it exits
            trap 'kill $(jobs -p); rm -f /etc/cni/net.d/80-openshift-network.conf ; exit 0' TERM
            retries=0
            while true; do
              if echo 'test' | socat - UNIX-CONNECT:/var/run/openshift-sdn/cniserver/socket &>/dev/null; then
                echo "warning: Another process is currently listening on the CNI socket, waiting 15s ..." 2>&1
                sleep 15 & wait
                (( retries += 1 ))
              else
                break
              fi
              if [[ "${retries}" -gt 40 ]]; then
                echo "error: Another process is currently listening on the CNI socket, exiting" 2>&1
                exit 1
              fi
            done

            # local environment overrides
            if [[ -f /etc/sysconfig/openshift-sdn ]]; then
              set -o allexport
              source /etc/sysconfig/openshift-sdn
              set +o allexport
            fi
            #BUG: cdc accidentally mounted /etc/sysconfig/openshift-sdn as DirectoryOrCreate; clean it up so we can ultimately mount /etc/sysconfig/openshift-sdn as FileOrCreate
            # Once this is released, then we can mount it properly
            if [[ -d /etc/sysconfig/openshift-sdn ]]; then
              rmdir /etc/sysconfig/openshift-sdn || true
            fi

            # configmap-based overrides
            if [[ -f /env/${K8S_NODE_NAME} ]]; then
              set -o allexport
              source /env/${K8S_NODE_NAME}
              set +o allexport
            fi

            # Take over network functions on the node
            rm -f /etc/cni/net.d/80-openshift-network.conf
            cp -f /opt/cni/bin/openshift-sdn /host/opt/cni/bin/

            # Launch the network process
            exec /usr/bin/openshift-sdn-node \
              --node-name ${K8S_NODE_NAME} --node-ip ${K8S_NODE_IP} \
              --proxy-config /config/kube-proxy-config.yaml \
              --v ${OPENSHIFT_SDN_LOG_LEVEL:-2}
          env:
          - name: KUBERNETES_SERVICE_PORT
            value: "6443"
          - name: KUBERNETES_SERVICE_HOST
            value: api-int.case03116926.lab.upshift.rdu2.redhat.com
          - name: OPENSHIFT_DNS_DOMAIN
            value: cluster.local
          - name: K8S_NODE_NAME
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: spec.nodeName
          - name: K8S_NODE_IP
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: status.hostIP
          image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:980d20b31cdcd9db0a94e393b53799985ea399bbe8dbd552bf2e27e32cf0be7e
          imagePullPolicy: IfNotPresent
          lifecycle:
            preStop:
              exec:
                command:
                - rm
                - -f
                - /etc/cni/net.d/80-openshift-network.conf
                - /host/opt/cni/bin/openshift-sdn
          name: sdn
          ports:
          - containerPort: 10256
            hostPort: 10256
            name: healthz
            protocol: TCP
          readinessProbe:
            exec:
              command:
              - test
              - -f
              - /etc/cni/net.d/80-openshift-network.conf
            failureThreshold: 3
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 1
          resources:
            requests:
              cpu: 100m
              memory: 200Mi
          securityContext:
            privileged: true
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
          - mountPath: /config
            name: config
            readOnly: true
          - mountPath: /env
            name: env-overrides
          - mountPath: /var/run
            name: host-var-run
          - mountPath: /var/run/dbus/
            name: host-var-run-dbus
            readOnly: true
          - mountPath: /var/run/openvswitch/
            name: host-var-run-ovs
            readOnly: true
          - mountPath: /var/run/kubernetes/
            name: host-var-run-kubernetes
            readOnly: true
          - mountPath: /run/netns
            mountPropagation: HostToContainer
            name: host-run-netns
            readOnly: true
          - mountPath: /host/var/run/netns
            mountPropagation: HostToContainer
            name: host-var-run-netns
            readOnly: true
          - mountPath: /var/run/openshift-sdn
            name: host-var-run-openshift-sdn
          - mountPath: /host
            mountPropagation: HostToContainer
            name: host-slash
            readOnly: true
          - mountPath: /host/opt/cni/bin
            name: host-cni-bin
          - mountPath: /etc/cni/net.d
            name: host-cni-conf
          - mountPath: /var/lib/cni/networks/openshift-sdn
            name: host-var-lib-cni-networks-openshift-sdn
          - mountPath: /lib/modules
            name: host-modules
            readOnly: true
          - mountPath: /etc/sysconfig
            name: etc-sysconfig
            readOnly: true
        - command:
          - /bin/bash
          - -c
          - |
            #!/bin/bash
            set -euo pipefail
            TLS_PK=/etc/pki/tls/metrics-certs/tls.key
            TLS_CERT=/etc/pki/tls/metrics-certs/tls.crt

            # As the secret mount is optional we must wait for the files to be present.
            # The service is created in monitor.yaml and this is created in sdn.yaml.
            # If it isn't created there is probably an issue so we want to crashloop.
            TS=$(date +%s)
            WARN_TS=$(( ${TS} + $(( 20 * 60)) ))
            HAS_LOGGED_INFO=0

            log_missing_certs(){
                CUR_TS=$(date +%s)
                if [[ "${CUR_TS}" -gt "WARN_TS"  ]]; then
                  echo $(date -Iseconds) WARN: sdn-metrics-certs not mounted after 20 minutes.
                elif [[ "${HAS_LOGGED_INFO}" -eq 0 ]] ; then
                  echo $(date -Iseconds) INFO: sdn-metrics-certs not mounted. Waiting 20 minutes.
                  HAS_LOGGED_INFO=1
                fi
            }

            while [[ ! -f "${TLS_PK}" ||  ! -f "${TLS_CERT}" ]] ; do
              log_missing_certs
              sleep 5
            done

            echo $(date -Iseconds) INFO: sdn-metrics-certs mounted, starting kube-rbac-proxy
            exec /usr/bin/kube-rbac-proxy \
              --logtostderr \
              --secure-listen-address=:9101 \
              --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 \
              --upstream=http://127.0.0.1:29101/ \
              --tls-private-key-file=${TLS_PK} \
              --tls-cert-file=${TLS_CERT}
          image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:533973e0b3b8e64b0fd672a78ebabc5accc5f9a969c6a610ce14aa73d9685874
          imagePullPolicy: IfNotPresent
          name: kube-rbac-proxy
          ports:
          - containerPort: 9101
            hostPort: 9101
            name: https
            protocol: TCP
          resources:
            requests:
              cpu: 10m
              memory: 20Mi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
          - mountPath: /etc/pki/tls/metrics-certs
            name: sdn-metrics-certs
            readOnly: true
        dnsPolicy: ClusterFirst
        hostNetwork: true
        hostPID: true
        nodeSelector:
          kubernetes.io/os: linux
        priorityClassName: system-node-critical
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        serviceAccount: sdn
        serviceAccountName: sdn
        terminationGracePeriodSeconds: 30
        tolerations:
        - operator: Exists
        volumes:
        - configMap:
            defaultMode: 420
            name: sdn-config
          name: config
        - configMap:
            defaultMode: 420
            name: env-overrides
            optional: true
          name: env-overrides
        - hostPath:
            path: /etc/sysconfig
            type: ""
          name: etc-sysconfig
        - hostPath:
            path: /lib/modules
            type: ""
          name: host-modules
        - hostPath:
            path: /var/run
            type: ""
          name: host-var-run
        - hostPath:
            path: /run/netns
            type: ""
          name: host-run-netns
        - hostPath:
            path: /var/run/netns
            type: ""
          name: host-var-run-netns
        - hostPath:
            path: /var/run/dbus
            type: ""
          name: host-var-run-dbus
        - hostPath:
            path: /var/run/openvswitch
            type: ""
          name: host-var-run-ovs
        - hostPath:
            path: /var/run/kubernetes
            type: ""
          name: host-var-run-kubernetes
        - hostPath:
            path: /var/run/openshift-sdn
            type: ""
          name: host-var-run-openshift-sdn
        - hostPath:
            path: /
            type: ""
          name: host-slash
        - hostPath:
            path: /var/lib/cni/bin
            type: ""
          name: host-cni-bin
        - hostPath:
            path: /var/run/multus/cni/net.d
            type: ""
          name: host-cni-conf
        - hostPath:
            path: /var/lib/cni/networks/openshift-sdn
            type: ""
          name: host-var-lib-cni-networks-openshift-sdn
        - name: sdn-metrics-certs
          secret:
            defaultMode: 420
            optional: true
            secretName: sdn-metrics-certs
    updateStrategy:
      rollingUpdate:
        maxUnavailable: 1
      type: RollingUpdate
  status:
    currentNumberScheduled: 6
    desiredNumberScheduled: 6
    numberAvailable: 6
    numberMisscheduled: 0
    numberReady: 6
    observedGeneration: 1
    updatedNumberScheduled: 6
- apiVersion: apps/v1
  kind: DaemonSet
  metadata:
    annotations:
      deprecated.daemonset.template.generation: "1"
      kubernetes.io/description: |
        This deployment runs the openshift SDN networking controller.
      release.openshift.io/version: 4.6.52
    creationTimestamp: "2022-03-08T10:38:10Z"
    generation: 1
    labels:
      app: sdn-controller
    managedFields:
    - apiVersion: apps/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:deprecated.daemonset.template.generation: {}
            f:kubernetes.io/description: {}
            f:release.openshift.io/version: {}
          f:labels:
            .: {}
            f:app: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"b48e3238-e625-4cc0-acf5-5166b34864a9"}:
              .: {}
              f:apiVersion: {}
              f:blockOwnerDeletion: {}
              f:controller: {}
              f:kind: {}
              f:name: {}
              f:uid: {}
        f:spec:
          f:revisionHistoryLimit: {}
          f:selector:
            f:matchLabels:
              .: {}
              f:app: {}
          f:template:
            f:metadata:
              f:labels:
                .: {}
                f:app: {}
            f:spec:
              f:containers:
                k:{"name":"sdn-controller"}:
                  .: {}
                  f:command: {}
                  f:env:
                    .: {}
                    k:{"name":"KUBERNETES_SERVICE_HOST"}:
                      .: {}
                      f:name: {}
                      f:value: {}
                    k:{"name":"KUBERNETES_SERVICE_PORT"}:
                      .: {}
                      f:name: {}
                      f:value: {}
                  f:image: {}
                  f:imagePullPolicy: {}
                  f:name: {}
                  f:resources:
                    .: {}
                    f:requests:
                      .: {}
                      f:cpu: {}
                      f:memory: {}
                  f:terminationMessagePath: {}
                  f:terminationMessagePolicy: {}
                  f:volumeMounts:
                    .: {}
                    k:{"mountPath":"/env"}:
                      .: {}
                      f:mountPath: {}
                      f:name: {}
              f:dnsPolicy: {}
              f:hostNetwork: {}
              f:nodeSelector:
                .: {}
                f:node-role.kubernetes.io/master: {}
              f:priorityClassName: {}
              f:restartPolicy: {}
              f:schedulerName: {}
              f:securityContext:
                .: {}
                f:runAsNonRoot: {}
                f:runAsUser: {}
              f:serviceAccount: {}
              f:serviceAccountName: {}
              f:terminationGracePeriodSeconds: {}
              f:tolerations: {}
              f:volumes:
                .: {}
                k:{"name":"env-overrides"}:
                  .: {}
                  f:configMap:
                    .: {}
                    f:defaultMode: {}
                    f:name: {}
                    f:optional: {}
                  f:name: {}
          f:updateStrategy:
            f:rollingUpdate:
              .: {}
              f:maxUnavailable: {}
            f:type: {}
        f:status:
          f:currentNumberScheduled: {}
          f:desiredNumberScheduled: {}
          f:numberReady: {}
      manager: cluster-network-operator
      operation: Update
      time: "2022-03-08T10:44:10Z"
    name: sdn-controller
    namespace: openshift-sdn
    ownerReferences:
    - apiVersion: operator.openshift.io/v1
      blockOwnerDeletion: true
      controller: true
      kind: Network
      name: cluster
      uid: b48e3238-e625-4cc0-acf5-5166b34864a9
    resourceVersion: "16394"
    selfLink: /apis/apps/v1/namespaces/openshift-sdn/daemonsets/sdn-controller
    uid: 9d97d59e-f663-4f94-bc48-f162e440e448
  spec:
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: sdn-controller
    template:
      metadata:
        creationTimestamp: null
        labels:
          app: sdn-controller
      spec:
        containers:
        - command:
          - /bin/bash
          - -c
          - |
            if [[ -f /env/_master ]]; then
              set -o allexport
              source /env/_master
              set +o allexport
            fi

            exec openshift-sdn-controller --v=${OPENSHIFT_SDN_LOG_LEVEL:-2}
          env:
          - name: KUBERNETES_SERVICE_PORT
            value: "6443"
          - name: KUBERNETES_SERVICE_HOST
            value: api-int.case03116926.lab.upshift.rdu2.redhat.com
          image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:980d20b31cdcd9db0a94e393b53799985ea399bbe8dbd552bf2e27e32cf0be7e
          imagePullPolicy: IfNotPresent
          name: sdn-controller
          resources:
            requests:
              cpu: 10m
              memory: 50Mi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: FallbackToLogsOnError
          volumeMounts:
          - mountPath: /env
            name: env-overrides
        dnsPolicy: ClusterFirst
        hostNetwork: true
        nodeSelector:
          node-role.kubernetes.io/master: ""
        priorityClassName: system-cluster-critical
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext:
          runAsNonRoot: true
          runAsUser: 65534
        serviceAccount: sdn-controller
        serviceAccountName: sdn-controller
        terminationGracePeriodSeconds: 30
        tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists
        - effect: NoSchedule
          key: node.kubernetes.io/not-ready
          operator: Exists
        volumes:
        - configMap:
            defaultMode: 420
            name: env-overrides
            optional: true
          name: env-overrides
    updateStrategy:
      rollingUpdate:
        maxUnavailable: 1
      type: RollingUpdate
  status:
    currentNumberScheduled: 3
    desiredNumberScheduled: 3
    numberAvailable: 3
    numberMisscheduled: 0
    numberReady: 3
    observedGeneration: 1
    updatedNumberScheduled: 3
kind: DaemonSetList
metadata:
  resourceVersion: "83121"
  selfLink: /apis/apps/v1/namespaces/openshift-sdn/daemonsets
