From 1aa628c9494e0bdef7cdf3fd374520f91d86adb7 Mon Sep 17 00:00:00 2001 From: Kiran Kamineni Date: Fri, 25 Jan 2019 12:32:55 -0800 Subject: Add test helm chart for testing Add a test helm chart for testing the end to end flow. This chart brings up a service and a deployment. The deployment brings up two containers, vault and consul. Vault and Consul are brought up in dev mode. The helm chart also has a subchart, common, which contains templates that are used within the main chart. Added an override deployment.yaml which creates only one container instead of two Fixed plugin.sh and tar file creation steps Issue-ID: MULTICLOUD-291 Change-Id: I7eb10c9f43f8a4e09938139b5e2edee5d59feb3b Signed-off-by: Kiran Kamineni Signed-off-by: Victor Morales --- vagrant/tests/_common.sh | 22 ++++++ vagrant/tests/_functions.sh | 8 ++ vagrant/tests/plugin.sh | 82 +++++++++++++++++--- .../tests/vnfs/testrb/helm/profile/manifest.yaml | 7 ++ .../vnfs/testrb/helm/profile/override_values.yaml | 7 ++ .../helm/profile/testfol/subdir/deployment.yaml | 51 ++++++++++++ .../vnfs/testrb/helm/vault-consul-dev/Chart.yaml | 19 +++++ .../helm/vault-consul-dev/charts/common/Chart.yaml | 18 +++++ .../charts/common/templates/_name.tpl | 31 ++++++++ .../charts/common/templates/_namespace.tpl | 26 +++++++ .../charts/common/templates/_repository.tpl | 48 ++++++++++++ .../charts/common/templates/_service.tpl | 31 ++++++++ .../vault-consul-dev/charts/common/values.yaml | 44 +++++++++++ .../vault-consul-dev/templates/deployment.yaml | 62 +++++++++++++++ .../helm/vault-consul-dev/templates/service.yaml | 39 ++++++++++ .../vnfs/testrb/helm/vault-consul-dev/values.yaml | 90 ++++++++++++++++++++++ 16 files changed, 576 insertions(+), 9 deletions(-) create mode 100644 vagrant/tests/vnfs/testrb/helm/profile/manifest.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/profile/override_values.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/profile/testfol/subdir/deployment.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/Chart.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/Chart.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_name.tpl create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_namespace.tpl create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_repository.tpl create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_service.tpl create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/values.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/deployment.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/service.yaml create mode 100644 vagrant/tests/vnfs/testrb/helm/vault-consul-dev/values.yaml diff --git a/vagrant/tests/_common.sh b/vagrant/tests/_common.sh index 620c00af..c5cdcd3e 100755 --- a/vagrant/tests/_common.sh +++ b/vagrant/tests/_common.sh @@ -26,6 +26,11 @@ onap_private_net=onap-private-net unprotected_private_net=unprotected-private-net protected_private_net=protected-private-net ovn_multus_network_name=ovn-networkobj +rbd_metadata=rbd_metatada.json +rbd_content_tarball=vault-consul-dev.tar +rbp_metadata=rbp_metatada.json +rbp_instance=rbp_instance.json +rbp_content_tarball=profile.tar # vFirewall vars demo_artifacts_version=1.3.0 @@ -1094,3 +1099,20 @@ spec: DEPLOYMENT popd } + +# populate_CSAR_rbdefinition() - Function that populates CSAR folder +# for testing resource bundle definition +function populate_CSAR_rbdefinition { + local csar_id=$1 + + _checks_args $csar_id + pushd ${CSAR_DIR}/${csar_id} + print_msg "Create Helm Chart Archives" + rm -f ${rbd_content_tarball}.gz + rm -f ${rbp_content_tarball}.gz + tar -cf $rbd_content_tarball -C $test_folder/vnfs/testrb/helm vault-consul-dev + tar -cf $rbp_content_tarball -C $test_folder/vnfs/testrb/helm/profile . + gzip $rbp_content_tarball + gzip $rbd_content_tarball + popd +} diff --git a/vagrant/tests/_functions.sh b/vagrant/tests/_functions.sh index fe69b07b..62feb7b7 100755 --- a/vagrant/tests/_functions.sh +++ b/vagrant/tests/_functions.sh @@ -12,6 +12,14 @@ set -o errexit set -o nounset set -o pipefail +function print_msg { + local msg=$1 + local RED='\033[0;31m' + local NC='\033[0m' + + echo -e "${RED} $msg ---------------------------------------${NC}" +} + function _get_ovn_central_address { ansible_ifconfig=$(ansible ovn-central[0] -i $test_folder/../inventory/hosts.ini -m shell -a "ifconfig eth1 |grep \"inet addr\" |awk '{print \$2}' |awk -F: '{print \$2}'") if [[ $ansible_ifconfig != *CHANGED* ]]; then diff --git a/vagrant/tests/plugin.sh b/vagrant/tests/plugin.sh index 55be1686..2ed37b18 100755 --- a/vagrant/tests/plugin.sh +++ b/vagrant/tests/plugin.sh @@ -16,10 +16,13 @@ set -o pipefail source _common.sh source _functions.sh -base_url="http://localhost:8081/v1/vnf_instances/" +base_url="http://localhost:8081" cloud_region_id="krd" namespace="default" csar_id="94e414f6-9ca4-11e8-bb6a-52540067263b" +rbd_csar_id="7eb09e38-4363-9942-1234-3beb2e95fd85" +definition_id="9d117af8-30b8-11e9-af94-525400277b3d" +profile_id="ebe353d2-30b7-11e9-9515-525400277b3d" # _build_generic_sim() - Creates a generic simulator image in case that doesn't exist function _build_generic_sim { @@ -55,8 +58,59 @@ destroy_deployment $plugin_deployment_name #start_aai_service populate_CSAR_plugin $csar_id +populate_CSAR_rbdefinition $rbd_csar_id # Test +print_msg "Create Resource Bundle Definition Metadata" +payload_raw=" +{ + \"name\": \"test-rbdef\", + \"chart-name\": \"vault-consul-dev\", + \"description\": \"testing resource bundle definition api\", + \"uuid\": \"$definition_id\", + \"service-type\": \"firewall\" +} +" +payload=$(echo $payload_raw | tr '\n' ' ') +rbd_id=$(curl -s -d "$payload" -X POST "${base_url}/v1/rb/definition" | jq -r '.uuid') + +print_msg "Upload Resource Bundle Definition Content" +curl -s --data-binary @${CSAR_DIR}/${rbd_csar_id}/${rbd_content_tarball}.gz -X POST "${base_url}/v1/rb/definition/$rbd_id/content" + +print_msg "Listing Resource Bundle Definitions" +rbd_id_list=$(curl -s -X GET "${base_url}/v1/rb/definition") +if [[ "$rbd_id_list" != *"${rbd_id}"* ]]; then + echo $rbd_id_list + echo "Resource Bundle Definition not stored" + exit 1 +fi + +print_msg "Create Resource Bundle Profile Metadata" +kubeversion=$(kubectl version | grep 'Server Version' | awk -F '"' '{print $6}') +payload_raw=" +{ + \"name\": \"test-rbprofile\", + \"namespace\": \"$namespace\", + \"rbdid\": \"$definition_id\", + \"uuid\": \"$profile_id\", + \"kubernetesversion\": \"$kubeversion\" +} +" +payload=$(echo $payload_raw | tr '\n' ' ') +rbp_id=$(curl -s -d "$payload" -X POST "${base_url}/v1/rb/profile" | jq -r '.uuid') + +print_msg "Upload Resource Bundle Profile Content" +curl -s --data-binary @${CSAR_DIR}/${rbd_csar_id}/${rbp_content_tarball}.gz -X POST "${base_url}/v1/rb/profile/$rbp_id/content" + +print_msg "Listing Resource Bundle Profiles" +rbp_id_list=$(curl -s -X GET "${base_url}/v1/rb/profile") +if [[ "$rbp_id_list" != *"${rbp_id}"* ]]; then + echo $rbd_id_list + echo "Resource Bundle Profile not stored" + exit 1 +fi + +print_msg "Instantiate Profile" payload_raw=" { \"cloud_region_id\": \"$cloud_region_id\", @@ -65,30 +119,40 @@ payload_raw=" } " payload=$(echo $payload_raw | tr '\n' ' ') -echo "Creating VNF Instance" -vnf_id=$(curl -s -d "$payload" "${base_url}" | jq -r '.vnf_id') -echo "=== Validating Kubernetes ===" +vnf_id=$(curl -s -d "$payload" "${base_url}/v1/vnf_instances/" | jq -r '.vnf_id') + +print_msg "Validating Kubernetes" kubectl get --no-headers=true --namespace=${namespace} deployment ${cloud_region_id}-${namespace}-${vnf_id}-${plugin_deployment_name} kubectl get --no-headers=true --namespace=${namespace} service ${cloud_region_id}-${namespace}-${vnf_id}-${plugin_service_name} echo "VNF Instance created succesfully with id: $vnf_id" -vnf_id_list=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list') +print_msg "Listing VNF Instances" +vnf_id_list=$(curl -s -X GET "${base_url}/v1/vnf_instances/${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list') if [[ "$vnf_id_list" != *"${vnf_id}"* ]]; then echo $vnf_id_list echo "VNF Instance not stored" exit 1 fi -vnf_details=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") +print_msg "Getting $vnf_id VNF Instance information" +vnf_details=$(curl -s -X GET "${base_url}/v1/vnf_instances/${cloud_region_id}/${namespace}/${vnf_id}") if [[ -z "$vnf_details" ]]; then echo "Cannot retrieved VNF Instance details" exit 1 fi echo "VNF details $vnf_details" -echo "Deleting $vnf_id VNF Instance" -curl -X DELETE "${base_url}${cloud_region_id}/${namespace}/${vnf_id}" -if [[ 200 -eq $(curl -o /dev/null -w %{http_code} -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") ]]; then +print_msg "Deleting $rbd_id Resource Bundle Definition" +curl -X DELETE "${base_url}/v1/rb/definition/$rbd_id" +if [[ 500 -ne $(curl -o /dev/null -w %{http_code} -s -X GET "${base_url}/v1/rb/definition/$rbd_id") ]]; then + echo "Resource Bundle Definition not deleted" +# TODO: Change the HTTP code for 404 when the resource is not found in the API + exit 1 +fi + +print_msg "Deleting $vnf_id VNF Instance" +curl -X DELETE "${base_url}/v1/vnf_instances/${cloud_region_id}/${namespace}/${vnf_id}" +if [[ 404 -ne $(curl -o /dev/null -w %{http_code} -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") ]]; then echo "VNF Instance not deleted" exit 1 fi diff --git a/vagrant/tests/vnfs/testrb/helm/profile/manifest.yaml b/vagrant/tests/vnfs/testrb/helm/profile/manifest.yaml new file mode 100644 index 00000000..ef260633 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/profile/manifest.yaml @@ -0,0 +1,7 @@ +--- +version: v1 +type: + values: "override_values.yaml" + configresource: + - filepath: testfol/subdir/deployment.yaml + chartpath: vault-consul-dev/templates/deployment.yaml diff --git a/vagrant/tests/vnfs/testrb/helm/profile/override_values.yaml b/vagrant/tests/vnfs/testrb/helm/profile/override_values.yaml new file mode 100644 index 00000000..c9f29a31 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/profile/override_values.yaml @@ -0,0 +1,7 @@ +service: + type: NodePort + name: override-vault-consul + portName: override-port-vault-consul + internalPort: 8222 + nodePort: 44 + diff --git a/vagrant/tests/vnfs/testrb/helm/profile/testfol/subdir/deployment.yaml b/vagrant/tests/vnfs/testrb/helm/profile/testfol/subdir/deployment.yaml new file mode 100644 index 00000000..938e1843 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/profile/testfol/subdir/deployment.yaml @@ -0,0 +1,51 @@ +# Copyright 2018 Intel Corporation, Inc +# +# 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: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "common.name" . }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - image: "{{ .Values.image.vault }}" + name: {{ include "common.name" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: ["vault","server","-dev"] + ports: + - containerPort: {{ .Values.service.internalPort }} + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + + volumes: + - name: localtime + hostPath: + path: /etc/localtime diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/Chart.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/Chart.yaml new file mode 100644 index 00000000..86643c9d --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/Chart.yaml @@ -0,0 +1,19 @@ +# Copyright 2018 Intel Corporation, Inc +# +# 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 +description: Chart to launch Vault and consul in dev mode +name: vault-consul-dev +appVersion: 0.9.5 +version: 2.0.0 diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/Chart.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/Chart.yaml new file mode 100644 index 00000000..7d58e53d --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/Chart.yaml @@ -0,0 +1,18 @@ +# 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 +description: Common templates for inclusion in other charts +name: common +version: 2.0.0 diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_name.tpl b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_name.tpl new file mode 100644 index 00000000..42999846 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_name.tpl @@ -0,0 +1,31 @@ +{{/* +# 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. +*/}} + +{{/* + Expand the name of a chart. +*/}} +{{- define "common.name" -}} + {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* + Create a default fully qualified application name. + Truncated at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "common.fullname" -}} + {{- $name := default .Chart.Name .Values.nameOverride -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_namespace.tpl b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_namespace.tpl new file mode 100644 index 00000000..94c9ee72 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_namespace.tpl @@ -0,0 +1,26 @@ +{{/* +# 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. +*/}} + +{{/* + Resolve the namespace to apply to a chart. The default namespace suffix + is the name of the chart. This can be overridden if necessary (eg. for subcharts) + using the following value: + + - .Values.nsPrefix : override namespace prefix +*/}} +{{- define "common.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_repository.tpl b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_repository.tpl new file mode 100644 index 00000000..364ba7dc --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_repository.tpl @@ -0,0 +1,48 @@ +{{/* +# 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. +*/}} + +{{/* + Resolve the name of the common image repository. + The value for .Values.repository is used by default, + unless either override mechanism is used. + + - .Values.global.repository : override default image repository for all images + - .Values.repositoryOverride : override global and default image repository on a per image basis +*/}} +{{- define "common.repository" -}} + {{if .Values.repositoryOverride }} + {{- printf "%s" .Values.repositoryOverride -}} + {{else}} + {{- default .Values.repository .Values.global.repository -}} + {{end}} +{{- end -}} + + +{{/* + Resolve the image repository secret token. + The value for .Values.global.repositoryCred is used: + repositoryCred: + user: user + password: password + mail: email (optional) +*/}} +{{- define "common.repository.secret" -}} + {{- $repo := include "common.repository" . }} + {{- $cred := .Values.global.repositoryCred }} + {{- $mail := default "@" $cred.mail }} + {{- $auth := printf "%s:%s" $cred.user $cred.password | b64enc }} + {{- printf "{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}" $repo $cred.user $cred.password $mail $auth | b64enc -}} +{{- end -}} diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_service.tpl b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_service.tpl new file mode 100644 index 00000000..77b77d05 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/templates/_service.tpl @@ -0,0 +1,31 @@ +{{/* +# 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. +*/}} + +{{/* + Resolve the name of a chart's service. + + The default will be the chart name (or .Values.nameOverride if set). + And the use of .Values.service.name overrides all. + + - .Values.service.name : override default service (ie. chart) name +*/}} +{{/* + Expand the service name for a chart. +*/}} +{{- define "common.servicename" -}} + {{- $name := default .Chart.Name .Values.nameOverride -}} + {{- default $name .Values.service.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/values.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/values.yaml new file mode 100644 index 00000000..f7098ee8 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/charts/common/values.yaml @@ -0,0 +1,44 @@ +# 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. + +################################################################# +# Global configuration default values that can be inherited by +# all subcharts. +################################################################# +global: + # Change to an unused port prefix range to prevent port conflicts + # with other instances running within the same k8s cluster + nodePortPrefix: 302 + + # image repositories + repository: nexus3.onap.org:10001 + + # readiness check + readinessRepository: oomk8s + readinessImage: readiness-check:2.0.0 + + # logging agent + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + + # image pull policy + pullPolicy: Always + + # default mount path root directory referenced + # by persistent volumes and log files + persistence: + mountPath: /dockerdata-nfs + + # flag to enable debugging - application support required + debugEnabled: true diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/deployment.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/deployment.yaml new file mode 100644 index 00000000..66b2e747 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/deployment.yaml @@ -0,0 +1,62 @@ +# Copyright 2018 Intel Corporation, Inc +# +# 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: apps/v1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "common.name" . }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - image: "{{ .Values.image.vault }}" + name: {{ include "common.name" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: ["vault","server","-dev"] + ports: + - containerPort: {{ .Values.service.internalPort }} + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + + - image: "{{ .Values.image.consul }}" + name: {{ include "common.name" . }}-backend + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: ["consul","agent","-dev"] + ports: + - name: http + containerPort: 8500 + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + volumes: + - name: localtime + hostPath: + path: /etc/localtime diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/service.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/service.yaml new file mode 100644 index 00000000..04e9a5a9 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/templates/service.yaml @@ -0,0 +1,39 @@ +# Copyright 2018 Intel Corporation, Inc +# +# 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: Service +metadata: + name: {{ include "common.servicename" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - name: {{ .Values.service.portName }} + {{if eq .Values.service.type "NodePort" -}} + port: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.nodePort }} + {{- else -}} + port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + {{- end}} + protocol: TCP + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} diff --git a/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/values.yaml b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/values.yaml new file mode 100644 index 00000000..87c64026 --- /dev/null +++ b/vagrant/tests/vnfs/testrb/helm/vault-consul-dev/values.yaml @@ -0,0 +1,90 @@ +# Copyright 2018 Intel Corporation, Inc +# +# 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. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + persistence: {} + +# application image +image: + consul: consul:1.0.6 + vault: vault:0.10.0 +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +################################################################# +# Application configuration defaults. +################################################################# +config: + consul: + server: true + log_level: INFO + server: true + data_dir: '/consul/data' + ports: + http: 8500 + https: -1 + + vault: + storage: + consul: + address: localhost:8500 + path: vault + listener: + tcp: + address: '[::]:8200' + tls_disable: true + disable_mlock: true + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +persistence: + enabled: true + volumeReclaimPolicy: Retain + accessMode: ReadWriteOnce + size: 2Gi + mountPath: /dockerdata-nfs + mountSubPath: sms/consul/data + +service: + type: NodePort + name: vault-consul + portName: vault-consul + internalPort: 8200 + nodePort: 44 + +ingress: + enabled: false -- cgit 1.2.3-korg