# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ .Values.nacos.name }} annotations: {{- toYaml .Values.nacos.annotations | indent 4 }} spec: serviceName: nacos replicas: {{ .Values.nacos.replicaCount }} selector: matchLabels: app.kubernetes.io/name: {{ .Values.nacos.name }} app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: app.kubernetes.io/name: {{ .Values.nacos.name }} app.kubernetes.io/instance: {{ .Release.Name }} spec: {{- with .Values.nacos.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nacos.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nacos.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if and (eq .Values.global.mode "cluster") (.Values.nacosplugin.enabled) }} initContainers: - name: peer-finder-plugin-install image: {{.Values.nacosplugin.image.repository}}:{{.Values.nacosplugin.image.tag}} imagePullPolicy: {{ .Values.nacosplugin.image.pullPolicy }} volumeMounts: - mountPath: /home/nacos/plugins/peer-finder name: data subPath: peer-finder {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.nacos.image.repository }}:{{ .Values.nacos.image.tag }}" imagePullPolicy: {{ .Values.nacos.image.pullPolicy }} startupProbe: initialDelaySeconds: 240 periodSeconds: 5 timeoutSeconds: 10 httpGet: scheme: HTTP port: {{ .Values.nacos.serverPort }} path: /nacos/v1/console/health/readiness livenessProbe: initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 10 httpGet: scheme: HTTP port: {{ .Values.nacos.serverPort }} path: /nacos/v1/console/health/liveness ports: - name: http containerPort: {{ .Values.nacos.serverPort }} protocol: TCP - containerPort: {{ add .Values.nacos.serverPort 1000}} name: client-rpc - containerPort: {{ add .Values.nacos.serverPort 1001 }} name: raft-rpc - containerPort: 7848 name: old-raft-rpc resources: {{- toYaml .Values.nacos.resources | nindent 12 }} env: - name: NACOS_SERVER_PORT value: {{ .Values.nacos.serverPort | quote }} - name: NACOS_APPLICATION_PORT value: {{ .Values.nacos.serverPort | quote }} - name: PREFER_HOST_MODE value: {{ .Values.nacos.preferhostmode | quote }} {{- if eq .Values.global.mode "standalone" }} - name: MODE value: "standalone" {{- else if eq .Values.global.mode "cluster" }} - name: SERVICE_NAME value: "nacos" - name: DOMAIN_NAME value: {{ .Values.global.domainName | quote }} - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace {{- end }} {{- if or (eq .Values.storage.type "mysql") (eq .Values.storage.type "rds") }} - name: SPRING_DATASOURCE_PLATFORM value: "mysql" - name: MYSQL_SERVICE_HOST valueFrom: configMapKeyRef: name: nacos-cm key: mysql.db.host - name: MYSQL_SERVICE_DB_NAME valueFrom: configMapKeyRef: name: nacos-cm key: mysql.db.name - name: MYSQL_SERVICE_PORT valueFrom: configMapKeyRef: name: nacos-cm key: mysql.port - name: MYSQL_SERVICE_USER valueFrom: configMapKeyRef: name: nacos-cm key: mysql.user - name: MYSQL_SERVICE_PASSWORD valueFrom: configMapKeyRef: name: nacos-cm key: mysql.password - name: MYSQL_SERVICE_DB_PARAM valueFrom: configMapKeyRef: name: nacos-cm key: mysql.param {{else}} - name: EMBEDDED_STORAGE value: embedded {{end}} volumeMounts: - name: data mountPath: /home/nacos/plugins/peer-finder subPath: peer-finder - name: data mountPath: /home/nacos/data subPath: data - name: data mountPath: /home/nacos/logs subPath: logs {{- if not .Values.persistence.enabled }} volumes: - name: data emptyDir: { } {{- end }} {{- if .Values.persistence.enabled }} volumeClaimTemplates: - metadata: name: data spec: {{- toYaml .Values.persistence.data | nindent 8 }} {{- end }}