---
apiVersion: v1
kind: ConfigMap
metadata:
  name: helm-nacos-cm
  namespace: 修改命名空间
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    octopus.control: nacos-wdd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "6.2"
data:
  mysql.db.name: "cmii_nacos_config"
  mysql.db.host: "helm-mysql"
  mysql.port: "3306"
  mysql.user: "按照实际的填写"
  mysql.password: "按照实际的填写"
---
apiVersion: v1
kind: Service
metadata:
  name: helm-nacos
  namespace: 修改命名空间
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    octopus.control: nacos-wdd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "6.2"
spec:
  type: NodePort
  selector:
    cmii.app: helm-nacos
    cmii.type: middleware
  ports:
    - port: 8848
      name: server
      targetPort: 8848
      nodePort: 38848
    - port: 9848
      name: server12
      targetPort: 9848
    - port: 9849
      name: server23
      targetPort: 9849
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: helm-nacos
  namespace: 修改命名空间
  labels:
    cmii.app: helm-nacos
    cmii.type: middleware
    octopus.control: nacos-wdd
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: "6.2"
spec:
  serviceName: helm-nacos
  replicas: 1
  selector:
    matchLabels:
      cmii.app: helm-nacos
      cmii.type: middleware
  template:
    metadata:
      labels:
        cmii.app: helm-nacos
        cmii.type: middleware
        octopus.control: nacos-wdd
        app.kubernetes.io/managed-by: octopus
        app.kubernetes.io/version: "6.2"
      annotations:
        pod.alpha.kubernetes.io/initialized: "true"
    spec:
      imagePullSecrets:
        - name: harborsecret
      affinity: {}
      containers:
        - name: nacos-server
          image: 修改Harbor地址/cmii/nacos-server:v2.1.2
          ports:
            - containerPort: 8848
              name: dashboard
            - containerPort: 9848
              name: tcp-9848
            - containerPort: 9849
              name: tcp-9849
          env:
            - name: NACOS_AUTH_ENABLE
              value: "false"
            - name: NACOS_REPLICAS
              value: "1"
            - name: MYSQL_SERVICE_DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.db.name
            - name: MYSQL_SERVICE_PORT
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.port
            - name: MYSQL_SERVICE_USER
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.user
            - name: MYSQL_SERVICE_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.password
            - name: MYSQL_SERVICE_HOST
              valueFrom:
                configMapKeyRef:
                  name: helm-nacos-cm
                  key: mysql.db.host
            - name: NACOS_SERVER_PORT
              value: "8848"
            - name: NACOS_APPLICATION_PORT
              value: "8848"
            - name: PREFER_HOST_MODE
              value: "hostname"
            - name: MODE
              value: standalone
            - name: SPRING_DATASOURCE_PLATFORM
              value: mysql
---
