This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git
The following commit(s) were added to refs/heads/refactor-with-go by this push:
new d6d2c872 Fix and optimize nacos (#1096)
d6d2c872 is described below
commit d6d2c87292cf3e227a64ed3e9d4f0be4d9d0cd43
Author: mfordjody <[email protected]>
AuthorDate: Tue May 2 21:52:21 2023 +0800
Fix and optimize nacos (#1096)
Fixing bugs
Restore readme
Restore readme
---
deploy/charts/nacos/templates/NOTES.txt | 0
deploy/charts/nacos/templates/_charts.tpl | 20 +++++++---
deploy/charts/nacos/templates/configmap.yaml | 2 -
.../templates/{configmap.yaml => extra-list.yaml} | 22 ++---------
deploy/charts/nacos/templates/statefulset.yaml | 19 ++++------
deploy/charts/nacos/templates/svc-headless.yaml | 2 -
deploy/charts/nacos/templates/svc.yaml | 2 -
deploy/charts/nacos/values.yaml | 44 ++++++++++++----------
8 files changed, 51 insertions(+), 60 deletions(-)
diff --git a/deploy/charts/nacos/templates/NOTES.txt
b/deploy/charts/nacos/templates/NOTES.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/deploy/charts/nacos/templates/_charts.tpl
b/deploy/charts/nacos/templates/_charts.tpl
index d520feb7..5d66edaf 100644
--- a/deploy/charts/nacos/templates/_charts.tpl
+++ b/deploy/charts/nacos/templates/_charts.tpl
@@ -1,4 +1,3 @@
-
{{/*
Create chart name and version as used by the chart label.
*/}}
@@ -6,7 +5,6 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 |
trimSuffix "-" -}}
{{- end -}}
-
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
@@ -33,7 +31,6 @@ If release name contains chart name it will be used as a full
name.
{{- end -}}
{{- end -}}
-
{{/*
Nacos Namespace to use
*/}}
@@ -52,7 +49,6 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
-
{{/*
Labels to use on sts.spec.selector.matchLabels and svc.spec.selector
*/}}
@@ -98,4 +94,18 @@ Return the target Kubernetes version
{{- end -}}
{{/*
Return the appropriate apiVersion for statefulset.
-*/}}
\ No newline at end of file
+*/}}
+
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Renders a value that contains template.
+Usage:
+{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value
"context" $) }}
+*/}}
+{{- define "tplvalues.render" -}}
+ {{- if typeIs "string" .value }}
+ {{- tpl .value .context }}
+ {{- else }}
+ {{- tpl (.value | toYaml) .context }}
+ {{- end }}
+{{- end -}}
\ No newline at end of file
diff --git a/deploy/charts/nacos/templates/configmap.yaml
b/deploy/charts/nacos/templates/configmap.yaml
index d8fac9a2..a058194c 100644
--- a/deploy/charts/nacos/templates/configmap.yaml
+++ b/deploy/charts/nacos/templates/configmap.yaml
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- if .Values.enabled }}
{{- if eq .Values.storage.type "mysql"}}
apiVersion: v1
kind: ConfigMap
@@ -30,4 +29,3 @@ data:
mysql.param: {{ .param | default
"characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false"
}}
{{- end }}
{{- end }}
- {{- end }}
\ No newline at end of file
diff --git a/deploy/charts/nacos/templates/configmap.yaml
b/deploy/charts/nacos/templates/extra-list.yaml
similarity index 57%
copy from deploy/charts/nacos/templates/configmap.yaml
copy to deploy/charts/nacos/templates/extra-list.yaml
index d8fac9a2..7535c308 100644
--- a/deploy/charts/nacos/templates/configmap.yaml
+++ b/deploy/charts/nacos/templates/extra-list.yaml
@@ -13,21 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- if .Values.enabled }}
-{{- if eq .Values.storage.type "mysql"}}
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: {{ template "nacos.fullname" . }}-configmap
- namespace: {{ template "nacos.namespace" . }}
-data:
- {{- with .Values.storage.db }}
- mysql.db.host: {{ .host }}
- mysql.db.name: {{ .name }}
- mysql.port: "{{ .port | default 3306 }}"
- mysql.user: {{ .username }}
- mysql.password: {{ .password }}
- mysql.param: {{ .param | default
"characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false"
}}
- {{- end }}
- {{- end }}
- {{- end }}
\ No newline at end of file
+{{- range .Values.extraDeploy }}
+---
+{{ include "tplvalues.render" (dict "value" . "context" $) }}
+{{- end }}
diff --git a/deploy/charts/nacos/templates/statefulset.yaml
b/deploy/charts/nacos/templates/statefulset.yaml
index 60db1ade..53625ad3 100644
--- a/deploy/charts/nacos/templates/statefulset.yaml
+++ b/deploy/charts/nacos/templates/statefulset.yaml
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- if .Values.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
@@ -97,10 +96,9 @@ spec:
{{- if eq .Values.global.mode "standalone" }}
- name: MODE
value: "standalone"
-
{{- else if eq .Values.global.mode "cluster" }}
- name: SERVICE_NAME
- value: "nacos-hs"
+ value: "nacos-headless"
- name: DOMAIN_NAME
value: {{ .Values.domainName | quote }}
- name: POD_NAMESPACE
@@ -115,32 +113,32 @@ spec:
- name: MYSQL_SERVICE_HOST
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.db.host
- name: MYSQL_SERVICE_DB_NAME
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.db.name
- name: MYSQL_SERVICE_PORT
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.port
- name: MYSQL_SERVICE_USER
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.user
- name: MYSQL_SERVICE_PASSWORD
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.password
- name: MYSQL_SERVICE_DB_PARAM
valueFrom:
configMapKeyRef:
- name: nacos-cm
+ name: nacos-configmap
key: mysql.param
{{- else }}
- name: EMBEDDED_STORAGE
@@ -156,7 +154,7 @@ spec:
- name: data
mountPath: /home/nacos/logs
subPath: logs
- {{- if not .Values.persistence.enabled }}
+ {{- if not .Values.persistence.enabled }}
volumes:
- name: data
emptyDir: {}
@@ -179,4 +177,3 @@ spec:
emptyDir: {{ .Values.persistence.emptyDir }}
{{- end }}
{{- end }}
- {{- end }}
\ No newline at end of file
diff --git a/deploy/charts/nacos/templates/svc-headless.yaml
b/deploy/charts/nacos/templates/svc-headless.yaml
index 86980a77..4f38db4c 100644
--- a/deploy/charts/nacos/templates/svc-headless.yaml
+++ b/deploy/charts/nacos/templates/svc-headless.yaml
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- if .Values.enabled }}
{{- if and (eq .Values.global.mode "cluster") }}
apiVersion: v1
kind: Service
@@ -40,4 +39,3 @@ spec:
protocol: TCP
selector: {{- include "nacos.matchLabels" . | nindent 4 }}
{{- end }}
- {{- end }}
\ No newline at end of file
diff --git a/deploy/charts/nacos/templates/svc.yaml
b/deploy/charts/nacos/templates/svc.yaml
index d1fb26f7..a939daaf 100644
--- a/deploy/charts/nacos/templates/svc.yaml
+++ b/deploy/charts/nacos/templates/svc.yaml
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- if .Values.enabled }}
apiVersion: v1
kind: Service
metadata:
@@ -41,4 +40,3 @@ spec:
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector: {{- include "nacos.matchLabels" . | nindent 4 }}
- {{- end }}
\ No newline at end of file
diff --git a/deploy/charts/nacos/values.yaml b/deploy/charts/nacos/values.yaml
index 45131498..f0437d32 100644
--- a/deploy/charts/nacos/values.yaml
+++ b/deploy/charts/nacos/values.yaml
@@ -17,40 +17,48 @@ global:
mode: standalone
# mode: cluster
-
image:
registry: docker.io
- ## e.g registry.k8s.io
+ # e.g registry.k8s.io
repository: nacos/nacos-server
tag: latest
pullPolicy: IfNotPresent
-
plugin:
enable: true
+ # true or false
image:
repository: nacos/nacos-peer-finder-plugin
tag: 1.1
pullPolicy: IfNotPresent
-
replicas: 1
-
domainName: cluster.local
+extraDeploy: []
-storage:
- type: ""
-# type: mysql
-# db:
-# host: localhost
-# name: nacos
-# port: 3306
-# username: usernmae
-# password: password
-# param:
characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
+nodeSelector: []
+
+affinity: []
+
+tolerations: []
+maxUnavailable: []
+
+resources:
+ limits: {}
+ requests: {}
+
+storage:
+ type: ~
+ # db:
+ # host: localhost
+ # name: nacos
+ # port: 3306
+ # username: usernmae
+ # password: password
+ # param:
characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
service:
name: http
@@ -85,18 +93,16 @@ service:
##
## Service externalIPs.
-
persistence:
enabled: false
accessModes:
- ReadWriteOnce
storageClassName: ""
size: 5Gi
- claimName: ""
+ ClaimName: {}
## persistence emptyDir
emptyDir: {}
-
## See `kubectl explain poddisruptionbudget.spec` for more
## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
@@ -104,7 +110,6 @@ podDisruptionBudget:
minAvailable: 1
# maxUnavailable: 1
-
ingress:
enabled: false
# For Kubernetes >= 1.18 you should specify the ingress-controller via the
field ingressClassName
@@ -145,7 +150,6 @@ ingress:
# hosts:
# - chart-example.local
-
networkPolicy:
## @param networkPolicy.enabled Enable creation of NetworkPolicy resources.
Only Ingress traffic is filtered for now.
##