apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    component: update-sp
  name: update-sp
  namespace: kube-system
spec:
  selector:
    matchLabels:
      component: update-sp
      tier: node
  template:
    metadata:
      labels:
        component: update-sp
        tier: node
    spec:
      containers:
      - command:
        - nsenter
        - --target
        - "1"
        - --mount
        - --uts
        - --ipc
        - --net
        - --pid
        - --
        - sh
        - -c
        - |
          spid=`cat /etc/kubernetes/azure.json |grep aadClientId |cut -d'"' -f 4`
          spsecret=`cat /etc/kubernetes/azure.json |grep aadClientSecret |cut -d'"' -f 4`
          sed -i "s/$spid/new-aadClientID/g" /etc/kubernetes/azure.json
          sed -i "s/$spsecret/new-aadClientSecret/g" /etc/kubernetes/azure.json
          systemctl restart kubelet
          sleep 600000000s
        image: alpine
        imagePullPolicy: IfNotPresent
        name: update-sp
        resources:
          requests:
            cpu: 10m
        securityContext:
          privileged: true
      dnsPolicy: ClusterFirst
      hostPID: true
      tolerations:
      - effect: NoSchedule
        operator: Exists
      restartPolicy: Always
  updateStrategy:
    type: OnDelete
