diff --git a/src/main/ks-core/Chart.yaml b/src/main/ks-core/Chart.yaml index 6f13d87e..76961973 100644 --- a/src/main/ks-core/Chart.yaml +++ b/src/main/ks-core/Chart.yaml @@ -7,7 +7,7 @@ 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: 1.1.0 +version: 1.1.1 # 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 diff --git a/src/main/ks-core/templates/_images.tpl b/src/main/ks-core/templates/_images.tpl index 64aa434a..f77da091 100644 --- a/src/main/ks-core/templates/_images.tpl +++ b/src/main/ks-core/templates/_images.tpl @@ -37,6 +37,10 @@ Return the proper image name {{ include "common.images.image" (dict "imageRoot" .Values.preUpgrade.image "global" .Values.global) }} {{- end -}} +{{- define "extensions_museum.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.ksExtensionRepository.image "global" .Values.global) }} +{{- end -}} + {{- define "common.images.image" -}} {{- $registryName := .global.imageRegistry -}} {{- $repositoryName := .imageRoot.repository -}} @@ -70,6 +74,10 @@ Return the proper Docker Image Registry Secret Names {{- include "common.images.pullSecrets" (dict "images" (list .Values.controller.image) "global" .Values.global) -}} {{- end -}} +{{- define "extensions_museum.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.ksExtensionRepository.image) "global" .Values.global) -}} +{{- end -}} + {{- define "common.images.pullSecrets" -}} {{- $pullSecrets := list }} diff --git a/src/main/ks-core/templates/extension-museum.yaml b/src/main/ks-core/templates/extension-museum.yaml new file mode 100644 index 00000000..ae9ca355 --- /dev/null +++ b/src/main/ks-core/templates/extension-museum.yaml @@ -0,0 +1,74 @@ +{{- if .Values.ksExtensionRepository.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: extensions-museum + namespace: {{ .Release.Namespace }} + labels: + app: extensions-museum +spec: + replicas: 1 + selector: + matchLabels: + app: extensions-museum + template: + metadata: + labels: + app: extensions-museum + spec: +{{- include "extensions_museum.imagePullSecrets" . | nindent 6 }} + containers: + - name: extensions-museum + image: {{ template "extensions_museum.image" . }} + command: + - "/chartmuseum" + - "--storage-local-rootdir" + - "/charts" + - "--storage" + - "local" + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: extensions-museum + namespace: {{ .Release.Namespace }} +spec: + selector: + app: extensions-museum + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + +--- +apiVersion: kubesphere.io/v1alpha1 +kind: Repository +metadata: + name: extensions-museum +spec: + url: http://extensions-museum.{{ .Release.Namespace }}.svc + +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: restart-extensions-museum + namespace: {{ .Release.Namespace }} +spec: + schedule: "0 0 * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: restart-extensions-museum + image: {{ template "kubectl.image" . }} + command: + - /bin/sh + - -c + - "kubectl rollout restart deployment/extensions-museum -n {{ .Release.Namespace }}" + restartPolicy: OnFailure + serviceAccountName: {{ template "ks-core.serviceAccountName" . }} +{{end}} diff --git a/src/main/ks-core/values.yaml b/src/main/ks-core/values.yaml index 611cc0d4..b865ad70 100644 --- a/src/main/ks-core/values.yaml +++ b/src/main/ks-core/values.yaml @@ -434,3 +434,12 @@ ksCRDs: requests: cpu: 20m memory: 100Mi + +# add museum for all ks-extensions +ksExtensionRepository: + enabled: true + image: + registry: "" + repository: kubesphere/ks-extensions-museum + tag: "latest" + pullPolicy: Always