Improve oran_oom helm charts
[it/dep.git] / smo-install / oran_oom / dmaapmediatorservice / templates / _helpers.tpl
@@ -1,5 +1,6 @@
+{{/*
 ################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
+#   Copyright (c) 2024 NYCU WINLab.                                            #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
+*/}}
 
-{{- define "common.name.a1simulator" -}}
-  {{- printf "a1simulator" -}}
+{{- define "dmaapTopic.initContainer" -}}
+- name: dmaap-topic-init
+  image: alpine:3.19.1
+  command:
+  - sh
+  - -c
+  - apk add --no-cache curl jq; sh /app/dmaap-topic-init.sh;
+  volumeMounts:
+  - name: dmaap-topic-init
+    mountPath: /app
 {{- end -}}
 
-{{- define "common.fullname.a1simulator" -}}
-  {{- $name := ( include "common.name.a1simulator" . ) -}}
-  {{- $namespace := ( include "common.namespace.nonrtric" . ) -}}
-  {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
+{{- define "dmaapTopic.initConfigMap" -}}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.name" . }}-dmaap-topic-init
+  namespace: {{ include "common.namespace" . }}
+  labels: {{- include "common.labels" . | nindent 4 }}
+data:
+  dmaap-topic-init.sh: |
+    {{- tpl (.Files.Get "resources/dmaap-topic-init.sh") . | nindent 4 }}
+{{- end }}
 
-{{- define "common.containername.a1simulator" -}}
-  {{- $name := ( include "common.fullname.a1simulator" . ) -}}
-  {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}}
-{{- end -}}
+{{- define "dmaapTopic.initVolume" -}}
+- name: dmaap-topic-init
+  configMap:
+    name: {{ include "common.name" . }}-dmaap-topic-init
+{{- end }}