[ESR] Uses new tpls for repos / images 49/115249/3
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Sat, 21 Nov 2020 21:32:17 +0000 (22:32 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Mon, 23 Nov 2020 16:53:56 +0000 (17:53 +0100)
This commit makes ESR 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: Icd413c31a4f11116084d04fcf0c8984929f5f17d

21 files changed:
kubernetes/esr/Makefile [new file with mode: 0644]
kubernetes/esr/components/Makefile [new file with mode: 0644]
kubernetes/esr/components/esr-gui/.helmignore [moved from kubernetes/esr/charts/esr-gui/.helmignore with 100% similarity]
kubernetes/esr/components/esr-gui/Chart.yaml [moved from kubernetes/esr/charts/esr-gui/Chart.yaml with 100% similarity]
kubernetes/esr/components/esr-gui/requirements.yaml [moved from kubernetes/esr/charts/esr-server/requirements.yaml with 80% similarity]
kubernetes/esr/components/esr-gui/templates/NOTES.txt [moved from kubernetes/esr/charts/esr-gui/templates/NOTES.txt with 100% similarity]
kubernetes/esr/components/esr-gui/templates/deployment.yaml [moved from kubernetes/esr/charts/esr-gui/templates/deployment.yaml with 95% similarity]
kubernetes/esr/components/esr-gui/templates/service.yaml [moved from kubernetes/esr/charts/esr-gui/templates/service.yaml with 100% similarity]
kubernetes/esr/components/esr-gui/values.yaml [moved from kubernetes/esr/charts/esr-gui/values.yaml with 98% similarity]
kubernetes/esr/components/esr-server/Chart.yaml [moved from kubernetes/esr/charts/esr-server/Chart.yaml with 100% similarity]
kubernetes/esr/components/esr-server/requirements.yaml [new file with mode: 0644]
kubernetes/esr/components/esr-server/resources/config/log/filebeat/filebeat.yml [moved from kubernetes/esr/charts/esr-server/resources/config/log/filebeat/filebeat.yml with 100% similarity]
kubernetes/esr/components/esr-server/resources/config/logback.xml [moved from kubernetes/esr/charts/esr-server/resources/config/logback.xml with 100% similarity]
kubernetes/esr/components/esr-server/templates/NOTES.txt [moved from kubernetes/esr/charts/esr-server/templates/NOTES.txt with 100% similarity]
kubernetes/esr/components/esr-server/templates/configmap.yaml [moved from kubernetes/esr/charts/esr-server/templates/configmap.yaml with 100% similarity]
kubernetes/esr/components/esr-server/templates/deployment.yaml [moved from kubernetes/esr/charts/esr-server/templates/deployment.yaml with 95% similarity]
kubernetes/esr/components/esr-server/templates/service.yaml [moved from kubernetes/esr/charts/esr-server/templates/service.yaml with 100% similarity]
kubernetes/esr/components/esr-server/values.yaml [moved from kubernetes/esr/charts/esr-server/values.yaml with 94% similarity]
kubernetes/esr/requirements.yaml
kubernetes/esr/resources/config/log/esrserver/logback.xml [deleted file]
kubernetes/esr/values.yaml

diff --git a/kubernetes/esr/Makefile b/kubernetes/esr/Makefile
new file mode 100644 (file)
index 0000000..4c79718
--- /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 := 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/esr/components/Makefile b/kubernetes/esr/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)
+%:
+       @:
@@ -1,4 +1,5 @@
-# Copyright © 2018 Amdocs, Bell Canada
+# Copyright © 2017 Amdocs, Bell Canada
+# Modifications Copyright © 2018 AT&T
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,4 +19,7 @@ dependencies:
     # local reference to common chart, as it is
     # a part of this chart's package and will not
     # be published independently to a repo (at this point)
-    repository: '@local'
\ No newline at end of file
+    repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
@@ -50,7 +50,7 @@ spec:
         - /opt/tomcat
         securityContext:
           privileged: true
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: create-tomcat-dir
         volumeMounts:
@@ -59,7 +59,7 @@ spec:
 
       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 }}
