From 856fce1c3b3e1441058e0db89a5b3d7a13202a02 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Sat, 21 Nov 2020 22:48:15 +0100 Subject: [PATCH] [APPC] Uses new tpls for repos / images This commit makes APPC 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 Change-Id: I31178186d08926ae708261e84debb5bf49562b7a --- kubernetes/appc/Makefile | 51 ++++++++++++++++++++++ kubernetes/appc/components/Makefile | 51 ++++++++++++++++++++++ .../appc-ansible-server/.helmignore | 0 .../appc-ansible-server/Chart.yaml | 0 .../appc-ansible-server/requirements.yaml | 3 ++ .../resources/config/RestServer_config | 0 .../appc-ansible-server/templates/configmap.yaml | 0 .../appc-ansible-server/templates/pv.yaml | 0 .../appc-ansible-server/templates/service.yaml | 0 .../appc-ansible-server/templates/statefulset.yaml | 4 +- .../appc-ansible-server/values.yaml | 5 +-- .../{charts => components}/appc-cdt/.helmignore | 0 .../{charts => components}/appc-cdt/Chart.yaml | 0 .../appc-cdt/requirements.yaml | 3 ++ .../appc-cdt/templates/NOTES.txt | 0 .../appc-cdt/templates/deployment.yaml | 2 +- .../appc-cdt/templates/ingress.yaml | 0 .../appc-cdt/templates/service.yaml | 0 .../{charts => components}/appc-cdt/values.yaml | 1 - kubernetes/appc/requirements.yaml | 11 +++++ kubernetes/appc/templates/statefulset.yaml | 8 ++-- kubernetes/appc/values.yaml | 10 ++--- 22 files changed, 131 insertions(+), 18 deletions(-) create mode 100644 kubernetes/appc/Makefile create mode 100644 kubernetes/appc/components/Makefile rename kubernetes/appc/{charts => components}/appc-ansible-server/.helmignore (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/Chart.yaml (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/requirements.yaml (89%) rename kubernetes/appc/{charts => components}/appc-ansible-server/resources/config/RestServer_config (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/templates/configmap.yaml (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/templates/pv.yaml (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/templates/service.yaml (100%) rename kubernetes/appc/{charts => components}/appc-ansible-server/templates/statefulset.yaml (96%) rename kubernetes/appc/{charts => components}/appc-ansible-server/values.yaml (94%) rename kubernetes/appc/{charts => components}/appc-cdt/.helmignore (100%) rename kubernetes/appc/{charts => components}/appc-cdt/Chart.yaml (100%) rename kubernetes/appc/{charts => components}/appc-cdt/requirements.yaml (90%) rename kubernetes/appc/{charts => components}/appc-cdt/templates/NOTES.txt (100%) rename kubernetes/appc/{charts => components}/appc-cdt/templates/deployment.yaml (97%) rename kubernetes/appc/{charts => components}/appc-cdt/templates/ingress.yaml (100%) rename kubernetes/appc/{charts => components}/appc-cdt/templates/service.yaml (100%) rename kubernetes/appc/{charts => components}/appc-cdt/values.yaml (98%) diff --git a/kubernetes/appc/Makefile b/kubernetes/appc/Makefile new file mode 100644 index 0000000000..4c79718d02 --- /dev/null +++ b/kubernetes/appc/Makefile @@ -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 := 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 + +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) +%: + @: diff --git a/kubernetes/appc/components/Makefile b/kubernetes/appc/components/Makefile new file mode 100644 index 0000000000..f2e7a1fb82 --- /dev/null +++ b/kubernetes/appc/components/Makefile @@ -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 := soHelpers +HELM_BIN := helm +HELM_CHARTS := soHelpers $(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) +%: + @: diff --git a/kubernetes/appc/charts/appc-ansible-server/.helmignore b/kubernetes/appc/components/appc-ansible-server/.helmignore similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/.helmignore rename to kubernetes/appc/components/appc-ansible-server/.helmignore diff --git a/kubernetes/appc/charts/appc-ansible-server/Chart.yaml b/kubernetes/appc/components/appc-ansible-server/Chart.yaml similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/Chart.yaml rename to kubernetes/appc/components/appc-ansible-server/Chart.yaml diff --git a/kubernetes/appc/charts/appc-ansible-server/requirements.yaml b/kubernetes/appc/components/appc-ansible-server/requirements.yaml similarity index 89% rename from kubernetes/appc/charts/appc-ansible-server/requirements.yaml rename to kubernetes/appc/components/appc-ansible-server/requirements.yaml index 33afc43aa5..2fa99a9484 100644 --- a/kubernetes/appc/charts/appc-ansible-server/requirements.yaml +++ b/kubernetes/appc/components/appc-ansible-server/requirements.yaml @@ -16,3 +16,6 @@ dependencies: - name: common version: ~6.x-0 repository: '@local' + - name: repositoryGenerator + version: ~6.x-0 + repository: '@local' diff --git a/kubernetes/appc/charts/appc-ansible-server/resources/config/RestServer_config b/kubernetes/appc/components/appc-ansible-server/resources/config/RestServer_config similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/resources/config/RestServer_config rename to kubernetes/appc/components/appc-ansible-server/resources/config/RestServer_config diff --git a/kubernetes/appc/charts/appc-ansible-server/templates/configmap.yaml b/kubernetes/appc/components/appc-ansible-server/templates/configmap.yaml similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/templates/configmap.yaml rename to kubernetes/appc/components/appc-ansible-server/templates/configmap.yaml diff --git a/kubernetes/appc/charts/appc-ansible-server/templates/pv.yaml b/kubernetes/appc/components/appc-ansible-server/templates/pv.yaml similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/templates/pv.yaml rename to kubernetes/appc/components/appc-ansible-server/templates/pv.yaml diff --git a/kubernetes/appc/charts/appc-ansible-server/templates/service.yaml b/kubernetes/appc/components/appc-ansible-server/templates/service.yaml similarity index 100% rename from kubernetes/appc/charts/appc-ansible-server/templates/service.yaml rename to kubernetes/appc/components/appc-ansible-server/templates/service.yaml diff --git a/kubernetes/appc/charts/appc-ansible-server/templates/statefulset.yaml b/kubernetes/appc/components/appc-ansible-server/templates/statefulset.yaml similarity index 96% rename from kubernetes/appc/charts/appc-ansible-server/templates/statefulset.yaml rename to kubernetes/appc/components/appc-ansible-server/templates/statefulset.yaml index 537703d21c..0e9e60ab5f 100644 --- a/kubernetes/appc/charts/appc-ansible-server/templates/statefulset.yaml +++ b/kubernetes/appc/components/appc-ansible-server/templates/statefulset.yaml @@ -38,7 +38,7 @@ spec: spec: initContainers: - name: {{ include "common.name" . }}-chown - image: "busybox" + image: {{ include "repositoryGenerator.image.busybox" . }} command: ["sh", "-c", "chown -R {{ .Values.config.ansibleUid }}:{{ .Values.config.ansibleGid}} {{ .Values.persistence.playbookPath }}"] volumeMounts: - mountPath: {{ .Values.persistence.playbookPath }} @@ -47,7 +47,7 @@ spec: - name: {{ include "common.name" . }} command: ["/bin/bash"] args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"] - image: "{{ include "common.repository" . }}/{{ .Values.image }}" + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} ports: - containerPort: {{ .Values.service.internalPort }} diff --git a/kubernetes/appc/charts/appc-ansible-server/values.yaml b/kubernetes/appc/components/appc-ansible-server/values.yaml similarity index 94% rename from kubernetes/appc/charts/appc-ansible-server/values.yaml rename to kubernetes/appc/components/appc-ansible-server/values.yaml index 474c5973ec..1588bc52d6 100644 --- a/kubernetes/appc/charts/appc-ansible-server/values.yaml +++ b/kubernetes/appc/components/appc-ansible-server/values.yaml @@ -17,9 +17,7 @@ ################################################################# global: nodePortPrefix: 302 - readinessImage: onap/oom/readiness:3.0.1 - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 + persistence: {} ################################################################# # Application configuration defaults. @@ -27,7 +25,6 @@ global: flavor: small # application image -repository: nexus3.onap.org:10001 image: onap/ccsdk-ansible-server-image:0.4.4 pullPolicy: Always diff --git a/kubernetes/appc/charts/appc-cdt/.helmignore b/kubernetes/appc/components/appc-cdt/.helmignore similarity index 100% rename from kubernetes/appc/charts/appc-cdt/.helmignore rename to kubernetes/appc/components/appc-cdt/.helmignore diff --git a/kubernetes/appc/charts/appc-cdt/Chart.yaml b/kubernetes/appc/components/appc-cdt/Chart.yaml similarity index 100% rename from kubernetes/appc/charts/appc-cdt/Chart.yaml rename to kubernetes/appc/components/appc-cdt/Chart.yaml diff --git a/kubernetes/appc/charts/appc-cdt/requirements.yaml b/kubernetes/appc/components/appc-cdt/requirements.yaml similarity index 90% rename from kubernetes/appc/charts/appc-cdt/requirements.yaml rename to kubernetes/appc/components/appc-cdt/requirements.yaml index a7089ea6b3..fa92c63e34 100644 --- a/kubernetes/appc/charts/appc-cdt/requirements.yaml +++ b/kubernetes/appc/components/appc-cdt/requirements.yaml @@ -16,3 +16,6 @@ dependencies: - name: common version: ~6.x-0 repository: '@local' + - name: repositoryGenerator + version: ~6.x-0 + repository: '@local' diff --git a/kubernetes/appc/charts/appc-cdt/templates/NOTES.txt b/kubernetes/appc/components/appc-cdt/templates/NOTES.txt similarity index 100% rename from kubernetes/appc/charts/appc-cdt/templates/NOTES.txt rename to kubernetes/appc/components/appc-cdt/templates/NOTES.txt diff --git a/kubernetes/appc/charts/appc-cdt/templates/deployment.yaml b/kubernetes/appc/components/appc-cdt/templates/deployment.yaml similarity index 97% rename from kubernetes/appc/charts/appc-cdt/templates/deployment.yaml rename to kubernetes/appc/components/appc-cdt/templates/deployment.yaml index 3ccea21cc5..ebcabf5112 100644 --- a/kubernetes/appc/charts/appc-cdt/templates/deployment.yaml +++ b/kubernetes/appc/components/appc-cdt/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: initContainers: containers: - name: {{ include "common.name" . }} - image: "{{ include "common.repository" . }}/{{ .Values.image }}" + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: - /opt/startCdt.sh diff --git a/kubernetes/appc/charts/appc-cdt/templates/ingress.yaml b/kubernetes/appc/components/appc-cdt/templates/ingress.yaml similarity index 100% rename from kubernetes/appc/charts/appc-cdt/templates/ingress.yaml rename to kubernetes/appc/components/appc-cdt/templates/ingress.yaml diff --git a/kubernetes/appc/charts/appc-cdt/templates/service.yaml b/kubernetes/appc/components/appc-cdt/templates/service.yaml similarity index 100% rename from kubernetes/appc/charts/appc-cdt/templates/service.yaml rename to kubernetes/appc/components/appc-cdt/templates/service.yaml diff --git a/kubernetes/appc/charts/appc-cdt/values.yaml b/kubernetes/appc/components/appc-cdt/values.yaml similarity index 98% rename from kubernetes/appc/charts/appc-cdt/values.yaml rename to kubernetes/appc/components/appc-cdt/values.yaml index e8508204bc..b3dab719bd 100644 --- a/kubernetes/appc/charts/appc-cdt/values.yaml +++ b/kubernetes/appc/components/appc-cdt/values.yaml @@ -25,7 +25,6 @@ global: flavor: small # application image -repository: nexus3.onap.org:10001 image: onap/appc-cdt-image:1.7.2 pullPolicy: Always diff --git a/kubernetes/appc/requirements.yaml b/kubernetes/appc/requirements.yaml index d512a7ee08..be72cc2b99 100644 --- a/kubernetes/appc/requirements.yaml +++ b/kubernetes/appc/requirements.yaml @@ -22,3 +22,14 @@ dependencies: - name: dgbuilder version: ~6.x-0 repository: '@local' + - name: repositoryGenerator + version: ~6.x-0 + repository: '@local' + - name: appc-ansible-server + version: ~6.x-0 + repository: 'file://components/appc-ansible-server' + condition: appc-ansible-server.enabled + - name: appc-cdt + version: ~6.x-0 + repository: 'file://components/appc-cdt' + condition: appc-cdt.enabled \ No newline at end of file diff --git a/kubernetes/appc/templates/statefulset.yaml b/kubernetes/appc/templates/statefulset.yaml index 5e889f1d96..208315495b 100644 --- a/kubernetes/appc/templates/statefulset.yaml +++ b/kubernetes/appc/templates/statefulset.yaml @@ -69,7 +69,7 @@ spec: name: onap-sdnc-data-properties - mountPath: /config/sdnc-svclogic-config name: onap-sdnc-svclogic-config - image: "{{ .Values.global.envsubstImage }}" + image: {{ include "repositoryGenerator.image.envsubst" . }} imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} name: {{ include "common.name" . }}-update-config @@ -85,17 +85,17 @@ 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" . }}-chown - image: "busybox" + image: {{ include "repositoryGenerator.image.busybox" . }} command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.persistence.mdsalPath }}"] volumeMounts: - mountPath: {{ .Values.persistence.mdsalPath }} name: {{ include "common.fullname" . }}-data containers: - name: {{ include "common.name" . }} - image: "{{ include "common.repository" . }}/{{ .Values.image }}" + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} command: - /opt/appc/bin/startODL.sh diff --git a/kubernetes/appc/values.yaml b/kubernetes/appc/values.yaml index 8b3ce26d52..92c9985c35 100644 --- a/kubernetes/appc/values.yaml +++ b/kubernetes/appc/values.yaml @@ -18,12 +18,7 @@ ################################################################# global: nodePortPrefix: 302 - readinessImage: onap/oom/readiness:3.0.1 centralizedLoggingEnabled: false - loggingRepository: docker.elastic.co - loggingImage: beats/filebeat:5.5.0 - # envsusbt - envsubstImage: dibi/envsubst persistence: mountPath: /dockerdata-nfs @@ -55,7 +50,6 @@ secrets: ################################################################# flavor: small # application image -repository: nexus3.onap.org:10001 image: onap/appc-image:1.7.2 pullPolicy: Always @@ -111,12 +105,16 @@ config: dmaapServicePassword: onapappc appc-ansible-server: + enabled: true service: name: appc-ansible-server internalPort: 8000 config: mysqlServiceName: appc-dbhost +appc-cdt: + enabled: true + mariadb-galera: nameOverride: appc-db config: -- 2.16.6