[MODELING] Uses new tpls for repos / images 50/115250/3
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Sat, 21 Nov 2020 21:35:45 +0000 (22:35 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 23 Nov 2020 17:00:00 +0000 (18:00 +0100)
This commit makes Modeling chart to use the new generator for repositories and
images.
As new templates doesn't work well with "sub charts", we move also
subcharts to components folder.

Issue-ID: OOM-2364
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I64030918eb794a9a710b8286b9608aec02eabd1e

16 files changed:
kubernetes/modeling/Makefile
kubernetes/modeling/charts/modeling-etsicatalog/templates/configmap.yaml [deleted file]
kubernetes/modeling/components/Makefile [new file with mode: 0644]
kubernetes/modeling/components/modeling-etsicatalog/.helmignore [moved from kubernetes/modeling/charts/modeling-etsicatalog/.helmignore with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/Chart.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/Chart.yaml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/requirements.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/requirements.yaml with 92% similarity]
kubernetes/modeling/components/modeling-etsicatalog/resources/config/logging/filebeat/filebeat.yml [moved from kubernetes/modeling/resources/config/logging/filebeat/filebeat.yml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/resources/config/logging/server/log.yml [moved from kubernetes/modeling/charts/modeling-etsicatalog/resources/config/logging/log.yml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/configmap.yaml [moved from kubernetes/modeling/templates/configmap.yaml with 69% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/deployment.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/templates/deployment.yaml with 94% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/pv.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/templates/pv.yaml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/pvc.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/templates/pvc.yaml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/secrets.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/templates/secrets.yaml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/templates/service.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/templates/service.yaml with 100% similarity]
kubernetes/modeling/components/modeling-etsicatalog/values.yaml [moved from kubernetes/modeling/charts/modeling-etsicatalog/values.yaml with 96% similarity]
kubernetes/modeling/requirements.yaml

index 94a9462..4c79718 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2020 Samsung Electrinics
+# Copyright © 2020 Samsung Electronics
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+OUTPUT_DIR := $(ROOT_DIR)/../dist
+PACKAGE_DIR := $(OUTPUT_DIR)/packages
+SECRET_DIR := $(OUTPUT_DIR)/secrets
+
+EXCLUDES := dist resources templates charts docker
 HELM_BIN := helm
+HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+
+.PHONY: $(EXCLUDES) $(HELM_CHARTS)
+
+all: $(HELM_CHARTS)
+
+$(HELM_CHARTS):
+       @echo "\n[$@]"
+       @make package-$@
+
+make-%:
+       @if [ -f $*/Makefile ]; then make -C $*; fi
+
+dep-%: make-%
+       @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi
+
+lint-%: dep-%
+       @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) lint $*; fi
 
-make-modeling: make-modeling-etsicatalog
+package-%: lint-%
+       @mkdir -p $(PACKAGE_DIR)
+       @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi
+       @$(HELM_BIN) repo index $(PACKAGE_DIR)
 
-make-modeling-etsicatalog:
-       cd charts && $(HELM_BIN) dep up modeling-etsicatalog && $(HELM_BIN) lint modeling-etsicatalog
 clean:
-       @find . -type f -name '*.tgz' -delete
-       @find . -type f -name '*.lock' -delete
+       @rm -f */requirements.lock
+       @rm -f *tgz */charts/*tgz
+       @rm -rf $(PACKAGE_DIR)
+%:
+       @:
diff --git a/kubernetes/modeling/charts/modeling-etsicatalog/templates/configmap.yaml b/kubernetes/modeling/charts/modeling-etsicatalog/templates/configmap.yaml
deleted file mode 100644 (file)
index c9ef0f0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "common.fullname" . }}-logging-configmap
-  namespace: {{ include "common.namespace" . }}
-data:
-{{ tpl (.Files.Glob "resources/config/logging/*").AsConfig . | indent 2 }}
diff --git a/kubernetes/modeling/components/Makefile b/kubernetes/modeling/components/Makefile
new file mode 100644 (file)
index 0000000..bf267b7
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright © 2020 Samsung Electronics
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+OUTPUT_DIR := $(ROOT_DIR)/../../dist
+PACKAGE_DIR := $(OUTPUT_DIR)/packages
+SECRET_DIR := $(OUTPUT_DIR)/secrets
+
+EXCLUDES :=
+HELM_BIN := helm
+HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+
+.PHONY: $(EXCLUDES) $(HELM_CHARTS)
+
+all: $(HELM_CHARTS)
+
+$(HELM_CHARTS):
+       @echo "\n[$@]"
+       @make package-$@
+
+make-%:
+       @if [ -f $*/Makefile ]; then make -C $*; fi
+
+dep-%: make-%
+       @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi
+
+lint-%: dep-%
+       @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) lint $*; fi
+
+package-%: lint-%
+       @mkdir -p $(PACKAGE_DIR)
+       @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi
+       @$(HELM_BIN) repo index $(PACKAGE_DIR)
+
+clean:
+       @rm -f */requirements.lock
+       @rm -f *tgz */charts/*tgz
+       @rm -rf $(PACKAGE_DIR)
+%:
+       @:
@@ -27,3 +27,6 @@ dependencies:
   - name: readinessCheck
     version: ~6.x-0
     repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ include "common.release" . }}-modeling-filebeat-configmap
+  name: {{ include "common.fullname" . }}-logging-configmap
   namespace: {{ include "common.namespace" . }}
 data:
-{{ tpl (.Files.Glob "resources/config/logging/filebeat/*").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/logging/server/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-modeling-filebeat-configmap
+  namespace: {{ include "common.namespace" . }}
+data:
+{{ tpl (.Files.Glob "resources/config/logging/filebeat/*").AsConfig . | indent 2 }}
\ No newline at end of file
@@ -49,7 +49,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-job-readiness
       {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for.msb ) | indent 6 | trim }}
@@ -57,7 +57,7 @@ spec:
         - /bin/sh
         - -c
         - chown -R 1000:1000 /service/modeling/etsicatalog/static
-        image: "{{ include "common.repository" . }}/{{ .Values.initImage }}"
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-init
         volumeMounts:
@@ -65,7 +65,7 @@ spec:
           mountPath: /service/modeling/etsicatalog/static
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           ports:
           - containerPort: {{ .Values.service.internalPort }}
@@ -128,7 +128,7 @@ spec:
 
         # side car containers
         - name: {{ include "common.name" . }}-filebeat-onap
-          image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
+          image: {{ include "repositoryGenerator.image.logging" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           volumeMounts:
           - name: {{ include "common.fullname" . }}-filebeat-conf
@@ -158,7 +158,7 @@ spec:
 
         - name: {{ include "common.fullname" . }}-filebeat-conf
           configMap:
-            name: {{ include "common.release" . }}-modeling-filebeat-configmap
+            name: {{ include "common.fullname" . }}-modeling-filebeat-configmap
         - name: {{ include "common.fullname" . }}-data-filebeat
           emptyDir: {}
       imagePullSecrets:
@@ -17,9 +17,6 @@
 #################################################################
 global:
   nodePortPrefix: 302
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
 
   persistence:
     mountPath: /dockerdata-nfs
@@ -100,9 +97,7 @@ config:
 # application image
 flavor: small
 
-repository: nexus3.onap.org:10001
 image: onap/modeling/etsicatalog:1.0.9
-initImage: busybox:latest
 pullPolicy: Always
 
 #Istio sidecar injection policy
index f994771..ada1ded 100644 (file)
@@ -13,6 +13,6 @@
 # limitations under the License.
 
 dependencies:
-  - name: common
+  - name: modeling-etsicatalog
     version: ~6.x-0
-    repository: '@local'
+    repository: 'file://components/modeling-etsicatalog'