Skip to content

Commit

Permalink
Merge pull request #359 from kubesphere/sync/ks-core
Browse files Browse the repository at this point in the history
Update ks-core helm chart
  • Loading branch information
wansir authored Feb 19, 2024
2 parents 87118ad + 95422e8 commit 9de994e
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/test/ks-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions src/test/ks-core/templates/_images.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down
7 changes: 7 additions & 0 deletions src/test/ks-core/templates/globalroles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ kind: GlobalRole
metadata:
name: anonymous
rules:
- apiGroups:
- config.kubesphere.io
resources:
- configs
verbs:
- get
- list
- nonResourceURLs:
- '/static/images/*'
verbs:
Expand Down
10 changes: 9 additions & 1 deletion src/test/ks-core/templates/ks-apiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ks-core/templates/ks-console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ks-core/templates/ks-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions src/test/ks-core/templates/kubesphere-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
10 changes: 0 additions & 10 deletions src/test/ks-core/templates/license.yaml

This file was deleted.

1 change: 0 additions & 1 deletion src/test/ks-core/templates/oauthclient-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
143 changes: 143 additions & 0 deletions src/test/ks-core/templates/redis.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
27 changes: 23 additions & 4 deletions src/test/ks-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -74,7 +74,6 @@ nodeSelector: {}
internalTLS: false

apiserver:
replicaCount: 1
image:
registry: ""
repository: kse/ks-apiserver
Expand Down Expand Up @@ -125,7 +124,6 @@ apiserver:
extraVolumes: []

console:
replicaCount: 1
image:
registry: ""
repository: kse/ks-console
Expand Down Expand Up @@ -168,7 +166,6 @@ console:
extraVolumes: []

controller:
replicaCount: 1
image:
registry: ""
repository: kse/ks-controller-manager
Expand Down Expand Up @@ -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: ""
Expand Down

0 comments on commit 9de994e

Please sign in to comment.