aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2022-08-30 22:29:55 +0100
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2022-09-06 14:38:24 +0000
commitb7642e059a8edb000cadc7f0d8836e0411a24961 (patch)
treedef53a40aaf14e4b3055e997240bba884dbe4976
parent10bdfd8dc0a5870196a18a9be441b22d02b598c0 (diff)
Add helm chart for test ACM element microservice
Adding helm chart for the ac element microservice under the examples directory for testing ACM workflow. This helm chart can be uploaded to a local helm repository and deployed using kubernetes participant in ACM. The input configuration is provided in the Tosca service template for ACM. Issue-ID: POLICY-4306 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I6ac702f67cad6a8dbd04c626a5af91aa0bd00a58
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/Chart.yaml25
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/resources/config/application.yaml21
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/_helpers.tpl62
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/configmap.yaml26
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/deployment.yaml71
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/service.yaml36
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/serviceaccount.yaml32
-rw-r--r--examples/src/main/resources/clamp/acm/acelement-helm/acelement/values.yaml51
8 files changed, 324 insertions, 0 deletions
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/Chart.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/Chart.yaml
new file mode 100644
index 000000000..3b0b0c3f7
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/Chart.yaml
@@ -0,0 +1,25 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+
+apiVersion: v2
+name: acelement
+description: AC Element helm chart for testing ACM workflow.
+type: application
+version: 0.1.0
+appVersion: "1.0"
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/resources/config/application.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/resources/config/application.yaml
new file mode 100644
index 000000000..98d3b6461
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/resources/config/application.yaml
@@ -0,0 +1,21 @@
+spring:
+ security:
+ user:
+ name: ${REST_USER}
+ password: ${REST_PASSWORD}
+
+server:
+ port: ${PORT}
+ error:
+ path: /error
+
+element:
+ elementId:
+ name: ${ELEMENT_ID}
+ version: ${ELEMENT_VERSION}
+management:
+ endpoints:
+ web:
+ base-path: /
+ exposure:
+ include: health, metrics, prometheus
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/_helpers.tpl b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/_helpers.tpl
new file mode 100644
index 000000000..ff3be7fac
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/_helpers.tpl
@@ -0,0 +1,62 @@
+{{- /*
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+*/ -}}
+
+{{- define "acelement.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{- define "acelement.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{- define "acelement.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{- define "acelement.labels" -}}
+helm.sh/chart: {{ include "acelement.chart" . }}
+{{ include "acelement.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{- define "acelement.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "acelement.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{- define "acelement.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "acelement.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/configmap.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/configmap.yaml
new file mode 100644
index 000000000..30defeac4
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/configmap.yaml
@@ -0,0 +1,26 @@
+{{- /*
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "acelement.fullname" . }}-configmap
+data:
+{{ tpl (.Files.Glob "resources/config/*.{xml,yaml}").AsConfig . | indent 2 }}
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/deployment.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/deployment.yaml
new file mode 100644
index 000000000..c0f024c77
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/deployment.yaml
@@ -0,0 +1,71 @@
+{{- /*
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+*/ -}}
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "acelement.fullname" . }}
+ labels:
+ {{- include "acelement.labels" . | nindent 4 }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ {{- include "acelement.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ {{- include "acelement.selectorLabels" . | nindent 8 }}
+ spec:
+ serviceAccountName: {{ include "acelement.fullname" . }}-{{ include "acelement.serviceAccountName" . }}
+ containers:
+ - name: {{ .Chart.Name }}
+ securityContext:
+ {{- toYaml .Values.securityContext | nindent 12 }}
+ image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ resources:
+ {{- toYaml .Values.resources | nindent 12 }}
+ env:
+ - name: REST_USER
+ value: {{ .Values.acelement.rest.user | quote }}
+ - name: REST_PASSWORD
+ value: {{ .Values.acelement.rest.password | quote }}
+ - name: PORT
+ value: {{ .Values.acelement.rest.port | quote }}
+ - name: ELEMENT_ID
+ value: {{ .Values.acelement.elementId.name | quote }}
+ - name: ELEMENT_VERSION
+ value: {{ .Values.acelement.elementId.version | quote }}
+
+ ports:
+ - containerPort: {{ .Values.acelement.rest.port }}
+
+ volumeMounts:
+ - mountPath: /opt/app/policy/clamp/etc/mounted/
+ name: {{ include "acelement.fullname" . }}-volume
+ command: ["/opt/app/policy/clamp/bin/element-participant.sh"]
+ args: ["/opt/app/policy/clamp/etc/mounted/application.yaml"]
+
+ volumes:
+ - name: {{ include "acelement.fullname" . }}-volume
+ configMap:
+ name: {{ include "acelement.fullname" . }}-configmap
+ defaultMode: 0755
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/service.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/service.yaml
new file mode 100644
index 000000000..a02ab0771
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/service.yaml
@@ -0,0 +1,36 @@
+{{- /*
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+*/ -}}
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "acelement.fullname" . }}
+ labels:
+ {{- include "acelement.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.service.type }}
+ ports:
+ - port: {{ .Values.service.port }}
+ nodePort: {{ .Values.service.nodeport }}
+ targetPort: {{ .Values.acelement.rest.port }}
+ protocol: TCP
+ name: http
+ selector:
+ {{- include "acelement.selectorLabels" . | nindent 4 }}
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/serviceaccount.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/serviceaccount.yaml
new file mode 100644
index 000000000..b2159d687
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/templates/serviceaccount.yaml
@@ -0,0 +1,32 @@
+{{- /*
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+*/ -}}
+
+{{- if .Values.serviceAccount.create -}}
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ include "acelement.fullname" . }}-{{ include "acelement.serviceAccountName" . }}
+ labels:
+ {{- include "acelement.labels" . | nindent 4 }}
+ {{- with .Values.serviceAccount.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+{{- end }}
diff --git a/examples/src/main/resources/clamp/acm/acelement-helm/acelement/values.yaml b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/values.yaml
new file mode 100644
index 000000000..a9b9f227f
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/acelement-helm/acelement/values.yaml
@@ -0,0 +1,51 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 Nordix Foundation.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# Default values for acelement.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+image:
+ repository: nexus3.onap.org:10001
+ name: onap/policy-clamp-acm-element-impl
+ pullPolicy: IfNotPresent
+ tag: "6.3.0-SNAPSHOT"
+
+nameOverride: "ac-element-impl"
+
+serviceAccount:
+ create: true
+ name: "sa"
+
+service:
+ type: NodePort
+ port: 8084
+ nodeport: 31800
+ name: ac-element
+
+# Application properties
+acelement:
+ elementId:
+ name: "ac-starter"
+ version: "1.0.0"
+ rest:
+ user: "acmUser"
+ password: "zb!XztG34"
+ port: "8085"