# apiVersion: v1
# kind: Namespace
# metadata:
#   labels:
#     control-plane: core
#   name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rbac
  namespace: system
  labels:
    control-plane: rbac
spec:
  selector:
    matchLabels:
      control-plane: rbac
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: rbac
    spec:
      securityContext:
        runAsNonRoot: true
      containers:
      - command:
        - /rbac
        args:
        - start
        - --health-probe-bind-address=:8081
        - --metrics-bind-address=127.0.0.1:8080
        - --leader-elect
        #- --debug
        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
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        image: yndd/nddrbac:latest
        #imagePullPolicy: Always
        name: rbac
        securityContext:
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: true
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        resources:
          limits:
            cpu: 1000m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 20Mi
      serviceAccountName: rbac
      terminationGracePeriodSeconds: 10
      
