From 6f1d649951d191ca2be9f849b2a883d2307df686 Mon Sep 17 00:00:00 2001 From: Zhe Huang Date: Thu, 18 Jul 2019 00:31:04 -0400 Subject: [PATCH] Add chartmuseum as the helm repo Signed-off-by: Zhe Huang Change-Id: Ie9af4a453bc18166ff8a8c3cc61ca4ca190f8dc2 --- RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE | 8 ++ .../helm/ric-common/templates/_configmapname.tpl | 5 ++ .../helm/ric-common/templates/_containername.tpl | 5 ++ .../helm/ric-common/templates/_deploymentname.tpl | 5 ++ .../helm/ric-common/templates/_ingressname.tpl | 5 ++ .../helm/ric-common/templates/_name.tpl | 18 +++++ .../helm/ric-common/templates/_ports.tpl | 4 +- .../ric-common/templates/_serviceaccountname.tpl | 5 ++ .../helm/ric-common/templates/_servicename.tpl | 5 ++ ric-infra/15-Chartmuseum/bin/clear_data_path | 47 +++++++++++ ric-infra/15-Chartmuseum/bin/install | 94 ++++++++++++++++++++++ ric-infra/15-Chartmuseum/bin/uninstall | 41 ++++++++++ ric-infra/15-Chartmuseum/etc/chartmuseum.conf | 37 +++++++++ .../15-Chartmuseum/helm/chartmuseum/Chart.yaml | 23 ++++++ .../helm/chartmuseum/requirements.yaml | 20 +++++ .../helm/chartmuseum/templates/_gen-cert.tpl | 29 +++++++ .../helm/chartmuseum/templates/deployment.yaml | 63 +++++++++++++++ .../helm/chartmuseum/templates/env.yaml | 24 ++++++ .../helm/chartmuseum/templates/ingress.yaml | 33 ++++++++ .../helm/chartmuseum/templates/job-save-certs.yaml | 44 ++++++++++ .../chartmuseum/templates/persistentVolume.yaml | 21 +++++ .../templates/persistentVolumeClaim.yaml | 11 +++ .../helm/chartmuseum/templates/secret.yaml | 27 +++++++ .../helm/chartmuseum/templates/service.yaml | 37 +++++++++ .../helm/chartmuseum/templates/storageClass.yaml | 6 ++ .../15-Chartmuseum/helm/chartmuseum/values.yaml | 37 +++++++++ 26 files changed, 653 insertions(+), 1 deletion(-) create mode 100755 ric-infra/15-Chartmuseum/bin/clear_data_path create mode 100755 ric-infra/15-Chartmuseum/bin/install create mode 100755 ric-infra/15-Chartmuseum/bin/uninstall create mode 100644 ric-infra/15-Chartmuseum/etc/chartmuseum.conf create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/Chart.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/requirements.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/_gen-cert.tpl create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/deployment.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/env.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/ingress.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/job-save-certs.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolume.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolumeClaim.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/secret.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/service.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/templates/storageClass.yaml create mode 100644 ric-infra/15-Chartmuseum/helm/chartmuseum/values.yaml diff --git a/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE index 3912aeac..e20150a1 100644 --- a/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE +++ b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE @@ -88,3 +88,11 @@ nexus: datapath: /tmp/nexus3-data/ storagesize: 20Gi +chartmuseum: + repositoryOverride: "registry.hub.docker.com" + image: + name: chartmuseum/chartmuseum + tag: v0.8.2 + + storagesize: 2Gi + datapath: /tmp/chartmuseum-data/ diff --git a/ric-common/Common-Template/helm/ric-common/templates/_configmapname.tpl b/ric-common/Common-Template/helm/ric-common/templates/_configmapname.tpl index 7aa27956..4cff1a1f 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_configmapname.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_configmapname.tpl @@ -57,6 +57,11 @@ {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.configmapname.chartmuseum" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.configmapname.dashboard" -}} {{- $name := ( include "common.fullname.dashboard" . ) -}} {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_containername.tpl b/ric-common/Common-Template/helm/ric-common/templates/_containername.tpl index 3935beb9..f060dc2e 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_containername.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_containername.tpl @@ -55,6 +55,11 @@ {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.containername.chartmuseum" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.containername.dashboard" -}} {{- $name := ( include "common.fullname.dashboard" . ) -}} {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_deploymentname.tpl b/ric-common/Common-Template/helm/ric-common/templates/_deploymentname.tpl index 185bfc1b..f1104dcb 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_deploymentname.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_deploymentname.tpl @@ -55,6 +55,11 @@ {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.deploymentname.chartmuseum" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.deploymentname.dashboard" -}} {{- $name := ( include "common.fullname.dashboard" . ) -}} {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_ingressname.tpl b/ric-common/Common-Template/helm/ric-common/templates/_ingressname.tpl index f80063f4..5f090b66 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_ingressname.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_ingressname.tpl @@ -47,6 +47,11 @@ {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.ingressname.chartmuseum" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.ingressname.ves" -}} {{- $name := ( include "common.fullname.ves" . ) -}} {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_name.tpl b/ric-common/Common-Template/helm/ric-common/templates/_name.tpl index 9ad9ffac..bbfce4fc 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_name.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_name.tpl @@ -202,6 +202,24 @@ {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.name.chartmuseum" -}} + {{- if .Values.chartmuseum -}} + {{- if .Values.chartmuseum.nameOverride -}} + {{- printf "%s" .Values.chartmuseum.nameOverride -}} + {{- else -}} + {{- printf "chartmuseum" -}} + {{- end -}} + {{- else -}} + {{- printf "chartmuseum" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.fullname.chartmuseum" -}} + {{- $name := ( include "common.name.chartmuseum" . ) -}} + {{- $namespace := ( include "common.namespace.infra" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} {{- define "common.name.dashboard" -}} {{- if .Values.dashboard -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_ports.tpl b/ric-common/Common-Template/helm/ric-common/templates/_ports.tpl index fe463c28..36f91c42 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_ports.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_ports.tpl @@ -55,6 +55,8 @@ {{- define "common.serviceport.nexus.http" -}}8080{{- end -}} +{{- define "common.serviceport.chartmuseum.http" -}}8080{{- end -}} + {{- define "common.serviceport.dashboard.http" -}}30080{{- end -}} {{- define "common.serviceport.dashboard.container" -}}8080{{- end -}} @@ -68,4 +70,4 @@ {{- define "common.serviceport.ves.http" -}}30235{{- end -}} {{- define "common.serviceport.ves.http.container" -}}8080{{- end -}} {{- define "common.serviceport.ves.https" -}}30417{{- end -}} -{{- define "common.serviceport.ves.https.container" -}}8443{{- end -}} \ No newline at end of file +{{- define "common.serviceport.ves.https.container" -}}8443{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_serviceaccountname.tpl b/ric-common/Common-Template/helm/ric-common/templates/_serviceaccountname.tpl index 9daabc91..8e9c3f36 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_serviceaccountname.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_serviceaccountname.tpl @@ -55,6 +55,11 @@ {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.serviceaccountname.chartmuseum" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.serviceaccountname.dashboard" -}} {{- $name := ( include "common.fullname.dashboard" . ) -}} {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_servicename.tpl b/ric-common/Common-Template/helm/ric-common/templates/_servicename.tpl index b480cec7..f8a21dd5 100644 --- a/ric-common/Common-Template/helm/ric-common/templates/_servicename.tpl +++ b/ric-common/Common-Template/helm/ric-common/templates/_servicename.tpl @@ -93,6 +93,11 @@ {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "common.servicename.chartmuseum.http" -}} + {{- $name := ( include "common.fullname.chartmuseum" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "common.servicename.dashboard.http" -}} {{- $name := ( include "common.fullname.dashboard" . ) -}} {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} diff --git a/ric-infra/15-Chartmuseum/bin/clear_data_path b/ric-infra/15-Chartmuseum/bin/clear_data_path new file mode 100755 index 00000000..f7a37808 --- /dev/null +++ b/ric-infra/15-Chartmuseum/bin/clear_data_path @@ -0,0 +1,47 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +OVERRIDEYAML=$1 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + + + + + + +if [ -z $OVERRIDEYAML ]; then + + DATAPATH=$(cat $DIR/../helm/chartmuseum/values.yaml | awk '/^.*datapath:.*/{ print $2;}') + +else + DATAPATH=$(cat $OVERRIDEYAML | awk '/^chartmuseum:.*/{ getline; while ( match($0, / .*/) || (!$0)){ if(getline == 0){break;}; if (match($0, /^ .*datapath:.*/)){print $2}} }') + + + if [ -z $DATAPATH ]; then + DATAPATH=$(cat $DIR/../helm/chartmuseum/values.yaml | awk '/^.*datapath:.*/{ print $2;}') + fi + +fi + + rm -rf $DATAPATH + + mkdir -p $DATAPATH + + + chmod -R a+rwx $DATAPATH + diff --git a/ric-infra/15-Chartmuseum/bin/install b/ric-infra/15-Chartmuseum/bin/install new file mode 100755 index 00000000..f1a3bb83 --- /dev/null +++ b/ric-infra/15-Chartmuseum/bin/install @@ -0,0 +1,94 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + + +OVERRIDEYAML=$1 + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +source $DIR/../etc/chartmuseum.conf + +if [ -z "$RICINFRA_RELEASE_NAME" ];then + RELEASE_NAME=$helm_release_name +else + RELEASE_NAME=$RICINFRA_RELEASE_NAME +fi +# Namespace configuration +if [ -z "$RICPLT_NAMESPACE" ];then + PLT_NAMESPACE=$plt_namespace +else + PLT_NAMESPACE=$RICPLT_NAMESPACE +fi +if [ -z "$RICXAPP_NAMESPACE" ];then + XAPP_NAMESPACE=$xapp_namespace +else + XAPP_NAMESPACE=$RICXAPP_NAMESPACE +fi +if [ -z "$RICAUX_NAMESPACE" ];then + AUX_NAMESPACE=$aux_namespace +else + AUX_NAMESPACE=$RICAUX_NAMESPACE +fi +if [ -z "$RICINFRA_NAMESPACE" ];then + INFRA_NAMESPACE=$infra_namespace +else + INFRA_NAMESPACE=$RICINFRA_NAMESPACE +fi + +if [ -z "$RIC_COMMON_OVERRIDE" ];then + COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE" +else + COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE +fi + + + + +NODENAME=$(kubectl get node | awk 'NR==2{print $1}') +kubectl label --overwrite nodes $NODENAME helm-node=enable + +DIRTEMP=$DIR +. ./clear_data_path +DIR=$DIRTEMP + + +RICINFRA_COMPONENTS="chartmuseum" + +echo "Deploying RIC infra components [$RICINFRA_COMPONENTS]" +echo "Helm Release Name: $RELEASE_NAME" + + +COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') +helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common + + + + + +for component in $RICINFRA_COMPONENTS; do + + mkdir -p $DIR/../helm/$component/charts/ + cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ + + if [ -z $OVERRIDEYAML ]; then + helm install --debug --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component + else + helm install -f $OVERRIDEYAML --namespace "${INFRA_NAMESPACE}" --name "${RELEASE_NAME}-$component" $COMMON_OVERRIDE $DIR/../helm/$component + fi +done diff --git a/ric-infra/15-Chartmuseum/bin/uninstall b/ric-infra/15-Chartmuseum/bin/uninstall new file mode 100755 index 00000000..79ca2d7d --- /dev/null +++ b/ric-infra/15-Chartmuseum/bin/uninstall @@ -0,0 +1,41 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + + + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + + +source $DIR/../etc/chartmuseum.conf + +if [ -z "$RICINFRA_RELEASE_NAME" ];then + RELEASE_NAME=$helm_release_name +else + RELEASE_NAME=$RICINFRA_RELEASE_NAME +fi + +RICINFRA_COMPONENTS="chartmuseum" + +echo "Undeploying RIC infra components [$RICINFRA_COMPONENTS]" +echo "Helm Release Name: $RELEASE_NAME" + + +for component in $RICINFRA_COMPONENTS; do + helm delete --purge "${RELEASE_NAME}-${component}" +done diff --git a/ric-infra/15-Chartmuseum/etc/chartmuseum.conf b/ric-infra/15-Chartmuseum/etc/chartmuseum.conf new file mode 100644 index 00000000..92008b59 --- /dev/null +++ b/ric-infra/15-Chartmuseum/etc/chartmuseum.conf @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + + +# helm_release_name defines the release name helm will use to deploy RIC +# It will be overrided by RICPLT_RELEASE_NAME +helm_release_name=r1 + +# namespace defines the namespace that helm will use to deploy RIC +# It will be overrided by RICPLT_NAMESPACE +plt_namespace=ricplt + +# namespace defines the namespace that helm will use to deploy RIC +# It will be overrided by RICXAPP_NAMESPACE +xapp_namespace=ricxapp + +# namespace defines the namespace that helm will use to deploy RIC +# It will be overrided by RICAUX_NAMESPACE +aux_namespace=ricaux + +# namespace defines the namespace that helm will use to deploy RIC +# It will be overrided by RICINFRA_NAMESPACE +infra_namespace=ricinfra diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/Chart.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/Chart.yaml new file mode 100644 index 00000000..7594952b --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/Chart.yaml @@ -0,0 +1,23 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: A Helm chart for helm repository for RIC +name: chartmuseum +version: 0.0.1 +appVersion: 0.1 diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/requirements.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/requirements.yaml new file mode 100644 index 00000000..2ab71b4e --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/requirements.yaml @@ -0,0 +1,20 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: ric-common + version: ~2.0.0 diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/_gen-cert.tpl b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/_gen-cert.tpl new file mode 100644 index 00000000..9dcbdb94 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/_gen-cert.tpl @@ -0,0 +1,29 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################i + +{{/* +Generate certificates for the docker registry +*/}} + +{{- define "chartmuseum.gen-cert" -}} +{{- $altNames := list ( include "common.ingressurl.localhelm" . ) -}} +{{- $ca := genCA "docker-registry-ca" 365 -}} +{{- $cert := genSignedCert ( include "common.ingressurl.localhelm" . ) nil $altNames 365 $ca -}} +tls.crt: {{ $cert.Cert | b64enc }} +tls.key: {{ $cert.Key | b64enc }} +{{- end -}} + diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/deployment.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/deployment.yaml new file mode 100644 index 00000000..c283c19d --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/deployment.yaml @@ -0,0 +1,63 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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/v1beta2 +kind: Deployment +metadata: + name: {{ include "common.deploymentname.chartmuseum" .}} + labels: + app: {{ include "common.namespace.infra" . }}-{{ include "common.name.chartmuseum" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.chartmuseum.replicaCount }} + selector: + matchLabels: + app: {{ include "common.namespace.infra" . }}-{{ include "common.name.chartmuseum" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ include "common.namespace.infra" . }}-{{ include "common.name.chartmuseum" . }} + release: {{ .Release.Name }} + spec: + hostname: {{ .Chart.Name }} + imagePullSecrets: + - name: {{ include "common.repositoryCred" . }} + containers: + - name: {{ include "common.containername.chartmuseum" . }} + image: {{ include "common.repository" . }}/{{ .Values.chartmuseum.image.name }}:{{ .Values.chartmuseum.image.tag }} + imagePullPolicy: {{ include "common.pullPolicy" . }} + envFrom: + - configMapRef: + name: {{ include "common.configmapname.chartmuseum" . }}-env + # volumeMounts: + #- name: certs + # mountPath: /var/run/certs + # readOnly: true + ports: + - name: http + containerPort: {{ include "common.serviceport.chartmuseum.http" . }} + protocol: TCP + volumeMounts: + - name: chart-data + mountPath: /charts + volumes: + - name: chart-data + persistentVolumeClaim: + claimName: pvc-{{ include "common.name.chartmuseum" . }} diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/env.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/env.yaml new file mode 100644 index 00000000..8565e887 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/env.yaml @@ -0,0 +1,24 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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.configmapname.chartmuseum" . }}-env +data: + DEBUG: "true" + STORAGE: "local" + STORAGE_LOCAL_ROOTDIR: "/charts" diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/ingress.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/ingress.yaml new file mode 100644 index 00000000..8ecd7e19 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/ingress.yaml @@ -0,0 +1,33 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ include "common.ingressname.chartmuseum" . }} +spec: + tls: + - hosts: + - {{ include "common.ingressurl.localhelm" . }} + secretName: secret-{{ include "common.name.chartmuseum" . }} + rules: + - host: {{ include "common.ingressurl.localhelm" . }} + http: + paths: + - backend: + serviceName: {{ include "common.servicename.chartmuseum.http" . }} + servicePort: http + path: "/" diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/job-save-certs.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/job-save-certs.yaml new file mode 100644 index 00000000..01f5ac64 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/job-save-certs.yaml @@ -0,0 +1,44 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: batch/v1 +kind: Job +metadata: + name: job-{{ include "common.fullname.chartmuseum" . }}-save-certs +spec: + template: + spec: + containers: + - name: cert-copy + image: alpine + command: [ "/bin/sh","-c","cp -rL /var/run/helmcerts/..data/tls.crt /var/run/certs-copy/helmtls.crt"] + # command: ["tail", "-f", "/dev/null"] + volumeMounts: + - name: helmcerts + mountPath: /var/run/helmcerts + readOnly: true + - name: write-to-volume + mountPath: /var/run/certs-copy + volumes: + - name: helmcerts + secret: + secretName: secret-{{ include "common.name.chartmuseum" . }} + - name: write-to-volume + hostPath: + path: /tmp + restartPolicy: Never + backoffLimit: 4 diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolume.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolume.yaml new file mode 100644 index 00000000..93127ca6 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolume.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-{{ include "common.name.chartmuseum" . }} +spec: + capacity: + storage: {{ .Values.chartmuseum.storagesize }} + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: storageclass-{{ include "common.name.chartmuseum" . }} + local: + path: {{ .Values.chartmuseum.datapath }} + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: helm-node + operator: In + values: + - enable diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolumeClaim.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolumeClaim.yaml new file mode 100644 index 00000000..11e0314a --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/persistentVolumeClaim.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: pvc-{{ include "common.name.chartmuseum" . }} +spec: + accessModes: + - ReadWriteOnce + storageClassName: storageclass-{{ include "common.name.chartmuseum" . }} + resources: + requests: + storage: {{ .Values.chartmuseum.storagesize }} diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/secret.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/secret.yaml new file mode 100644 index 00000000..54905280 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/secret.yaml @@ -0,0 +1,27 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: Secret +type: kubernetes.io/tls +metadata: + name: secret-{{ include "common.name.chartmuseum" . }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: +{{ ( include "chartmuseum.gen-cert" . ) | indent 2 }} diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/service.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/service.yaml new file mode 100644 index 00000000..89e35920 --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/service.yaml @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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.chartmuseum.http" . }} + namespace: {{ include "common.namespace.infra" . }} + labels: + app: {{ include "common.namespace.infra" . }}-{{ include "common.name.chartmuseum" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: ClusterIP + ports: + - port: {{ include "common.serviceport.chartmuseum.http" . }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ include "common.namespace.infra" . }}-{{ include "common.name.chartmuseum" . }} + release: {{ .Release.Name }} diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/storageClass.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/storageClass.yaml new file mode 100644 index 00000000..85eed19d --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/templates/storageClass.yaml @@ -0,0 +1,6 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: storageclass-{{ include "common.name.chartmuseum" . }} +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer diff --git a/ric-infra/15-Chartmuseum/helm/chartmuseum/values.yaml b/ric-infra/15-Chartmuseum/helm/chartmuseum/values.yaml new file mode 100644 index 00000000..203a678a --- /dev/null +++ b/ric-infra/15-Chartmuseum/helm/chartmuseum/values.yaml @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +# Default values for nexus. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +repository: "registry.hub.docker.com" +imagePullPolicy: IfNotPresent +repositoryCred: docker-reg-cred +helmRepositoryCert: xapp-mgr-certs + +chartmuseum: + replicaCount: 1 + + +# This is designed to be deployed using local image + image: + name: chartmuseum/chartmuseum + tag: v0.8.2 + + + storagesize: 2Gi + datapath: /tmp/chartmuseum-data/ -- 2.16.6