apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: ipvs-elector
  name: ipvs-elector
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: ipvs-elector
  template:
    metadata:
      labels:
        k8s-app: ipvs-elector
    spec:
      serviceAccount: ipvs-elector
      serviceAccountName: ipvs-elector
      priorityClassName: system-node-critical
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: In
                values:
                - ''
      tolerations:
      - key: CriticalAddonsOnly
        operator: Exists
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
      hostNetwork: true
      containers:
      - name: ipvs-elector
        image: inwinstack/ipvs-elector:v0.2.0
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        args:
        - --logtostderr 
        - -v=2
        securityContext:
          privileged: true
