sdc K8S-Helm Parameterization
changed sdc k8s deployment to support helm parameterization. updated create/delete for helm only
Issue-ID: OOM-52
Change-Id: Ic7fb17fcf5be5813b0a0c54299cdf0d0417e8a76
Signed-off-by: kerenj <keren.joseph@amdocs.com>
diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash
index 7e29697..95dd809 100755
--- a/kubernetes/oneclick/createAll.bash
+++ b/kubernetes/oneclick/createAll.bash
@@ -8,7 +8,6 @@
Usage: $0 [PARAMs]
-u : Display usage
-n [NAMESPACE] : Kubernetes namespace (required)
--s false : Exclude services (default: true)
-i [INSTANCE] : ONAP deployment instance # (default: 1)
-a [APP] : Specify a specific ONAP component (default: all)
from the following choices:
@@ -25,14 +24,6 @@
kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7
}
-create_service() {
- sed -i-- 's/nodePort: [0-9]\{2\}[02468]\{1\}/nodePort: '"$3"'/g' ../$2/all-services.yaml
- sed -i-- 's/nodePort: [0-9]\{2\}[13579]\{1\}/nodePort: '"$4"'/g' ../$2/all-services.yaml
- kubectl --namespace $1-$2 create -f ../$2/all-services.yaml
- mv ../$2/all-services.yaml-- ../$2/all-services.yaml
-}
-
-
create_onap_helm() {
helm install ../$2/ --name $2
}
@@ -84,9 +75,6 @@
n)
NS=${OPTARG}
;;
- s)
- INCL_SVC=${OPTARG}
- ;;
i)
INSTANCE=${OPTARG}
;;
@@ -116,46 +104,26 @@
fi
if [[ ! -z "$APP" ]]; then
- ONAP_APPS=($APP)
+ HELM_APPS=($APP)
fi
-if [[ "$INCL_SVC" == true ]]; then
- if [ "$INSTANCE" -gt "$MAX_INSTANCE" ];then
- printf "\n********** You choose to create ${INSTANCE}th instance of ONAP \n"
- printf "\n********** Due to port allocation only ${MAX_INSTANCE} instances of ONAP is allowed per kubernetes deployment\n"
- exit 1
- fi
-
- start=$((300+2*INSTANCE))
- end=$((start+1))
- printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${start}00 and ${end}99\n"
-
+if [ "$INSTANCE" -gt "$MAX_INSTANCE" ];then
+ printf "\n********** You choose to create ${INSTANCE}th instance of ONAP \n"
+ printf "\n********** Due to port allocation only ${MAX_INSTANCE} instances of ONAP is allowed per kubernetes deployment\n"
+ exit 1
fi
+start=$((300+2*INSTANCE))
+end=$((start+1))
+
+printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${start}00 and ${end}99\n"
+
+
printf "\n********** Creating ONAP: ${ONAP_APPS[*]}\n"
-for i in ${ONAP_APPS[@]}; do
- printf "\nCreating namespace **********\n"
- create_namespace $NS $i
- printf "\nCreating registry secret **********\n"
- create_registry_key $NS $i $ONAP_DOCKER_REGISTRY_KEY $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
-
- if [[ "$INCL_SVC" == true ]]; then
- printf "\nCreating service **********\n"
- create_service $NS $i $start $end
- fi
-
- printf "\n"
-done
-
-printf "\n\n********** Creating deployments for ${ONAP_APPS[*]} ********** \n"
-for i in ${ONAP_APPS[@]}; do
- _FILES_PATH=$(echo ../$i)
- configure_app $NS $i $_FILES_PATH $start $end
- /bin/bash $i.sh $NS $i 'create'
-done
+printf "\n\n********** Creating deployments for ${HELM_APPS[*]} ********** \n"
for i in ${HELM_APPS[@]}; do
printf "\nCreating namespace **********\n"
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash
index ad7f060..dfa75b5 100755
--- a/kubernetes/oneclick/deleteAll.bash
+++ b/kubernetes/oneclick/deleteAll.bash
@@ -16,10 +16,6 @@
kubectl --namespace $1-$2 delete secret onap-docker-registry-key
}
-delete_service() {
- kubectl --namespace $1-$2 delete -f ../$2/all-services.yaml
-}
-
delete_app_helm() {
helm delete $1 --purge
}
@@ -29,7 +25,6 @@
Usage: $0 [PARAMs]
-u : Display usage
-n [NAMESPACE] : Kubernetes namespace (required)
--s true : Include services (default: false)
-a [APP] : Specify a specific ONAP component (default: all)
from the following choices:
sdc, aai ,mso, message-router, robot,
@@ -51,9 +46,6 @@
n)
NS=${OPTARG}
;;
- s)
- INCL_SVC=${OPTARG}
- ;;
a)
APP=${OPTARG}
if [[ -z $APP ]]; then
@@ -74,23 +66,11 @@
fi
if [[ ! -z "$APP" ]]; then
- ONAP_APPS=($APP)
+ HELM_APPS=($APP)
fi
printf "\n********** Cleaning up ONAP: ${ONAP_APPS[*]}\n"
-for i in ${ONAP_APPS[@]}; do
-
- # delete the deployments
- /bin/bash $i.sh $NS $i 'delete'
-
- if [[ "$INCL_SVC" == true ]]; then
- printf "\nDeleting services **********\n"
- delete_service $NS $i
- delete_namespace $NS $i
- fi
-
-done
for i in ${HELM_APPS[@]}; do
diff --git a/kubernetes/oneclick/setenv.bash b/kubernetes/oneclick/setenv.bash
index 996a875..c7f3aba 100644
--- a/kubernetes/oneclick/setenv.bash
+++ b/kubernetes/oneclick/setenv.bash
@@ -1,7 +1,6 @@
#!/bin/bash
-HELM_APPS=('mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'appc' 'aai')
-ONAP_APPS=('sdc')
+HELM_APPS=('mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'appc' 'aai' 'sdc')
ONAP_DOCKER_REGISTRY_KEY=${ONAP_DOCKER_REGISTRY_KEY:-onap-docker-registry-key}
ONAP_DOCKER_REGISTRY=${ONAP_DOCKER_REGISTRY:-nexus3.onap.org:10001}
ONAP_DOCKER_USER=${ONAP_DOCKER_USER:-docker}
diff --git a/kubernetes/sdc/Chart.yaml b/kubernetes/sdc/Chart.yaml
new file mode 100644
index 0000000..668a9a6
--- /dev/null
+++ b/kubernetes/sdc/Chart.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+description: A Helm chart for Kubernetes
+name: sdc
+version: 0.1.0
diff --git a/kubernetes/sdc/all-services.yaml b/kubernetes/sdc/templates/all-services.yaml
similarity index 88%
rename from kubernetes/sdc/all-services.yaml
rename to kubernetes/sdc/templates/all-services.yaml
index 1d832f0..25ca65e 100644
--- a/kubernetes/sdc/all-services.yaml
+++ b/kubernetes/sdc/templates/all-services.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-es
name: sdc-es
+ namespace: {{ .Values.NS }}
spec:
ports:
- name: sdc-es-port-9200
@@ -20,6 +21,7 @@
labels:
app: sdc-cs
name: sdc-cs
+ namespace: {{ .Values.NS }}
spec:
ports:
- name: sdc-cs-port-9042
@@ -36,6 +38,7 @@
labels:
app: sdc-kb
name: sdc-kb
+ namespace: {{ .Values.NS }}
spec:
ports:
- name: sdc-kb-port-5601
@@ -50,6 +53,7 @@
labels:
app: sdc-be
name: sdc-be
+ namespace: {{ .Values.NS }}
spec:
ports:
- name: sdc-be-port-8443
@@ -68,6 +72,7 @@
labels:
app: sdc-fe
name: sdc-fe
+ namespace: {{ .Values.NS }}
spec:
ports:
- name: sdc-fe-port-9443
diff --git a/kubernetes/sdc/sdc-be.yaml b/kubernetes/sdc/templates/sdc-be.yaml
similarity index 82%
rename from kubernetes/sdc/sdc-be.yaml
rename to kubernetes/sdc/templates/sdc-be.yaml
index ac2378c..96fee81 100644
--- a/kubernetes/sdc/sdc-be.yaml
+++ b/kubernetes/sdc/templates/sdc-be.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-be
name: sdc-be
+ namespace: {{ .Values.NS }}
spec:
selector:
matchLabels:
@@ -38,8 +39,8 @@
}
}
],
- "image": "oomk8s/readiness-check:1.0.0",
- "imagePullPolicy": "Always",
+ "image": "{{ .Values.image.readiness }}",
+ "imagePullPolicy": "{{ .Values.pullPolicy }}",
"name": "sdc-be-readiness"
},
{
@@ -56,8 +57,8 @@
"value": "onap-message-router"
}
],
- "image": "oomk8s/readiness-check:1.0.0",
- "imagePullPolicy": "Always",
+ "image": "{{ .Values.image.readiness }}",
+ "imagePullPolicy": "{{ .Values.pullPolicy }}",
"name": "sdc-dmaap-readiness"
}
]'
@@ -70,7 +71,8 @@
valueFrom:
fieldRef:
fieldPath: status.podIP
- image: nexus3.onap.org:10001/openecomp/sdc-backend:1.1-STAGING-latest
+ image: {{ .Values.image.sdcBackend }}
+ imagePullPolicy: {{ .Values.pullPolicy }}
name: sdc-be
volumeMounts:
- mountPath: /usr/share/elasticsearch/data/
@@ -94,18 +96,18 @@
volumes:
- name: sdc-sdc-es-es
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/sdc-es/ES
+ path: /dockerdata-nfs/onap/sdc/sdc-es/ES
- name: sdc-environments
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/environments
+ path: /dockerdata-nfs/onap/sdc/environments
- name: sdc-jetty-keystore
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/jetty/keystore
+ path: /dockerdata-nfs/onap/sdc/jetty/keystore
- name: sdc-localtime
hostPath:
path: /etc/localtime
- name: sdc-logs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/logs
+ path: /dockerdata-nfs/onap/sdc/logs
imagePullSecrets:
- name: onap-docker-registry-key
diff --git a/kubernetes/sdc/sdc-cs.yaml b/kubernetes/sdc/templates/sdc-cs.yaml
similarity index 83%
rename from kubernetes/sdc/sdc-cs.yaml
rename to kubernetes/sdc/templates/sdc-cs.yaml
index 081bae4..55a5613 100644
--- a/kubernetes/sdc/sdc-cs.yaml
+++ b/kubernetes/sdc/templates/sdc-cs.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-cs
name: sdc-cs
+ namespace: {{ .Values.NS }}
spec:
selector:
matchLabels:
@@ -34,8 +35,8 @@
}
}
],
- "image": "oomk8s/readiness-check:1.0.0",
- "imagePullPolicy": "Always",
+ "image": "{{ .Values.image.readiness }}",
+ "imagePullPolicy": "{{ .Values.pullPolicy }}",
"name": "sdc-cs-readiness"
}
]'
@@ -50,7 +51,8 @@
fieldPath: status.podIP
- name: ES_HEAP_SIZE
value: "1024M"
- image: nexus3.onap.org:10001/openecomp/sdc-cassandra:1.1-STAGING-latest
+ image: {{ .Values.image.sdcCassandra }}
+ imagePullPolicy: {{ .Values.pullPolicy }}
name: sdc-cs
volumeMounts:
- mountPath: /var/lib/cassandra/
@@ -72,15 +74,15 @@
volumes:
- name: sdc-sdc-cs-cs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/sdc-cs/CS
+ path: /dockerdata-nfs/onap/sdc/sdc-cs/CS
- name: sdc-environments
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/environments
+ path: /dockerdata-nfs/onap/sdc/environments
- name: sdc-localtime
hostPath:
path: /etc/localtime
- name: sdc-logs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/logs
+ path: /dockerdata-nfs/onap/sdc/logs
imagePullSecrets:
- name: onap-docker-registry-key
diff --git a/kubernetes/sdc/sdc-es.yaml b/kubernetes/sdc/templates/sdc-es.yaml
similarity index 81%
rename from kubernetes/sdc/sdc-es.yaml
rename to kubernetes/sdc/templates/sdc-es.yaml
index cfb5242..f1dfb43 100644
--- a/kubernetes/sdc/sdc-es.yaml
+++ b/kubernetes/sdc/templates/sdc-es.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-es
name: sdc-es
+ namespace: {{ .Values.NS }}
spec:
selector:
matchLabels:
@@ -15,7 +16,8 @@
name: sdc-es
spec:
containers:
- - image: nexus3.onap.org:10001/openecomp/sdc-elasticsearch:1.1-STAGING-latest
+ - image: {{ .Values.image.sdcElasticsearch }}
+ imagePullPolicy: {{ .Values.pullPolicy }}
name: sdc-es
env:
- name: ENVNAME
@@ -46,15 +48,15 @@
volumes:
- name: sdc-sdc-es-es
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/sdc-es/ES
+ path: /dockerdata-nfs/onap/sdc/sdc-es/ES
- name: sdc-environments
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/environments
+ path: /dockerdata-nfs/onap/sdc/environments
- name: sdc-localtime
hostPath:
path: /etc/localtime
- name: sdc-logs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/logs
+ path: /dockerdata-nfs/onap/sdc/logs
imagePullSecrets:
- name: onap-docker-registry-key
diff --git a/kubernetes/sdc/sdc-fe.yaml b/kubernetes/sdc/templates/sdc-fe.yaml
similarity index 82%
rename from kubernetes/sdc/sdc-fe.yaml
rename to kubernetes/sdc/templates/sdc-fe.yaml
index 0711aa9..a566b15 100644
--- a/kubernetes/sdc/sdc-fe.yaml
+++ b/kubernetes/sdc/templates/sdc-fe.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-fe
name: sdc-fe
+ namespace: {{ .Values.NS }}
spec:
selector:
matchLabels:
@@ -40,8 +41,8 @@
}
}
],
- "image": "oomk8s/readiness-check:1.0.0",
- "imagePullPolicy": "Always",
+ "image": "{{ .Values.image.readiness }}",
+ "imagePullPolicy": "{{ .Values.pullPolicy }}",
"name": "sdc-fe-readiness"
}
]'
@@ -55,7 +56,8 @@
valueFrom:
fieldRef:
fieldPath: status.podIP
- image: nexus3.onap.org:10001/openecomp/sdc-frontend:1.1-STAGING-latest
+ image: {{ .Values.image.sdcFrontend }}
+ imagePullPolicy: {{ .Values.pullPolicy }}
volumeMounts:
- mountPath: /usr/share/elasticsearch/data/
name: sdc-sdc-es-es
@@ -80,21 +82,21 @@
volumes:
- name: sdc-sdc-es-es
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/sdc-es/ES
+ path: /dockerdata-nfs/onap/sdc/sdc-es/ES
- name: sdc-environments
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/environments
+ path: /dockerdata-nfs/onap/sdc/environments
- name: sdc-jetty-keystore
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/jetty/keystore
+ path: /dockerdata-nfs/onap/sdc/jetty/keystore
- name: sdc-localtime
hostPath:
path: /etc/localtime
- name: sdc-logs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/logs
+ path: /dockerdata-nfs/onap/sdc/logs
- name: sdc-fe-config
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/sdc-fe/FE_2_setup_configuration.rb
+ path: /dockerdata-nfs/onap/sdc/sdc-fe/FE_2_setup_configuration.rb
imagePullSecrets:
- name: onap-docker-registry-key
diff --git a/kubernetes/sdc/sdc-kb.yaml b/kubernetes/sdc/templates/sdc-kb.yaml
similarity index 83%
rename from kubernetes/sdc/sdc-kb.yaml
rename to kubernetes/sdc/templates/sdc-kb.yaml
index 83483f7..0dca7e4 100644
--- a/kubernetes/sdc/sdc-kb.yaml
+++ b/kubernetes/sdc/templates/sdc-kb.yaml
@@ -4,6 +4,7 @@
labels:
app: sdc-kb
name: sdc-kb
+ namespace: {{ .Values.NS }}
spec:
selector:
matchLabels:
@@ -36,8 +37,8 @@
}
}
],
- "image": "oomk8s/readiness-check:1.0.0",
- "imagePullPolicy": "Always",
+ "image": "{{ .Values.image.readiness }}",
+ "imagePullPolicy": "{{ .Values.pullPolicy }}",
"name": "sdc-kb-readiness"
}
]'
@@ -48,7 +49,8 @@
value: AUTO
- name: ELASTICSEARCH_URL
value: http://sdc-es:9200
- image: nexus3.onap.org:10001/openecomp/sdc-kibana:1.1-STAGING-latest
+ image: {{ .Values.image.sdcKibana }}
+ imagePullPolicy: {{ .Values.pullPolicy }}
name: sdc-kb
volumeMounts:
- mountPath: /root/chef-solo/environments/
@@ -67,12 +69,12 @@
volumes:
- name: sdc-environments
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/environments
+ path: /dockerdata-nfs/onap/sdc/environments
- name: sdc-localtime
hostPath:
path: /etc/localtime
- name: sdc-logs
hostPath:
- path: /dockerdata-nfs/onapdemo/sdc/logs
+ path: /dockerdata-nfs/onap/sdc/logs
imagePullSecrets:
- name: onap-docker-registry-key
diff --git a/kubernetes/sdc/values.yaml b/kubernetes/sdc/values.yaml
new file mode 100644
index 0000000..066f0d0
--- /dev/null
+++ b/kubernetes/sdc/values.yaml
@@ -0,0 +1,9 @@
+NS: onap-sdc
+pullPolicy: Always
+image:
+ readiness: oomk8s/readiness-check:1.0.0
+ sdcKibana: nexus3.onap.org:10001/openecomp/sdc-kibana:1.1-STAGING-latest
+ sdcFrontend: nexus3.onap.org:10001/openecomp/sdc-frontend:1.1-STAGING-latest
+ sdcElasticsearch: nexus3.onap.org:10001/openecomp/sdc-elasticsearch:1.1-STAGING-latest
+ sdcCassandra: nexus3.onap.org:10001/openecomp/sdc-cassandra:1.1-STAGING-latest
+ sdcBackend: nexus3.onap.org:10001/openecomp/sdc-backend:1.1-STAGING-latest