From 95422e88ded76838f7088e9bf032e2b203d7f169 Mon Sep 17 00:00:00 2001 From: ci-bot Date: Mon, 19 Feb 2024 06:39:29 +0000 Subject: [PATCH] update ks-core helm chart --- src/test/ks-core/Chart.yaml | 4 +- src/test/ks-core/templates/_images.tpl | 4 + src/test/ks-core/templates/globalroles.yaml | 7 + src/test/ks-core/templates/ks-apiserver.yml | 10 +- src/test/ks-core/templates/ks-console.yml | 2 +- .../templates/ks-controller-manager.yaml | 2 +- .../ks-core/templates/kubesphere-config.yaml | 13 ++ src/test/ks-core/templates/license.yaml | 10 -- .../ks-core/templates/oauthclient-config.yaml | 1 - src/test/ks-core/templates/redis.yaml | 143 ++++++++++++++++++ src/test/ks-core/values.yaml | 27 +++- 11 files changed, 203 insertions(+), 20 deletions(-) delete mode 100644 src/test/ks-core/templates/license.yaml create mode 100644 src/test/ks-core/templates/redis.yaml diff --git a/src/test/ks-core/Chart.yaml b/src/test/ks-core/Chart.yaml index 826e2c44f..ab5fec3ae 100644 --- a/src/test/ks-core/Chart.yaml +++ b/src/test/ks-core/Chart.yaml @@ -7,9 +7,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.6.2 +version: 0.6.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "v4.1.0-alpha.0" +appVersion: "v4.1.0-alpha.1" diff --git a/src/test/ks-core/templates/_images.tpl b/src/test/ks-core/templates/_images.tpl index 43ec76aee..5f3a2d636 100644 --- a/src/test/ks-core/templates/_images.tpl +++ b/src/test/ks-core/templates/_images.tpl @@ -29,6 +29,10 @@ Return the proper image name {{ include "common.images.image" (dict "imageRoot" .Values.upgrade.image "global" .Values.global) }} {{- end -}} +{{- define "redis.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.redis.image "global" .Values.global) }} +{{- end -}} + {{- define "common.images.image" -}} {{- $registryName := .global.imageRegistry -}} {{- $repositoryName := .imageRoot.repository -}} diff --git a/src/test/ks-core/templates/globalroles.yaml b/src/test/ks-core/templates/globalroles.yaml index df7ad8e6d..1180a0656 100644 --- a/src/test/ks-core/templates/globalroles.yaml +++ b/src/test/ks-core/templates/globalroles.yaml @@ -3,6 +3,13 @@ kind: GlobalRole metadata: name: anonymous rules: + - apiGroups: + - config.kubesphere.io + resources: + - configs + verbs: + - get + - list - nonResourceURLs: - '/static/images/*' verbs: diff --git a/src/test/ks-core/templates/ks-apiserver.yml b/src/test/ks-core/templates/ks-apiserver.yml index 7379a02b9..e2276f2b5 100644 --- a/src/test/ks-core/templates/ks-apiserver.yml +++ b/src/test/ks-core/templates/ks-apiserver.yml @@ -13,7 +13,7 @@ spec: rollingUpdate: maxSurge: 0 type: RollingUpdate - replicas: {{ .Values.apiserver.replicaCount }} + replicas: {{ if .Values.ha.enabled }} 3 {{ else }} 1 {{ end }} selector: matchLabels: app: ks-apiserver @@ -83,6 +83,14 @@ spec: - name: tls-cert mountPath: /etc/kubesphere/pki/ {{- end }} + {{ if .Values.ha.enabled }} + env: + - name: KUBESPHERE_CACHE_OPTIONS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: auth + {{ end }} volumes: - configMap: defaultMode: 420 diff --git a/src/test/ks-core/templates/ks-console.yml b/src/test/ks-core/templates/ks-console.yml index e831ebcd1..252f08382 100644 --- a/src/test/ks-core/templates/ks-console.yml +++ b/src/test/ks-core/templates/ks-console.yml @@ -13,7 +13,7 @@ spec: rollingUpdate: maxSurge: 0 type: RollingUpdate - replicas: {{ .Values.console.replicaCount }} + replicas: {{ if .Values.ha.enabled }} 3 {{ else }} 1 {{ end }} selector: matchLabels: app: ks-console diff --git a/src/test/ks-core/templates/ks-controller-manager.yaml b/src/test/ks-core/templates/ks-controller-manager.yaml index b065393f3..3e22659e7 100644 --- a/src/test/ks-core/templates/ks-controller-manager.yaml +++ b/src/test/ks-core/templates/ks-controller-manager.yaml @@ -14,7 +14,7 @@ spec: maxSurge: 0 type: RollingUpdate progressDeadlineSeconds: 600 - replicas: {{ .Values.controller.replicaCount }} + replicas: {{ if .Values.ha.enabled }}3{{ else }}1{{ end }} revisionHistoryLimit: 10 selector: matchLabels: diff --git a/src/test/ks-core/templates/kubesphere-config.yaml b/src/test/ks-core/templates/kubesphere-config.yaml index ed1d1e153..8e065e295 100644 --- a/src/test/ks-core/templates/kubesphere-config.yaml +++ b/src/test/ks-core/templates/kubesphere-config.yaml @@ -38,4 +38,17 @@ data: {{- if .Values.devMode }} telemetry: ksCloudURL: "https://clouddev.kubesphere.io" + {{- end }} + {{- if .Values.ha.enabled -}} + {{- if .Values.ha.cache }} + cache: {{- toYaml .Values.ha.cache | nindent 6}} + {{- else }} + cache: + type: redis + options: + host: redis.kubesphere-system.svc + port: 6379 + password: KUBESPHERE_CACHE_OPTIONS_PASSWORD + db: 0 + {{- end }} {{- end }} \ No newline at end of file diff --git a/src/test/ks-core/templates/license.yaml b/src/test/ks-core/templates/license.yaml deleted file mode 100644 index 7a72c1a84..000000000 --- a/src/test/ks-core/templates/license.yaml +++ /dev/null @@ -1,10 +0,0 @@ -{{ if eq .Values.role "host" }} -apiVersion: v1 -kind: Secret -metadata: - name: ks-license - namespace: kubesphere-system -stringData: - base: "{}" - -{{ end }} \ No newline at end of file diff --git a/src/test/ks-core/templates/oauthclient-config.yaml b/src/test/ks-core/templates/oauthclient-config.yaml index 4b96352b7..98bfebcba 100644 --- a/src/test/ks-core/templates/oauthclient-config.yaml +++ b/src/test/ks-core/templates/oauthclient-config.yaml @@ -16,6 +16,5 @@ metadata: namespace: kubesphere-system labels: config.kubesphere.io/type: oauthclient - config.kubesphere.io/oauthclient-name: kubesphere type: config.kubesphere.io/oauthclient {{ end }} \ No newline at end of file diff --git a/src/test/ks-core/templates/redis.yaml b/src/test/ks-core/templates/redis.yaml new file mode 100644 index 000000000..6e1c9d4e5 --- /dev/null +++ b/src/test/ks-core/templates/redis.yaml @@ -0,0 +1,143 @@ +{{- if .Values.ha.enabled }} +{{ if not (lookup "apps/v1" "Deployment" "kubesphere-system" "redis") }} +apiVersion: v1 +kind: Secret +metadata: + name: redis-secret + namespace: kubesphere-system +type: Opaque +data: + auth: {{ randAlphaNum 15 | b64enc }} + +{{- if .Values.redis.pvc.enabled }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-pvc + namespace: kubesphere-system +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.redis.pvc.size | default "2Gi" }} +{{- end }} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: redis + tier: database + version: redis-4.0 + name: redis + namespace: kubesphere-system +spec: + replicas: {{ .Values.redis.replicaCount }} + selector: + matchLabels: + app: redis + tier: database + template: + metadata: + labels: + app: redis + tier: database + version: redis-4.0 + spec: + containers: + - image: {{ template "redis.image" . }} + imagePullPolicy: {{ .Values.redis.image.pullPolicy }} + command: ['sh', '-c', 'cat /tmp/redis/redis.conf | sed "s/REDIS_PASSWORD/$KUBESPHERE_CACHE_OPTIONS_PASSWORD/" > /data/redis.conf | redis-server /data/redis.conf'] + name: redis + args: ["/data/redis.conf"] + env: + - name: KUBESPHERE_CACHE_OPTIONS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: auth + volumeMounts: + - name: redis-config + mountPath: "/tmp/redis" + readOnly: true + {{- if .Values.redis.pvc.enabled }} + - mountPath: /data + name: redis-pvc + subPath: redis-data + {{- end }} + ports: + - containerPort: 6379 + protocol: TCP + resources: + limits: + cpu: 1000m + memory: 1000Mi + requests: + cpu: 20m + memory: 100Mi + volumes: + - name: redis-config + configMap: + name: redis-configmap + {{- if .Values.redis.pvc.enabled }} + - name: redis-pvc + persistentVolumeClaim: + claimName: redis-pvc + {{- end }} + affinity: {{ if .Values.affinity }}{{ .Values.affinity | toYaml | nindent 8 }} + {{- else }} + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + preference: + matchExpressions: + - key: node-role.kubernetes.io/master + operator: In + values: + - "" + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }}{{- end }} + {{- if .Values.tolerations }} + tolerations: {{- toYaml .Values.tolerations | nindent 8 }}{{- end }} +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + name: redis-configmap + labels: + app: redis + tier: database + version: redis-4.0 +data: + redis.conf: | + requirepass REDIS_PASSWORD + masterauth REDIS_PASSWORD + +--- + +apiVersion: v1 +kind: Service +metadata: + labels: + app: redis + tier: database + name: redis + namespace: kubesphere-system +spec: + ports: + - name: redis + port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: redis + tier: database + sessionAffinity: None + type: ClusterIP + {{- end }} +{{- end }} \ No newline at end of file diff --git a/src/test/ks-core/values.yaml b/src/test/ks-core/values.yaml index 2d836feb2..52020ae46 100644 --- a/src/test/ks-core/values.yaml +++ b/src/test/ks-core/values.yaml @@ -2,7 +2,7 @@ ## @param global.tag Global Docker image tag global: imageRegistry: registry.cn-beijing.aliyuncs.com - tag: v4.1.0-alpha.0 + tag: v4.1.0-alpha.1 imagePullSecrets: [] ## @param nameOverride String to partially override common.names.fullname @@ -74,7 +74,6 @@ nodeSelector: {} internalTLS: false apiserver: - replicaCount: 1 image: registry: "" repository: kse/ks-apiserver @@ -125,7 +124,6 @@ apiserver: extraVolumes: [] console: - replicaCount: 1 image: registry: "" repository: kse/ks-console @@ -168,7 +166,6 @@ console: extraVolumes: [] controller: - replicaCount: 1 image: registry: "" repository: kse/ks-controller-manager @@ -227,6 +224,28 @@ helm: tag: "v3.12.1" pullPolicy: IfNotPresent +ha: + enabled: false +# cache: +# type: redis +# options: +# host: "" +# port: 6379 +# password: "" +# db: 0 + +redis: + replicaCount: 1 + image: + registry: "" + repository: redis + digest: "" + tag: "5.0.14-alpine" + pullPolicy: IfNotPresent + pvc: + enabled: true + size: 10Gi + kubectl: image: registry: ""