---
kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: octopus-nacos
  namespace: default
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
    app.name: octopus-nacos
    helm.sh/chart: nacos-0.1.0
  annotations:
    meta.helm.sh/release-name: octopus-nacos
    meta.helm.sh/release-namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app.name: octopus-nacos
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/version: 1.0.0
        app.name: octopus-nacos
        helm.sh/chart: nacos-0.1.0
      annotations:
        pod.alpha.kubernetes.io/initialized: 'true'
    spec:
      containers:
        - name: nacos
          image: 'nacos/nacos-server:2.0.1'
          ports:
            - name: client
              containerPort: 8848
              protocol: TCP
          env:
            - name: NACOS_REPLICAS
              value: '1'
            - name: MYSQL_SERVICE_DB_NAME
              valueFrom:
                configMapKeyRef:
                  name: octopus-nacos-cm
                  key: mysql.db.name
            - name: MYSQL_SERVICE_PORT
              valueFrom:
                configMapKeyRef:
                  name: octopus-nacos-cm
                  key: mysql.port
            - name: MYSQL_SERVICE_USER
              valueFrom:
                configMapKeyRef:
                  name: octopus-nacos-cm
                  key: mysql.user
            - name: MYSQL_SERVICE_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: octopus-nacos-cm
                  key: mysql.password
            - name: MYSQL_SERVICE_HOST
              valueFrom:
                configMapKeyRef:
                  name: octopus-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
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - node-tokyo-2
      schedulerName: default-scheduler
  serviceName: octopus-nacos
  podManagementPolicy: OrderedReady
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      partition: 0
  revisionHistoryLimit: 10
---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: octopus-nacos
  namespace: default
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
    app.name: octopus-nacos
    helm.sh/chart: nacos-0.1.0
  annotations:
    meta.helm.sh/release-name: octopus-nacos
    meta.helm.sh/release-namespace: default
    cert-manager.io/cluster-issuer: cm-cloudflare-7421
spec:
  ingressClassName: traefik
  rules:
    - host: nacos.107421.xyz
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: octopus-nacos
                port:
                  number: 8848
  tls:
    - hosts:
      - nacos.107421.xyz
      secretName: nacos.107421.xyz-tls
---
kind: Service
apiVersion: v1
metadata:
  name: octopus-nacos
  namespace: default
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
    app.name: octopus-nacos
    helm.sh/chart: nacos-0.1.0
  annotations:
    meta.helm.sh/release-name: octopus-nacos
    meta.helm.sh/release-namespace: default
spec:
  ports:
    - name: server
      protocol: TCP
      port: 8848
      targetPort: 8848
      nodePort: 21060
  selector:
    app.name: octopus-nacos
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: octopus-nacos-cm
  namespace: default
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 1.0.0
    app.name: octopus-nacos
    
    helm.sh/chart: nacos-0.1.0
  annotations:
    meta.helm.sh/release-name: octopus-nacos
    meta.helm.sh/release-namespace: default
data:
  mysql.db.host: octopus-mysql
  mysql.db.name: nacos_config
  mysql.password: boge14@Level5
  mysql.port: '3306'
  mysql.user: root
