diff --git a/kubernetes/helm/openslice/templates/cridge-config.yaml b/kubernetes/helm/openslice/templates/cridge-config.yaml deleted file mode 100644 index 2c62c9a4b728e1fbaef442af56fe08dd6a30d585..0000000000000000000000000000000000000000 --- a/kubernetes/helm/openslice/templates/cridge-config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - namespace: {{ .Release.Namespace }} - labels: - app: {{ include "openslice.fullname" . }} - org.etsi.osl.service: cridge - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - {{- include "openslice.labels" . | nindent 4 }} - name: {{ include "openslice.fullname" . }}-cridge-kubeconfig -data: - config: |- - {{- .Files.Get "files/org.etsi.osl.cridge/config" | nindent 4 }} diff --git a/kubernetes/helm/openslice/templates/cridge-secret.yaml b/kubernetes/helm/openslice/templates/cridge-secret.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4a32bff5cab0c141bfb250f1d8e5f1c9dc802feb --- /dev/null +++ b/kubernetes/helm/openslice/templates/cridge-secret.yaml @@ -0,0 +1,32 @@ +{{ if .Values.cridge.enabled }} + +{{- $kubeconfigBase64 := .Values.cridge.kubeconfig.base64 | default "" -}} +{{- $kubeconfigFile := .Values.cridge.kubeconfig.raw | default (.Files.Get "files/org.etsi.osl.cridge/kubeconfig.yaml") -}} +{{- $kubeconfig := "" -}} + +{{- if $kubeconfigBase64 }} + {{- $kubeconfig = $kubeconfigBase64 | b64dec }} +{{- else if $kubeconfigFile }} + {{- $kubeconfig = $kubeconfigFile }} +{{- end }} + +apiVersion: v1 +kind: Secret +metadata: + namespace: {{ .Release.Namespace }} + labels: + app: {{ include "openslice.fullname" . }} + org.etsi.osl.service: cridge + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "openslice.labels" . | nindent 4 }} + name: {{ include "openslice.fullname" . }}-kubeconfig +type: Opaque +data: + config: |- + {{- if $kubeconfig }} + {{ $kubeconfig | b64enc | nindent 4 }} + {{- else }} + {{- required "A kubeconfig file is required." ($kubeconfig | b64enc) | nindent 4 }} + {{- end }} + +{{- end }} diff --git a/kubernetes/helm/openslice/templates/cridge.yaml b/kubernetes/helm/openslice/templates/cridge.yaml index 5e558467581532ef544ef89545b3216cc76f99bf..10656390c474046f1bee83e9531b0cf87da57272 100644 --- a/kubernetes/helm/openslice/templates/cridge.yaml +++ b/kubernetes/helm/openslice/templates/cridge.yaml @@ -1,3 +1,4 @@ +{{ if .Values.cridge.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -9,9 +10,7 @@ metadata: {{- include "openslice.labels" . | nindent 4 }} name: {{ include "openslice.fullname" . }}-cridge spec: - {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} - {{- end }} selector: matchLabels: app: {{ include "openslice.fullname" . }} @@ -24,10 +23,6 @@ spec: org.etsi.osl.service: cridge {{- include "openslice.selectorLabels" . | nindent 8 }} spec: - initContainers: - - name: init-osscapi - image: busybox:1.28 - command: ['sh', '-c', "until nslookup {{ include "openslice.fullname" . }}-osscapi; do echo waiting for osscapi; sleep 2; done"] containers: - image: "{{ .Values.image.cridge.repository }}:{{ .Values.image.cridge.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.cridge.pullPolicy | default "Always" }} @@ -45,11 +40,12 @@ spec: resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - - name: cridge-kubeconfig + - name: kubeconfig readOnly: true mountPath: /root/.kube restartPolicy: Always volumes: - - name: cridge-kubeconfig - configMap: - name: {{ include "openslice.fullname" . }}-cridge-kubeconfig + - name: kubeconfig + secret: + secretName: {{ include "openslice.fullname" . }}-kubeconfig +{{- end }} diff --git a/kubernetes/helm/openslice/values.yaml b/kubernetes/helm/openslice/values.yaml index 178451e9bf9af6231313f43cb071fdc85270a89a..7af2383c8b566ddddf9e7f9de44b7356ca736aed 100644 --- a/kubernetes/helm/openslice/values.yaml +++ b/kubernetes/helm/openslice/values.yaml @@ -112,9 +112,13 @@ mysql: storage: 10Gi cridge: + enabled: true logLevel: INFO spring: loglevel: INFO + kubeconfig: + base64: "" # Provide base64-encoded kubeconfig here if available + raw: "" # Provide raw kubeconfig here if available portalapi: logLevel: INFO