---
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: ceph
  name: ceph-admin
  namespace: ceph
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ceph
      daemon: admin
  template:
    metadata:
      name: ceph-admin
      namespace: ceph
      labels:
        app: ceph
        daemon: admin
    spec:
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      serviceAccount: default
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
        - key: node-role.kubernetes.io/master
          operator: Exists
      volumes:
        - name: ceph-conf
          secret:
            secretName: ceph-conf-combined
        - name: ceph-client-key
          secret:
            secretName: ceph-client-key
        - name: ceph-bootstrap-osd-keyring
          secret:
            secretName: ceph-bootstrap-osd-keyring
        - name: ceph-bootstrap-mds-keyring
          secret:
            secretName: ceph-bootstrap-mds-keyring
        - name: ceph-bootstrap-rgw-keyring
          secret:
            secretName: ceph-bootstrap-rgw-keyring
        - name: ceph-bootstrap-rbd-keyring
          secret:
            secretName: ceph-bootstrap-rbd-keyring
      containers:
        - name: ceph-admin
          image: uubk/ceph-admin:latest
          imagePullPolicy: Always
          env:
            - name: KV_TYPE
              value: k8s
            - name: NETWORK_AUTO_DETECT
              value: "0"
            - name: CLUSTER
              value: ceph
            - name: CEPH_PUBLIC_NETWORK
              value: 10.156.0.0/14
            - name: MON_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          volumeMounts:
            - name: ceph-conf
              mountPath: /etc/ceph
            - name: ceph-bootstrap-osd-keyring
              mountPath: /var/lib/ceph/bootstrap-osd
            - name: ceph-client-key
              mountPath: /etc/ceph-client
            - name: ceph-bootstrap-mds-keyring
              mountPath: /var/lib/ceph/bootstrap-mds
            - name: ceph-bootstrap-rgw-keyring
              mountPath: /var/lib/ceph/bootstrap-rgw
            - name: ceph-bootstrap-rbd-keyring
              mountPath: /var/lib/ceph/bootstrap-rbd
          resources:
            requests:
              memory: "384Mi"
              cpu: "100m"
            limits:
              memory: "512Mi"
              cpu: "500m"
