---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cmii-updater
  namespace: kube-system
  labels:
    cmii.type: backend
    cmii.app: cmii-updater
    octopus/control: backend-app-1.0.0
    app.kubernetes.io/managed-by: octopus
    app.kubernetes.io/app-version: 6.2.0
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
      cmii.type: backend
      cmii.app: cmii-updater
  template:
    metadata:
      labels:
        cmii.type: backend
        cmii.app: cmii-updater
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: node-role.kubernetes.io/controlplane
                    operator: In
                    values:
                      - 'true'
      imagePullSecrets:
        - name: harborsecret
      tolerations:
        - key: "node.kubernetes.io/unschedulable"
          operator: "Exists"
          effect: "NoSchedule"
      containers:
        - name: cmii-updater
          image: harbor.cdcyy.com.cn/cmii/cmii-updater:2025-04-21
          imagePullPolicy: Always
          env:
            - name: K8S_NAMESPACE
              value: kube-system
            - name: APPLICATION_NAME
              value: cmii-updater
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: IMAGE_NAME
              value: harbor.cdcyy.com.cn/cmii/cmii-updater-agent:test-2025-04-11-09-52-41
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: NODE_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
            - name: LIMIT_CPU
              valueFrom:
                resourceFieldRef:
                  containerName: cmii-updater
                  resource: limits.cpu
            - name: LIMIT_MEMORY
              valueFrom:
                resourceFieldRef:
                  containerName: cmii-updater
                  resource: limits.memory
            - name: REQUEST_CPU
              valueFrom:
                resourceFieldRef:
                  containerName: cmii-updater
                  resource: requests.cpu
            - name: REQUEST_MEMORY
              valueFrom:
                resourceFieldRef:
                  containerName: cmii-updater
                  resource: requests.memory
          ports:
            - name: pod-port
              containerPort: 8080
              protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: cmii-updater
  namespace: kube-system
  labels:
    cmii.type: backend
    cmii.app: cmii-updater
    octopus/control: backend-app-1.0.0
    app.kubernetes.io/managed-by: octopus
    app.kubernetes.io/app-version: 6.2.0
spec:
  type: NodePort
  selector:
    cmii.type: backend
    cmii.app: cmii-updater
  ports:
    - name: backend-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
      nodePort: 32333
---