From 8ccee52372820c3d88f51931d0c4e26070d18bd2 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 14 Jun 2023 16:48:14 +0800 Subject: [PATCH 01/19] add helm --- cicd/helm/.helmignore | 22 ++++ cicd/helm/Chart.yaml | 9 ++ cicd/helm/README.md | 137 ++++++++++++++++++++++ cicd/helm/templates/NOTES.txt | 25 ++++ cicd/helm/templates/_helpers.tpl | 45 ++++++++ cicd/helm/templates/configmap.yaml | 19 +++ cicd/helm/templates/ingress.yaml | 54 +++++++++ cicd/helm/templates/mysql.yaml | 55 +++++++++ cicd/helm/templates/service.yaml | 63 ++++++++++ cicd/helm/templates/statefulset.yaml | 165 +++++++++++++++++++++++++++ cicd/helm/values.yaml | 98 ++++++++++++++++ 11 files changed, 692 insertions(+) create mode 100644 cicd/helm/.helmignore create mode 100644 cicd/helm/Chart.yaml create mode 100644 cicd/helm/README.md create mode 100644 cicd/helm/templates/NOTES.txt create mode 100644 cicd/helm/templates/_helpers.tpl create mode 100644 cicd/helm/templates/configmap.yaml create mode 100644 cicd/helm/templates/ingress.yaml create mode 100644 cicd/helm/templates/mysql.yaml create mode 100644 cicd/helm/templates/service.yaml create mode 100644 cicd/helm/templates/statefulset.yaml create mode 100644 cicd/helm/values.yaml diff --git a/cicd/helm/.helmignore b/cicd/helm/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/cicd/helm/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/cicd/helm/Chart.yaml b/cicd/helm/Chart.yaml new file mode 100644 index 0000000..4e270eb --- /dev/null +++ b/cicd/helm/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: nacos +version: 0.1.5 +maintainers: + - name: arrowfeng + - name: paderlol + diff --git a/cicd/helm/README.md b/cicd/helm/README.md new file mode 100644 index 0000000..b917371 --- /dev/null +++ b/cicd/helm/README.md @@ -0,0 +1,137 @@ +# Nacos Helm Chart + +Nacos is committed to help you discover, configure, and manage your microservices. It provides a set of simple and useful features enabling you to realize dynamic service discovery, service configuration, service metadata and traffic management. + +## Introduction + +This project is based on the Helm Chart packaged by [nacos-k8s](https://github.com/nacos-group/nacos-k8s/). + +## Prerequisites + + - Kubernetes 1.10+ + - Helm v3 + - PV provisioner support in the underlying infrastructure + +## Tips +If you use a custom database, please initialize the database script yourself first. + + + +## Installing the Chart + +To install the chart with `release name`: + +```shell +$ helm install `release name` ./nacos +``` + +The command deploys Nacos on the Kubernetes cluster in the default configuration. It will run without a mysql chart and persistent volume. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +### Service & Configuration Management + +#### Service registration +```shell +curl -X POST 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080' +``` + +#### Service discovery +```shell +curl -X GET 'http://$NODE_IP:$NODE_PORT/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName' +``` +#### Publish config +```shell +curl -X POST "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld" +``` +#### Get config +```shell +curl -X GET "http://$NODE_IP:$NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test" +``` + + + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete `release name`: + +```shell +$ helm uninstall `release name` +``` +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the Skywalking chart and their default values. + +| Parameter | Description | Default | +|---------------------------------------|--------------------------------------------------------------------|-------------------------------------| +| `global.mode` | Run Mode (~~quickstart,~~ standalone, cluster; ) | `standalone` | +| `resources` | The [resources] to allocate for nacos container | `{}` | +| `nodeSelector` | Nacos labels for pod assignment | `{}` | +| `affinity` | Nacos affinity policy | `{}` | +| `tolerations` | Nacos tolerations | `{}` | +| `resources.requests.cpu`|nacos requests cpu resource|`500m`| +| `resources.requests.memory`|nacos requests memory resource|`2G`| +| `nacos.replicaCount` | Number of desired nacos pods, the number should be 1 as run standalone mode| `1` | +| `nacos.image.repository` | Nacos container image name | `nacos/nacos-server` | +| `nacos.image.tag` | Nacos container image tag | `latest` | +| `nacos.image.pullPolicy` | Nacos container image pull policy | `IfNotPresent` | +| `nacos.plugin.enable` | Nacos cluster plugin that is auto scale | `true` | +| `nacos.plugin.image.repository` | Nacos cluster plugin image name | `nacos/nacos-peer-finder-plugin` | +| `nacos.plugin.image.tag` | Nacos cluster plugin image tag | `1.1` | +| `nacos.health.enabled` | Enable health check or not | `false` | +| `nacos.env.preferhostmode` | Enable Nacos cluster node domain name support | `hostname` | +| `nacos.env.serverPort` | Nacos port | `8848` | +| `nacos.storage.type` | Nacos data storage method `mysql` or `embedded`. The `embedded` supports either standalone or cluster mode | `embedded` | +| `nacos.storage.db.host` | mysql host | | +| `nacos.storage.db.name` | mysql database name | | +| `nacos.storage.db.port` | mysql port | 3306 | +| `nacos.storage.db.username` | username of database | | +| `nacos.storage.db.password` | password of database | | +| `nacos.storage.db.param` | Database url parameter | `characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false` | +| `persistence.enabled` | Enable the nacos data persistence or not | `false` | +| `persistence.data.accessModes` | Nacos data pvc access mode | `ReadWriteOnce` | +| `persistence.data.storageClassName` | Nacos data pvc storage class name | `manual` | +| `persistence.data.resources.requests.storage` | Nacos data pvc requests storage | `5G` | +| `service.type` | http service type | `NodePort` | +| `service.port` | http service port | `8848` | +| `service.nodePort` | http service nodeport | `30000` | +| `ingress.enabled` | Enable ingress or not | `false` | +| `ingress.annotations` | The annotations used in ingress | `{}` | +| `ingress.hosts` | The host of nacos service in ingress rule | `nacos.example.com` | + + +## Example +![img](../images/nacos.png) +#### standalone mode(with embedded) +```console +$ helm install `release name` ./ --set global.mode=standalone +``` +![img](../images/quickstart.png) + +#### standalone mode(with mysql) +```console +$ helm install `release name` ./ --set global.mode=standalone --set nacos.storage.db.host=host --set nacos.storage. +db.name=dbName --set nacos.storage.db.port=port --set nacos.storage.db.username=username --set nacos.storage.db. +password=password +``` +![img](../images/standalone.png) + + +> **Tip**: if the logs of nacos pod throws exception, you may need to delete the pod. Because mysql pod is not ready, nacos pod has been started. + +#### cluster mode(without pv) +```console +$ helm install `release name` ./ --set global.mode=cluster +``` +![img](../images/cluster1.png) + +```console +$ kubectl scale sts `release name`-nacos --replicas=3 +``` +![img](../images/cluster2.png) + + * Use kubectl exec to get the cluster config of the Pods in the nacos StatefulSet after scale StatefulSets + +![img](../images/cluster3.png) diff --git a/cicd/helm/templates/NOTES.txt b/cicd/helm/templates/NOTES.txt new file mode 100644 index 0000000..98aaf50 --- /dev/null +++ b/cicd/helm/templates/NOTES.txt @@ -0,0 +1,25 @@ + +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services nacos-cs) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/nacos +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nacos.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nacos.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nacos.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} +2. MODE: + standalone: you need to modify replicaCount in the values.yaml, .Values.replicaCount=1 + cluster: kubectl scale sts {{ .Release.Namespace }}-nacos --replicas=3 diff --git a/cicd/helm/templates/_helpers.tpl b/cicd/helm/templates/_helpers.tpl new file mode 100644 index 0000000..4c874a4 --- /dev/null +++ b/cicd/helm/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "nacos.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nacos.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nacos.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "nacos.labels" -}} +app.kubernetes.io/name: {{ include "nacos.name" . }} +helm.sh/chart: {{ include "nacos.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/cicd/helm/templates/configmap.yaml b/cicd/helm/templates/configmap.yaml new file mode 100644 index 0000000..dfa2117 --- /dev/null +++ b/cicd/helm/templates/configmap.yaml @@ -0,0 +1,19 @@ +{{- if eq .Values.nacos.storage.type "mysql"}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: nacos-cm + namespace: {{ .Values.namespace }} +data: + {{- with .Values.nacos.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 }} + + + diff --git a/cicd/helm/templates/ingress.yaml b/cicd/helm/templates/ingress.yaml new file mode 100644 index 0000000..8445aa0 --- /dev/null +++ b/cicd/helm/templates/ingress.yaml @@ -0,0 +1,54 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nacos.fullname" . -}} +apiVersion: {{ .Values.ingress.apiVersion }} +kind: Ingress +metadata: + name: {{ $fullName }} + namespace: {{ .Values.namespace }} + labels: +{{ include "nacos.labels" . | indent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + {{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} + {{- end }} + {{- if eq .Values.ingress.apiVersion "networking.k8s.io/v1" }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: nacos-cs + port: + number: 8848 + {{- end }} + {{- else }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + - path: / + backend: + serviceName: nacos-cs + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/cicd/helm/templates/mysql.yaml b/cicd/helm/templates/mysql.yaml new file mode 100644 index 0000000..3ca946f --- /dev/null +++ b/cicd/helm/templates/mysql.yaml @@ -0,0 +1,55 @@ +{{- if eq .Values.nacos.storage.type "mysql"}} +apiVersion: v1 +kind: ReplicationController +metadata: + name: {{ .Values.nacos.storage.db.host }} + namespace: {{ .Values.namespace }} + labels: + name: mysql + +spec: + replicas: 1 + selector: + name: mysql + template: + metadata: + labels: + name: mysql + spec: + containers: + - name: {{ .Values.nacos.storage.db.host }} + image: nacos/nacos-mysql:5.7 + ports: + - containerPort: {{ .Values.nacos.storage.db.port }} + volumeMounts: + - name: mysql-data + mountPath: /var/lib/mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: "root" + - name: MYSQL_DATABASE + value: {{ .Values.nacos.storage.db.name }} + - name: MYSQL_USER + value: {{ .Values.nacos.storage.db.username }} + - name: MYSQL_PASSWORD + value: {{ .Values.nacos.storage.db.password }} + volumes: + - name: mysql-data + {{- end }} + +--- +{{- if eq .Values.nacos.storage.type "mysql"}} +apiVersion: v1 +kind: Service +metadata: + name: mysql + namespace: {{ .Values.namespace }} + labels: + name: mysql +spec: + ports: + - port: {{ .Values.nacos.storage.db.port }} + targetPort: {{ .Values.nacos.storage.db.port }} + selector: + name: mysql + {{- end }} \ No newline at end of file diff --git a/cicd/helm/templates/service.yaml b/cicd/helm/templates/service.yaml new file mode 100644 index 0000000..6e82664 --- /dev/null +++ b/cicd/helm/templates/service.yaml @@ -0,0 +1,63 @@ +{{- if and (eq .Values.global.mode "cluster") }} +apiVersion: v1 +kind: Service +metadata: + name: nacos-hs + namespace: {{ .Values.namespace }} +spec: + clusterIP: None + publishNotReadyAddresses: true + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.nacos.serverPort }} + protocol: TCP + name: http + - port: {{ add .Values.service.port 1000}} + name: client-rpc + targetPort: {{add .Values.nacos.serverPort 1000}} + - port: {{add .Values.service.port 1001}} + name: raft-rpc + targetPort: {{add .Values.nacos.serverPort 1001}} + ## 兼容1.4.x版本的选举端口 + - port: 7848 + name: old-raft-rpc + targetPort: 7848 + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "nacos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- end }} +--- +apiVersion: v1 +kind: Service +metadata: + name: nacos-cs + namespace: {{ .Values.namespace }} + labels: + {{- toYaml .Values.service.labels | nindent 4 }} + annotations: + {{- toYaml .Values.service.annotations | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.nacos.serverPort }} + protocol: TCP + name: http + - port: {{ add .Values.service.port 1000}} + name: client-rpc + targetPort: {{add .Values.nacos.serverPort 1000}} + - port: {{add .Values.service.port 1001}} + name: raft-rpc + targetPort: {{add .Values.nacos.serverPort 1001}} + ## 兼容1.4.x版本的选举端口 + - port: 7848 + name: old-raft-rpc + targetPort: 7848 + protocol: TCP + {{- if eq .Values.service.type "NodePort" }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + selector: + app.kubernetes.io/name: {{ include "nacos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/cicd/helm/templates/statefulset.yaml b/cicd/helm/templates/statefulset.yaml new file mode 100644 index 0000000..854ad2a --- /dev/null +++ b/cicd/helm/templates/statefulset.yaml @@ -0,0 +1,165 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "nacos.fullname" . }} + namespace: {{ .Values.namespace }} + annotations: + {{- toYaml .Values.annotations | indent 4 }} +spec: + {{- if eq .Values.global.mode "cluster" }} + serviceName: nacos-hs + {{- else }} + serviceName: nacos-cs + {{- end }} + replicas: {{ .Values.nacos.replicaCount }} + {{- if .Values.nacos.podManagementPolicy }} + podManagementPolicy: {{ .Values.nacos.podManagementPolicy }} + {{- else}} + podManagementPolicy: OrderedReady + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nacos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "nacos.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if and (eq .Values.global.mode "cluster") (.Values.nacos.plugin.enable) }} + initContainers: + - name: peer-finder-plugin-install + image: {{.Values.nacos.plugin.image.repository}}:{{.Values.nacos.plugin.image.tag}} + imagePullPolicy: {{ .Values.nacos.plugin.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: 180 + 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.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-hs" + - name: DOMAIN_NAME + value: {{ .Values.nacos.domainName | quote }} + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + {{- end }} + {{- if eq .Values.nacos.storage.type "mysql" }} + - 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 }} + diff --git a/cicd/helm/values.yaml b/cicd/helm/values.yaml new file mode 100644 index 0000000..8ed0077 --- /dev/null +++ b/cicd/helm/values.yaml @@ -0,0 +1,98 @@ +# Default values for nacos. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: +# mode: standalone + mode: cluster + +############################nacos########################### +namespace: default +nacos: + image: + repository: nacos/nacos-server + tag: latest + pullPolicy: IfNotPresent + plugin: + enable: true + image: + repository: nacos/nacos-peer-finder-plugin + tag: 1.1 + pullPolicy: IfNotPresent + replicaCount: 1 + podManagementPolicy: Parallel + domainName: cluster.local + preferhostmode: hostname + serverPort: 8848 + health: + enabled: false + storage: +# type: embedded + type: mysql + db: + host: "mysql" + name: "nacos_devtest" + port: 3306 + username: "nacos" + password: "nacos" + param: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false + +persistence: + enabled: false + data: + accessModes: + - ReadWriteOnce + storageClassName: manual + resources: + requests: + storage: 5Gi + + +service: + #type: ClusterIP + type: NodePort + port: 8848 + nodePort: 30000 + + +ingress: + enabled: false + # apiVersion: extensions/v1beta1 + apiVersion: networking.k8s.io/v1 + annotations: { } + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName + # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress + # ingressClassName: nginx + ingressClassName: "nginx" + hosts: + - host: nacos.example.com + #paths: [ ] + + tls: [ ] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + requests: + cpu: 500m + memory: 2Gi +annotations: { } + +nodeSelector: { } + +tolerations: [ ] + +affinity: { } + + + From 3b275bea5a679f29cefa1e1e1528218fcda03b20 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 14 Jun 2023 16:53:07 +0800 Subject: [PATCH 02/19] add build --- cicd/build/Dockerfile | 57 ++++++++++++++ cicd/build/Dockerfile.Slim | 47 +++++++++++ cicd/build/bin/docker-startup.sh | 104 +++++++++++++++++++++++++ cicd/build/conf/application.properties | 49 ++++++++++++ 4 files changed, 257 insertions(+) create mode 100644 cicd/build/Dockerfile create mode 100644 cicd/build/Dockerfile.Slim create mode 100755 cicd/build/bin/docker-startup.sh create mode 100644 cicd/build/conf/application.properties diff --git a/cicd/build/Dockerfile b/cicd/build/Dockerfile new file mode 100644 index 0000000..83c75a7 --- /dev/null +++ b/cicd/build/Dockerfile @@ -0,0 +1,57 @@ +FROM centos:7.9.2009 +MAINTAINER pader "huangmnlove@163.com" + +# set environment +ENV MODE="cluster" \ + PREFER_HOST_MODE="ip"\ + BASE_DIR="/home/nacos" \ + CLASSPATH=".:/home/nacos/conf:$CLASSPATH" \ + CLUSTER_CONF="/home/nacos/conf/cluster.conf" \ + FUNCTION_MODE="all" \ + JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" \ + NACOS_USER="nacos" \ + JAVA="/usr/lib/jvm/java-1.8.0-openjdk/bin/java" \ + JVM_XMS="1g" \ + JVM_XMX="1g" \ + JVM_XMN="512m" \ + JVM_MS="128m" \ + JVM_MMS="320m" \ + NACOS_DEBUG="n" \ + TOMCAT_ACCESSLOG_ENABLED="false" \ + TIME_ZONE="Asia/Shanghai" + + +#ARG NACOS_VERSION=2.3.0 +ARG HOT_FIX_FLAG="" + +WORKDIR $BASE_DIR + +ADD ./nacos-server-*.tar.gz /home/ + +RUN rm -rf /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql \ + && set -x \ + && yum update -y \ + && yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel wget iputils nc vim libcurl \ + && java -version + +RUN yum autoremove -y wget \ + && ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone \ + && yum clean all + + + + +ADD bin/docker-startup.sh bin/docker-startup.sh +ADD conf/application.properties conf/application.properties + + +# set startup log dir +RUN mkdir -p logs \ + && cd logs \ + && touch start.out \ + && ln -sf /dev/stdout start.out \ + && ln -sf /dev/stderr start.out +RUN chmod +x bin/docker-startup.sh + +EXPOSE 8848 +ENTRYPOINT ["bin/docker-startup.sh"] diff --git a/cicd/build/Dockerfile.Slim b/cicd/build/Dockerfile.Slim new file mode 100644 index 0000000..d4896cb --- /dev/null +++ b/cicd/build/Dockerfile.Slim @@ -0,0 +1,47 @@ +FROM amd64/buildpack-deps:buster-curl as installer + +ARG HOT_FIX_FLAG="" + +RUN set -x \ + && mkdir /home/nacos \ + && mv /home/runner/work/nacos/nacos/* /home/nacos \ + && rm -rf /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql + +FROM openjdk:8-jre-slim + +# set environment +ENV MODE="cluster" \ + PREFER_HOST_MODE="ip"\ + BASE_DIR="/home/nacos" \ + CLASSPATH=".:/home/nacos/conf:$CLASSPATH" \ + CLUSTER_CONF="/home/nacos/conf/cluster.conf" \ + FUNCTION_MODE="all" \ + NACOS_USER="nacos" \ + JAVA="/usr/local/openjdk-8/bin/java" \ + JVM_XMS="1g" \ + JVM_XMX="1g" \ + JVM_XMN="512m" \ + JVM_MS="128m" \ + JVM_MMS="320m" \ + NACOS_DEBUG="n" \ + TOMCAT_ACCESSLOG_ENABLED="false" \ + TZ="Asia/Shanghai" + +WORKDIR $BASE_DIR + +# copy nacos bin +COPY --from=installer ["/home/nacos", "/home/nacos"] + +ADD bin/docker-startup.sh bin/docker-startup.sh +ADD conf/application.properties conf/application.properties + +# set startup log dir +RUN mkdir -p logs \ + && cd logs \ + && touch start.out \ + && ln -sf /dev/stdout start.out \ + && ln -sf /dev/stderr start.out +RUN chmod +x bin/docker-startup.sh + +EXPOSE 8848 +ENTRYPOINT ["bin/docker-startup.sh"] diff --git a/cicd/build/bin/docker-startup.sh b/cicd/build/bin/docker-startup.sh new file mode 100755 index 0000000..04b995e --- /dev/null +++ b/cicd/build/bin/docker-startup.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright 1999-2018 Alibaba Group Holding Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -x +export CUSTOM_SEARCH_NAMES="application" +export CUSTOM_SEARCH_LOCATIONS=file:${BASE_DIR}/conf/ +export MEMBER_LIST="" +PLUGINS_DIR="/home/nacos/plugins/peer-finder" +function print_servers() { + if [[ ! -d "${PLUGINS_DIR}" ]]; then + echo "" >"$CLUSTER_CONF" + for server in ${NACOS_SERVERS}; do + echo "$server" >>"$CLUSTER_CONF" + done + else + bash $PLUGINS_DIR/plugin.sh + sleep 30 + fi +} +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +if [[ "${MODE}" == "standalone" ]]; then + + JAVA_OPT="${JAVA_OPT} -Xms${JVM_XMS} -Xmx${JVM_XMX} -Xmn${JVM_XMN}" + JAVA_OPT="${JAVA_OPT} -Dnacos.standalone=true" +else + if [[ "${EMBEDDED_STORAGE}" == "embedded" ]]; then + JAVA_OPT="${JAVA_OPT} -DembeddedStorage=true" + fi + JAVA_OPT="${JAVA_OPT} -server -Xms${JVM_XMS} -Xmx${JVM_XMX} -Xmn${JVM_XMN} -XX:MetaspaceSize=${JVM_MS} -XX:MaxMetaspaceSize=${JVM_MMS}" + if [[ "${NACOS_DEBUG}" == "y" ]]; then + JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" + fi + JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}/logs/java_heapdump.hprof" + JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" + print_servers +fi + +#=========================================================================================== +# Setting system properties +#=========================================================================================== +# set mode that Nacos Server function of split +if [[ "${FUNCTION_MODE}" == "config" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=config" +elif [[ "${FUNCTION_MODE}" == "naming" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=naming" +fi +# set nacos server ip +if [[ ! -z "${NACOS_SERVER_IP}" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.server.ip=${NACOS_SERVER_IP}" +fi + +if [[ ! -z "${USE_ONLY_SITE_INTERFACES}" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.use-only-site-local-interfaces=${USE_ONLY_SITE_INTERFACES}" +fi + +if [[ ! -z "${PREFERRED_NETWORKS}" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.preferred-networks=${PREFERRED_NETWORKS}" +fi + +if [[ ! -z "${IGNORED_INTERFACES}" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.ignored-interfaces=${IGNORED_INTERFACES}" +fi + +### If turn on auth system: +if [[ ! -z "${NACOS_AUTH_ENABLE}" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.enabled=${NACOS_AUTH_ENABLE}" +fi + +if [[ "${PREFER_HOST_MODE}" == "hostname" ]]; then + JAVA_OPT="${JAVA_OPT} -Dnacos.preferHostnameOverIp=true" +fi +JAVA_OPT="${JAVA_OPT} -Dnacos.member.list=${MEMBER_LIST}" + +JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p') +if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]]; then + JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400" +else + JAVA_OPT_EXT_FIX="-Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext" + JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M" +fi + +JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins,${BASE_DIR}/plugins/health,${BASE_DIR}/plugins/cmdb,${BASE_DIR}/plugins/selector" +JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}" +JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar" +JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}" +JAVA_OPT="${JAVA_OPT} --spring.config.name=${CUSTOM_SEARCH_NAMES}" +JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml" +JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288" + +echo "Nacos is starting, you can docker logs your container" +exec $JAVA ${JAVA_OPT} diff --git a/cicd/build/conf/application.properties b/cicd/build/conf/application.properties new file mode 100644 index 0000000..51252ca --- /dev/null +++ b/cicd/build/conf/application.properties @@ -0,0 +1,49 @@ +# spring +server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos} +server.contextPath=/nacos +server.port=${NACOS_APPLICATION_PORT:8848} +server.tomcat.accesslog.max-days=30 +server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i +server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false} +server.error.include-message=ALWAYS +# default current work dir +server.tomcat.basedir=file:. +#*************** Config Module Related Configurations ***************# +### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced. +#spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:} +spring.sql.init.platform=${SPRING_DATASOURCE_PLATFORM:} +nacos.cmdb.dumpTaskInterval=3600 +nacos.cmdb.eventTaskInterval=10 +nacos.cmdb.labelTaskInterval=300 +nacos.cmdb.loadDataAtStart=false +db.num=${MYSQL_DATABASE_NUM:1} +db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?${MYSQL_SERVICE_DB_PARAM:characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false} +db.user.0=${MYSQL_SERVICE_USER} +db.password.0=${MYSQL_SERVICE_PASSWORD} +### The auth system to use, currently only 'nacos' and 'ldap' is supported: +nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos} +### worked when nacos.core.auth.system.type=nacos +### The token expiration in seconds: +nacos.core.auth.plugin.nacos.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000} +### The default token: +nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN:} +### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. +nacos.core.auth.caching.enabled=${NACOS_AUTH_CACHE_ENABLE:false} +nacos.core.auth.enable.userAgentAuthWhite=${NACOS_AUTH_USER_AGENT_AUTH_WHITE_ENABLE:false} +nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:} +nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:} +## spring security config +### turn off security +nacos.security.ignore.urls=${NACOS_SECURITY_IGNORE_URLS:/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**} +# metrics for elastic search +management.metrics.export.elastic.enabled=false +management.metrics.export.influx.enabled=false +nacos.naming.distro.taskDispatchThreadCount=10 +nacos.naming.distro.taskDispatchPeriod=200 +nacos.naming.distro.batchSyncKeyCount=1000 +nacos.naming.distro.initDataRatio=0.9 +nacos.naming.distro.syncRetryDelay=5000 +nacos.naming.data.warmup=true + + + From 5bdccf8db9177931187a9aaf26990655f7426471 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 17:25:08 +0800 Subject: [PATCH 03/19] fix: fix bug in go lang --- golang/util/nacos_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index f228cdc..e22df55 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -36,7 +36,7 @@ const TEST_PORT_8848 = 8848 func init() { var ALL_IP = os.Getenv("ALL_IP") - pairs := strings.Split(str, ",") + pairs := strings.Split(ALL_IP, ",") firstPair := "" firstValue := "" for _, pair := range pairs { From 88a7b820c90182b2d635fa116e324d8358ef5fea Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 17:38:51 +0800 Subject: [PATCH 04/19] fix: add python requirements.txt --- python/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 python/requirements.txt diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..3588211 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1 @@ +nacos-sdk-python==0.1.12 From 3bd53a87e98fdb4bdd0253a4a585b93ded03c989 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 17:40:22 +0800 Subject: [PATCH 05/19] fix: add go client version --- golang/util/nacos_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index e22df55..7bb83f8 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -6,7 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/nacos-group/nacos-sdk-go/v2/clients" + "github.com/nacos-group/nacos-sdk-go/v2/clients v2.2.2" "github.com/nacos-group/nacos-sdk-go/v2/clients/config_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" From 4a74bd3126fe80a3ebda5b92bd85086f6c653938 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 17:50:26 +0800 Subject: [PATCH 06/19] fix: add go client version --- golang/util/nacos_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index 7bb83f8..0ca4dd3 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -6,7 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/nacos-group/nacos-sdk-go/v2/clients v2.2.2" + "github.com/nacos-group/nacos-sdk-go/v2/clients@v2.2.2" "github.com/nacos-group/nacos-sdk-go/v2/clients/config_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" From 5361925bd60727832ea08d1699023185aed5d120 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 19:34:14 +0800 Subject: [PATCH 07/19] fix: add go client version --- golang/util/nacos_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index 0ca4dd3..c69c61f 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -6,7 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/nacos-group/nacos-sdk-go/v2/clients@v2.2.2" + "github.com/nacos-group/nacos-sdk-go/v2/clients/v2.2.2" "github.com/nacos-group/nacos-sdk-go/v2/clients/config_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" From fb8ca28a5e566007eca15b22f900348dc730d3ff Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 19:47:22 +0800 Subject: [PATCH 08/19] fix: add go client version --- golang/.gitignore | 4 ++-- golang/go.mod | 6 ++++++ golang/util/nacos_base.go | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 golang/go.mod diff --git a/golang/.gitignore b/golang/.gitignore index 408c22e..5be295c 100644 --- a/golang/.gitignore +++ b/golang/.gitignore @@ -21,7 +21,7 @@ output/ go.work -go.mod +#go.mod go.sum -cover/ \ No newline at end of file +cover/ diff --git a/golang/go.mod b/golang/go.mod new file mode 100644 index 0000000..94c6e52 --- /dev/null +++ b/golang/go.mod @@ -0,0 +1,6 @@ +module github.com/nacos-e2e/golang + +require ( + github.com/nacos-group/nacos-sdk-go/v2/clients v2.2.2 +) + diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index c69c61f..1967867 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -6,7 +6,6 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/nacos-group/nacos-sdk-go/v2/clients/v2.2.2" "github.com/nacos-group/nacos-sdk-go/v2/clients/config_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" From 5f1a53ad3266ddf30ed23b8850582ccb6b9ede29 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 19:50:52 +0800 Subject: [PATCH 09/19] fix: add go client version --- golang/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/go.mod b/golang/go.mod index 94c6e52..e079409 100644 --- a/golang/go.mod +++ b/golang/go.mod @@ -1,6 +1,6 @@ module github.com/nacos-e2e/golang require ( - github.com/nacos-group/nacos-sdk-go/v2/clients v2.2.2 + github.com/nacos-group/nacos-sdk-go v2.2.2 ) From 8293e6d695008b8cbc7f61cd4d9bfd2975140f8b Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 20:00:04 +0800 Subject: [PATCH 10/19] fix: add go client version --- golang/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/go.mod b/golang/go.mod index e079409..09d860f 100644 --- a/golang/go.mod +++ b/golang/go.mod @@ -1,6 +1,6 @@ module github.com/nacos-e2e/golang require ( - github.com/nacos-group/nacos-sdk-go v2.2.2 + github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 ) From 866e05919a144eb1ae0f141e5748621d7e97a7e0 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 20:03:37 +0800 Subject: [PATCH 11/19] fix: add go client version --- golang/util/nacos_base.go | 1 + 1 file changed, 1 insertion(+) diff --git a/golang/util/nacos_base.go b/golang/util/nacos_base.go index 1967867..e22df55 100644 --- a/golang/util/nacos_base.go +++ b/golang/util/nacos_base.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/nacos-group/nacos-sdk-go/v2/clients" "github.com/nacos-group/nacos-sdk-go/v2/clients/config_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/common/constant" From e01927e322eaca091b8ee271d65ea9de6ec78740 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Tue, 7 Nov 2023 20:09:19 +0800 Subject: [PATCH 12/19] fix: add go client version --- golang/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang/go.mod b/golang/go.mod index 09d860f..bb666ad 100644 --- a/golang/go.mod +++ b/golang/go.mod @@ -1,6 +1,6 @@ module github.com/nacos-e2e/golang require ( - github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 + github.com/nacos-group/nacos-sdk-go/v2 v2.2.3 ) From cf486659492f59f70473627cbcc507a730da3dee Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 8 Nov 2023 09:59:50 +0800 Subject: [PATCH 13/19] fix: add cpp client version --- cpp/Makefile | 12 ++++++++++++ cpp/nacoscpptest/nacos_test.cpp | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 cpp/Makefile diff --git a/cpp/Makefile b/cpp/Makefile new file mode 100644 index 0000000..f467f19 --- /dev/null +++ b/cpp/Makefile @@ -0,0 +1,12 @@ +NACOS_SDK_CPP := nacos-sdk-cpp +NACOS_SDK_CPP_VERSION := v1.1.0 + +install: + yum -y install libcurl-devel + git clone -b ${NACOS_SDK_CPP_VERSION} https://github.com/nacos-group/${NACOS_SDK_CPP}.git + cd /root/code/cpp/nacos-sdk-cpp && cmake . && make && make install + echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc && source ~/.bashrc + + + + diff --git a/cpp/nacoscpptest/nacos_test.cpp b/cpp/nacoscpptest/nacos_test.cpp index af305f9..0e0e627 100644 --- a/cpp/nacoscpptest/nacos_test.cpp +++ b/cpp/nacoscpptest/nacos_test.cpp @@ -9,7 +9,7 @@ using namespace testing; using namespace std; using namespace nacos; -std::string extractNacosIPs(const std::string& inputString) { +std::string extractNacosIPs(std::string& inputString) { std::vector nacosIPs; std::string delimiter = ","; // split by , size_t pos = 0; @@ -310,4 +310,4 @@ TEST(NamingTestSuit,CASE4_ListenAndRegisterInstance) { int main(int argc, char *argv[]) { InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} From 34a25562bd2b68d2eedabdc94c6549fe7d70887b Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 8 Nov 2023 11:06:27 +0800 Subject: [PATCH 14/19] fix: csharp --- csharp/nacos-csharp-sdk-test/nacos-csharp-sdk-test.csproj | 1 + csharp/nacos-csharp-sdk-test/test/NacosMainTest.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/csharp/nacos-csharp-sdk-test/nacos-csharp-sdk-test.csproj b/csharp/nacos-csharp-sdk-test/nacos-csharp-sdk-test.csproj index 04d78db..09b4371 100644 --- a/csharp/nacos-csharp-sdk-test/nacos-csharp-sdk-test.csproj +++ b/csharp/nacos-csharp-sdk-test/nacos-csharp-sdk-test.csproj @@ -6,6 +6,7 @@ + diff --git a/csharp/nacos-csharp-sdk-test/test/NacosMainTest.cs b/csharp/nacos-csharp-sdk-test/test/NacosMainTest.cs index b07b3a4..a457170 100644 --- a/csharp/nacos-csharp-sdk-test/test/NacosMainTest.cs +++ b/csharp/nacos-csharp-sdk-test/test/NacosMainTest.cs @@ -4,6 +4,7 @@ using Nacos.V2.DependencyInjection; using Nacos.V2.Utils; using System; +using System.IO; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -287,4 +288,4 @@ public Task OnEvent(IEvent @event) } #endregion } -} \ No newline at end of file +} From 65c8d03b511c13703f2d7258713a2d890624eaa8 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 8 Nov 2023 16:57:37 +0800 Subject: [PATCH 15/19] fix: cpp --- cpp/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/Makefile b/cpp/Makefile index f467f19..9828dfb 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -5,7 +5,6 @@ install: yum -y install libcurl-devel git clone -b ${NACOS_SDK_CPP_VERSION} https://github.com/nacos-group/${NACOS_SDK_CPP}.git cd /root/code/cpp/nacos-sdk-cpp && cmake . && make && make install - echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc && source ~/.bashrc From 8b7e045870a31be4f132a7d2f262fbd87997d945 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Wed, 8 Nov 2023 18:42:34 +0800 Subject: [PATCH 16/19] fix: python --- python/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/requirements.txt b/python/requirements.txt index 3588211..e8e9601 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1 +1 @@ -nacos-sdk-python==0.1.12 +nacos-sdk-python==0.1.14 From 2b334b60da7419b52f89dc66f83bc2abac2bd551 Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Thu, 9 Nov 2023 16:38:33 +0800 Subject: [PATCH 17/19] fix: delete go.mod --- golang/.gitignore | 2 +- golang/go.mod | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 golang/go.mod diff --git a/golang/.gitignore b/golang/.gitignore index 5be295c..772c365 100644 --- a/golang/.gitignore +++ b/golang/.gitignore @@ -21,7 +21,7 @@ output/ go.work -#go.mod +go.mod go.sum cover/ diff --git a/golang/go.mod b/golang/go.mod deleted file mode 100644 index bb666ad..0000000 --- a/golang/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/nacos-e2e/golang - -require ( - github.com/nacos-group/nacos-sdk-go/v2 v2.2.3 -) - From cd12a60ff12de6421435d28fea0463fbe9a22a9b Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Thu, 9 Nov 2023 16:44:28 +0800 Subject: [PATCH 18/19] fix: delete cover --- golang/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/golang/.gitignore b/golang/.gitignore index 772c365..decba56 100644 --- a/golang/.gitignore +++ b/golang/.gitignore @@ -24,4 +24,3 @@ go.work go.mod go.sum -cover/ From 32a377a4114984ac853837ac2bc77a81c6b27e7c Mon Sep 17 00:00:00 2001 From: Wuyunfan-BUPT <1564396093@qq.com> Date: Thu, 9 Nov 2023 17:10:50 +0800 Subject: [PATCH 19/19] fix: add cover --- golang/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/golang/.gitignore b/golang/.gitignore index decba56..772c365 100644 --- a/golang/.gitignore +++ b/golang/.gitignore @@ -24,3 +24,4 @@ go.work go.mod go.sum +cover/