similarity index 98%
rename from kubernetes/esr/charts/esr-gui/values.yaml
rename to kubernetes/esr/components/esr-gui/values.yaml
index a191739..417ace5 100644 (file)
@@ -23,7 +23,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 image: onap/aai/esr-gui:1.4.0
 pullPolicy: Always
 msbaddr: msb-iag.{{ include "common.namespace" . }}:443
diff --git a/kubernetes/esr/components/esr-server/requirements.yaml b/kubernetes/esr/components/esr-server/requirements.yaml
new file mode 100644 (file)
index 0000000..0b77abe
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright © 2017 Amdocs, Bell Canada
+# Modifications Copyright © 2018 AT&T
+#
+# 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.
+
+dependencies:
+  - name: common
+    version: ~6.x-0
+    # local reference to common chart, as it is
+    # a part of this chart's package and will not
+    # be published independently to a repo (at this point)
+    repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
@@ -50,7 +50,7 @@ spec:
         - /opt/conf
         securityContext:
           privileged: true
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: create-conf-dir
         volumeMounts:
@@ -59,7 +59,7 @@ spec:
 
       containers:
         - name: {{ .Chart.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 }}
@@ -103,7 +103,7 @@ spec:
           securityContext:
             runAsUser: 1000
             runAsGroup: 1000
-          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
 #################################################################
 global:
   nodePortPrefix: 302
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
 
 subChartsOnly:
   enabled: true
 
 # application image
-repository: nexus3.onap.org:10001
 image: onap/aai/esr-server:1.5.2
 pullPolicy: Always
 msbaddr: msb-iag.{{ include "common.namespace" . }}:443
index d3c442d..8c2a82d 100644 (file)
 # limitations under the License.
 
 dependencies:
-  - name: common
+  - name: esr-gui
     version: ~6.x-0
-    # local reference to common chart, as it is
-    # a part of this chart's package and will not
-    # be published independently to a repo (at this point)
-    repository: '@local'
+    repository: 'file://components/esr-gui'
+    condition: esr-gui.enabled
+  - name: esr-server
+    version: ~6.x-0
+    repository: 'file://components/esr-server'
diff --git a/kubernetes/esr/resources/config/log/esrserver/logback.xml b/kubernetes/esr/resources/config/log/esrserver/logback.xml
deleted file mode 100644 (file)
index b9a51f1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version = "1.0" encoding = "UTF-8" ?>
-<!--
-# Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
-#
-# 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.
--->
-
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="true" scan="true" scanPeriod="3 seconds">
-   <!--<jmxConfigurator /> -->
-   <!--  specify the base path of the log directory -->
-   <property name="logDir" value="/var/log/onap" />
-   <!--  specify the component name -->
-   <property name="componentName" value="esr" />
-   <!-- specify the sub component name -->
-   <property name="subComponentName" value="xacml-pap-rest" />
-   <!-- The directories where logs are written -->
-   <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
-   <property name="pattern" value="%d{&amp;quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&amp;quot;, UTC}\t[%thread]\t%-5level\t%logger{36}\t%replace(%replace(%replace(%mdc){'\t','\\\\t'}){', ','\t'}){'\n', '\\\\n'}\t%replace(%replace(%msg){'\n', '\\\\n'}){'\t','\\\\t'}%n" />
-   <!--  log file names -->
-   <property name="errorLogName" value="error" />
-   <property name="metricsLogName" value="metrics" />
-   <property name="auditLogName" value="audit" />
-   <property name="debugLogName" value="debug" />
-   <property name="queueSize" value="256" />
-   <property name="maxFileSize" value="50MB" />
-   <property name="maxHistory" value="30" />
-   <property name="totalSizeCap" value="10GB" />
-   <!-- Example evaluator filter applied against console appender -->
-   <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
-      <encoder>
-         <pattern>${pattern}</pattern>
-      </encoder>
-   </appender>
index bd12358..5b2f776 100644 (file)
 #################################################################
 # Global configuration defaults.
 #################################################################
-global:
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
 
 # application configuration
 config:
   logstashServiceName: log-ls
-  logstashPort: 5044
\ No newline at end of file
+  logstashPort: 5044
+
+esr-gui:
+  enabled: true
\ No newline at end of file