{{- $admin := .Values -}}
{{- $zoo := .Values.zookeeper }}
{{- $nacos := .Values.nacos }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: admin
  namespace: {{ .Release.Namespace }}
  labels:
    app: admin
    dubbo.io/rev: {{ default "default" | quote }}
    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
    operator.dubbo.io/component: "Admin"
    dubbo: admin
    release: {{ .Release.Name }}
    app.kubernetes.io/name: "dashboard"
spec:
  replicas: {{ $admin.replicas }}
  selector:
    matchLabels:
      app: admin
      dubbo.io/rev: {{ default "default" | quote }}
      dubbo: admin
  template:
    metadata:
      labels:
        app: admin
        dubbo.io/rev: {{ default "default" | quote }}
        install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
        operator.dubbo.io/component: "Admin"
        dubbo: admin
        release: {{ .Release.Name }}
        app.kubernetes.io/name: "dashboard"
    spec:
      serviceAccountName: admin-sa
      containers:
      - name: admin
        image: "{{ $admin.image }}:{{ $admin.tag }}"
        imagePullPolicy: IfNotPresent
        args:
        - --config-file=/var/lib/admin/dubbo-cp.yaml
        ports:
        - name: http
          containerPort: 8888
        volumeMounts:
          - name: data
            mountPath: /var/lib/admin
          - name: config
            mountPath: /var/lib/admin/dubbo-cp.yaml
            subPath: dubbo-cp.yaml
        resources:
{{ toYaml $admin.resources | trim | indent 10 }}
      volumes:
      - name: data
        emptyDir: {}
      - name: config
        configMap:
          name: admin-config
          defaultMode: 0755