diff options
author | Mike Elliott <mike.elliott@amdocs.com> | 2018-02-28 08:33:33 -0500 |
---|---|---|
committer | Alexis de Talhouƫt <alexis.de_talhouet@bell.ca> | 2018-03-24 12:08:18 +0000 |
commit | 13fed1118cedf88ea65a92d27f550d02fe23c41a (patch) | |
tree | 55d8790ce0fcee512d34df8e5ccc2a639d85abc9 /kubernetes | |
parent | 7aa968bb23b924f714a6bfe3436a3ec438bff69a (diff) |
Add standardized helm chart for appc
This is a standardization (based on helm community best practices)
of a Helm chart for the Application Controller (appc) in ONAP.
How to deploy the helm chart (outside of the parent onap chart) from
the local oom/kubernetes codebase.
Run local helm repository in the background:
$ nohup helm serve &
In kubernetes directory run:
$ make all
2 ways to install (--set are for testing purposes)
Full onap:
$ helm install onap --name onap --namespace onap --set global.pullPolicy=Never,mysql.replicaCount=2,appc.replicaCount=2
Appc only:
$ helm install setup --name onap-setup --namespace onap-apps
$ helm install appc --name appc --namespace onap-apps
Change-Id: Ib780f979ad25ecafb08110504b5941e980ca8a95
Issue-ID: OOM-733
Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
Signed-off-by: ah415j <ah415j@att.com>
Diffstat (limited to 'kubernetes')
60 files changed, 1480 insertions, 698 deletions
diff --git a/kubernetes/Makefile b/kubernetes/Makefile index 000be48048..9cbf90fba7 100644 --- a/kubernetes/Makefile +++ b/kubernetes/Makefile @@ -1,5 +1,8 @@ PARENT_CHART := onap COMMON_CHARTS_DIR := common +SETUP_CHARTS_DIR := setup +#Order is important +SHARED_CHARTS := common setup mysql dgbuilder # FIXME OOM-765 ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) OUTPUT_DIR := $(ROOT_DIR)/dist @@ -7,6 +10,7 @@ PACKAGE_DIR := $(OUTPUT_DIR)/packages SECRET_DIR := $(OUTPUT_DIR)/secrets EXCLUDES := $(COMMON_CHARTS_DIR) config oneclick readiness test dist helm $(PARENT_CHART) dcae +EXCLUDES := $(SHARED_CHARTS) config oneclick readiness test dist $(PARENT_CHART) dcae HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) $(PARENT_CHART) .PHONY: $(EXCLUDES) $(HELM_CHARTS) @@ -14,6 +18,9 @@ HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) $(PA all: $(COMMON_CHARTS_DIR) $(HELM_CHARTS) common: +all: $(SHARED_CHARTS) $(HELM_CHARTS) + +$(SHARED_CHARTS): @echo "\n[$@]" @make package-$@ @@ -39,4 +46,4 @@ clean: @rm -f *tgz */charts/*tgz @rm -rf $(PACKAGE_DIR) %: - @:
\ No newline at end of file + @: diff --git a/kubernetes/appc/.helmignore b/kubernetes/appc/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/appc/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/kubernetes/appc/Chart.yaml b/kubernetes/appc/Chart.yaml index f0af9b318a..ca35cd16c4 100644 --- a/kubernetes/appc/Chart.yaml +++ b/kubernetes/appc/Chart.yaml @@ -13,6 +13,6 @@ # limitations under the License. apiVersion: v1 -description: A Helm chart for Kubernetes +description: Application Controller name: appc -version: 0.1.0 +version: 2.0.0 diff --git a/kubernetes/appc/requirements.yaml b/kubernetes/appc/requirements.yaml new file mode 100644 index 0000000000..1ca4de1815 --- /dev/null +++ b/kubernetes/appc/requirements.yaml @@ -0,0 +1,10 @@ +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' + - name: mysql + version: ~2.0.0 + repository: '@local' + - name: dgbuilder + version: ~2.0.0 + repository: '@local'
\ No newline at end of file diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/bin/installAppcDb.sh b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/installAppcDb.sh index 526d6f94ae..f260f3d84a 100755 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/bin/installAppcDb.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/installAppcDb.sh @@ -20,7 +20,7 @@ SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} APPC_HOME=${APPC_HOME:-/opt/openecomp/appc} -MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} +MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} APPC_DB_USER=${APPC_DB_USER:-appcctl} APPC_DB_PASSWD=${APPC_DB_PASSWD:-appcctl} @@ -28,7 +28,7 @@ APPC_DB_DATABASE=${SDN_DB_DATABASE:-appcctl} # Create tablespace and user account -mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} mysql <<-END +mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END CREATE DATABASE ${APPC_DB_DATABASE}; CREATE USER '${APPC_DB_USER}'@'localhost' IDENTIFIED BY '${APPC_DB_PASSWD}'; CREATE USER '${APPC_DB_USER}'@'%' IDENTIFIED BY '${APPC_DB_PASSWD}'; @@ -39,16 +39,16 @@ END if [ -f ${APPC_HOME}/data/appcctl.dump ] then - mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} appcctl < ${APPC_HOME}/data/appcctl.dump + mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} appcctl < ${APPC_HOME}/data/appcctl.dump fi if [ -f ${APPC_HOME}/data/sdnctl.dump ] then - mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sdnctl.dump + mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sdnctl.dump fi if [ -f ${APPC_HOME}/data/sqlData.dump ] then - mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sqlData.dump + mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} sdnctl < ${APPC_HOME}/data/sqlData.dump fi diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/bin/startODL.sh b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh index ba4ff52147..0b9e63127b 100755 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/bin/startODL.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x ### # ============LICENSE_START======================================================= @@ -26,12 +26,39 @@ # if not already installed, and starts the APPC Docker Container # +function enable_odl_cluster(){ + if [ -z $APPC_REPLICAS ]; then + echo "APPC_REPLICAS is not configured in Env field" + exit + fi + + echo "Installing Opendaylight cluster features" + ${ODL_HOME}/bin/client -u karaf feature:install odl-mdsal-clustering + ${ODL_HOME}/bin/client -u karaf feature:install odl-jolokia + + echo "Update cluster information statically" + hm=$(hostname) + echo "Get current Hostname ${hm}" + + node=($(echo ${hm} | sed 's/-[0-9]*$//g')) + node_index=($(echo ${hm} | awk -F"-" '{print $NF}')) + node_list="${node}-0.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}"; + + for ((i=1;i<${APPC_REPLICAS};i++)); + do + node_list="${node_list} ${node}-$i.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}" + done + + /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list} +} + ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} -APPC_HOME=${APPC_HOME:-/opt/openecomp/appc} +APPC_HOME=${APPC_HOME:-/opt/onap/appc} SLEEP_TIME=${SLEEP_TIME:-120} -MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} +MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} +ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false} # # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties @@ -55,7 +82,7 @@ echo "" >> $APPC_HOME/data/properties/appc.properties # Wait for database to init properly # echo "Waiting for mysql" -until mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} mysql &> /dev/null +until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null do printf "." sleep 1 @@ -97,6 +124,8 @@ then ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh fi + if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi + echo "Restarting OpenDaylight" ${ODL_HOME}/bin/stop echo "Installed at `date`" > ${SDNC_HOME}/.installed diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/aaiclient.properties b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaiclient.properties index 9e29744bb3..b2f7102d8c 100644 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/aaiclient.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaiclient.properties @@ -39,7 +39,7 @@ org.onap.ccsdk.sli.adaptors.aai.application=openECOMP # # Configuration file for A&AI Client # -org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Values.nsPrefix}}:8443 +org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Release.Namespace}}:8443 # query @@ -133,8 +133,8 @@ org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v11/service-design-and # UBB Notify org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v11/actions/notify -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Values.nsPrefix}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Values.nsPrefix}}:8443/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Release.Namespace}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Release.Namespace}}:8443/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information # Service org.onap.ccsdk.sli.adaptors.aai.path.service=/aai/v11/service-design-and-creation/services/service/{service-id} diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/appc.properties b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/appc.properties index de577c43cb..f4ee6fcfc7 100644 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/appc.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/appc.properties @@ -22,7 +22,7 @@ ### ### ### Properties for demo ### ### ### -appc.demo.poolMembers=dmaap.{{.Values.nsPrefix}}:3904 +appc.demo.poolMembers=dmaap.{{.Release.Namespace}}:3904 appc.demo.topic.read=APPC-CL appc.demo.topic.write=APPC-CL appc.demo.client.name=appcDemoEventListener @@ -33,7 +33,7 @@ appc.demo.threads.poolsize.max=2 appc.demo.provider.user=admin appc.demo.provider.pass=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U appc.demo.provider.url=http://localhost:8181/restconf/operations/appc-provider -appc.provider.vfodl.url=http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@appc-sdnhost.{{.Values.nsPrefix}}:8282/restconf/config/network-topology:network-topology/topology/topology-netconf/node/NODE_NAME/yang-ext:mount/sample-plugin:sample-plugin/pg-streams/ +appc.provider.vfodl.url=http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@appc-sdnhost.{{.Release.Namespace}}:8282/restconf/config/network-topology:network-topology/topology/topology-netconf/node/NODE_NAME/yang-ext:mount/sample-plugin:sample-plugin/pg-streams/ # The properties right below are needed to properly call the Master DG to serve demo purposes appc.service.logic.module.name=APPC @@ -41,11 +41,11 @@ appc.topology.dg.method=topology-operation-all appc.topology.dg.version=2.0.0 # TEMP - Properties that might be needed to make the AAI-APPC connection -org.openecomp.appc.db.url.appcctl=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/appcctl +org.openecomp.appc.db.url.appcctl=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/appcctl org.openecomp.appc.db.user.appcctl=appcctl org.openecomp.appc.db.pass.appcctl=appcctl -org.openecomp.appc.db.url.sdnctl=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.openecomp.appc.db.url.sdnctl=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.openecomp.appc.db.user.sdnctl=sdnctl org.openecomp.appc.db.pass.sdnctl=gamma @@ -74,11 +74,11 @@ provider1.tenant1.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U # Property below is valid in appc-command-executor-core, appc-license-manager-core, appc-lifecycle-management-core, # appc-request-handler-core, appc-workflow-management-core (all from the appc-dispatcher package). -dmaap.poolMembers=dmaap.{{.Values.nsPrefix}}:3904 +dmaap.poolMembers=dmaap.{{.Release.Namespace}}:3904 # appc-event-listener-bundle properties (only defined in src/test of default.properties) -appc.LCM.poolMembers=dmaap.{{.Values.nsPrefix}}:3904 +appc.LCM.poolMembers=dmaap.{{.Release.Namespace}}:3904 appc.LCM.topic.read=APPC-LCM-READ appc.LCM.topic.write=APPC-LCM-WRITE appc.LCM.client.name=APPC-EVENT-LISTENER-TEST @@ -87,8 +87,8 @@ appc.LCM.provider.pass=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U appc.LCM.provider.url=http://localhost:8181/restconf/operations/appc-provider-lcm # properties from appc-netconf-adapter-bundle, appc-dg-common, appc-dmaap-adapter-bundle -poolMembers=dmaap.{{.Values.nsPrefix}}:3904 -event.pool.members=dmaap.{{.Values.nsPrefix}}:3904 +poolMembers=dmaap.{{.Release.Namespace}}:3904 +event.pool.members=dmaap.{{.Release.Namespace}}:3904 restconf.user=admin restconf.pass=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U @@ -106,7 +106,7 @@ test.url=http://api.appc.local/vm/9999999/test/99999999-9999-9999-9999-999999999 org.openecomp.appc.iaas.skiphypervisorcheck=true # Properties from default.properties in the src/test and src/main paths of appc-asdc-listener-bundle -appc.sdc.host=sdc-be.{{.Values.nsPrefix}}:8443 +appc.sdc.host=sdc-be.{{.Release.Namespace}}:8443 appc.sdc.env=APPC-ASDC-ENV appc.sdc.user=test appc.sdc.pass=test @@ -118,12 +118,12 @@ appc.sdc.provider.url=http://localhost:8181/restconf/operations/AsdcMessage:conf DCAE.dmaap.event.topic.write=EventSenderTest DCAE.dmaap.appc.username=test DCAE.dmaap.appc.password=test -DCAE.dmaap.event.pool.members=dmaap.{{.Values.nsPrefix}}:3904 +DCAE.dmaap.event.pool.members=dmaap.{{.Release.Namespace}}:3904 #OAM Listener appc.OAM.disabled=true appc.OAM.provider.url=http://localhost:8181/restconf/operations/appc-oam -appc.OAM.poolMembers=dmaap.{{.Values.nsPrefix}}:3904 +appc.OAM.poolMembers=dmaap.{{.Release.Namespace}}:3904 appc.OAM.service=ueb appc.OAM.topic.read=testOAM appc.OAM.topic.write=testOAM diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/dblib.properties b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/dblib.properties index 888ee9f0d9..17b7ffdfb0 100644 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/dblib.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/dblib.properties @@ -22,7 +22,7 @@ org.onap.ccsdk.sli.dbtype=jdbc org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/svclogic.properties index ea38616810..fd62b08b5f 100644 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/data/properties/svclogic.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/svclogic.properties @@ -20,7 +20,7 @@ org.onap.ccsdk.sli.dbtype = dblib #Note : the next 4 fields are only used if org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl org.onap.ccsdk.sli.jdbc.password=gamma diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/bin/showActiveGraphs.sh b/kubernetes/appc/resources/config/appc/opt/onap/appc/svclogic/bin/showActiveGraphs.sh index 5409d9e552..03ad425242 100755 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/bin/showActiveGraphs.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/svclogic/bin/showActiveGraphs.sh @@ -22,7 +22,7 @@ MYSQL_USER=${MYSQL_USER:-sdnctl} MYSQL_PWD=${MYSQL_PWD:-gamma} MYSQL_DB=${MYSQL_DB:-sdnctl} -MYSQL_HOST=${MYSQL_HOST:-appc-dbhost.{{.Values.nsPrefix}}} +MYSQL_HOST=${MYSQL_HOST:-{{.Values.mysql.service.name}}.{{.Release.Namespace}}} mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host=${MYSQL_HOST} ${MYSQL_DB} <<-END SELECT module, rpc, version, mode from SVC_LOGIC where active='Y'; diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/onap/appc/svclogic/config/svclogic.properties index 2f67a5822f..bd581e0241 100644 --- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/svclogic/config/svclogic.properties @@ -20,7 +20,7 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.database = sdnctl org.onap.ccsdk.sli.jdbc.user = sdnctl org.onap.ccsdk.sli.jdbc.password = gamma diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/installSdncDb.sh b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/installSdncDb.sh index 75680bd942..25560fbef4 100755 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/installSdncDb.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/installSdncDb.sh @@ -22,7 +22,7 @@ ### SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} -MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} +MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} SDNC_DB_USER=${SDNC_DB_USER:-sdnctl} SDNC_DB_PASSWD=${SDNC_DB_PASSWD:-gamma} @@ -30,7 +30,7 @@ SDNC_DB_DATABASE=${SDN_DB_DATABASE:-sdnctl} # Create tablespace and user account -mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} mysql <<-END +mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END CREATE DATABASE ${SDNC_DB_DATABASE}; CREATE USER '${SDNC_DB_USER}'@'localhost' IDENTIFIED BY '${SDNC_DB_PASSWD}'; CREATE USER '${SDNC_DB_USER}'@'%' IDENTIFIED BY '${SDNC_DB_PASSWD}'; @@ -41,6 +41,6 @@ END if [ -f ${SDNC_HOME}/data/odlsli.dump ] then -mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} sdnctl < ${SDNC_HOME}/data/odlsli.dump +mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} sdnctl < ${SDNC_HOME}/data/odlsli.dump fi diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/startODL.sh b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/startODL.sh index 87c95ee3b3..a84893c00f 100755 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/startODL.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/bin/startODL.sh @@ -28,13 +28,13 @@ ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} SLEEP_TIME=${SLEEP_TIME:-120} -MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} +MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} # # Wait for database # echo "Waiting for mysql" -until mysql -h appc-dbhost.{{.Values.nsPrefix}} -u root -p${MYSQL_PASSWD} mysql &> /dev/null +until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null do printf "." sleep 1 diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/aaiclient.properties b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/aaiclient.properties index 9e29744bb3..b2f7102d8c 100644 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/aaiclient.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/aaiclient.properties @@ -39,7 +39,7 @@ org.onap.ccsdk.sli.adaptors.aai.application=openECOMP # # Configuration file for A&AI Client # -org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Values.nsPrefix}}:8443 +org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Release.Namespace}}:8443 # query @@ -133,8 +133,8 @@ org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v11/service-design-and # UBB Notify org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v11/actions/notify -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Values.nsPrefix}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Values.nsPrefix}}:8443/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Release.Namespace}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Release.Namespace}}:8443/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information # Service org.onap.ccsdk.sli.adaptors.aai.path.service=/aai/v11/service-design-and-creation/services/service/{service-id} diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/dblib.properties b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/dblib.properties index 6107a80416..f603977013 100644 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/dblib.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/dblib.properties @@ -23,7 +23,7 @@ org.onap.ccsdk.sli.dbtype=jdbc org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/svclogic.properties index 2954bb00a5..908d60a089 100644 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/svclogic.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/data/properties/svclogic.properties @@ -21,7 +21,7 @@ org.onap.ccsdk.sli.dbtype = dblib #Note : the next 4 fields are only used if org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl org.onap.ccsdk.sli.jdbc.password=gamma diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh index ceeea5914f..a568dfdc20 100755 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh @@ -22,7 +22,7 @@ MYSQL_USER=${MYSQL_USER:-sdnctl} MYSQL_PWD=${MYSQL_PWD:-gamma} MYSQL_DB=${MYSQL_DB:-sdnctl} -MYSQL_HOST=${MYSQL_HOST:-appc-dbhost.{{.Values.nsPrefix}}} +MYSQL_HOST=${MYSQL_HOST:-{{.Values.mysql.service.name}}.{{.Release.Namespace}}} mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host=${MYSQL_HOST} ${MYSQL_DB} <<-END SELECT module, rpc, version, mode from SVC_LOGIC where active='Y'; diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties index bcf321c947..44ae32f9cc 100644 --- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties +++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties @@ -20,7 +20,7 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl org.onap.ccsdk.sli.jdbc.database = sdnctl org.onap.ccsdk.sli.jdbc.user = sdnctl org.onap.ccsdk.sli.jdbc.password = gamma diff --git a/kubernetes/appc/resources/config/log/filebeat/log4j/filebeat.yml b/kubernetes/appc/resources/config/log/filebeat/log4j/filebeat.yml index 2cd63e1d98..52161aafad 100644 --- a/kubernetes/appc/resources/config/log/filebeat/log4j/filebeat.yml +++ b/kubernetes/appc/resources/config/log/filebeat/log4j/filebeat.yml @@ -29,7 +29,7 @@ output.logstash: #List of logstash server ip addresses with port number. #But, in our case, this will be the loadbalancer IP address. #For the below property to work the loadbalancer or logstash should expose 5044 port to listen the filebeat events or port in the property should be changed appropriately. - hosts: ["logstash.{{.Values.nsPrefix}}:5044"] + hosts: ["logstash.{{.Release.Namespace}}:5044"] #If enable will do load balancing among availabe Logstash, automatically. loadbalance: true diff --git a/kubernetes/appc/templates/NOTES.txt b/kubernetes/appc/templates/NOTES.txt new file mode 100644 index 0000000000..24371d08ab --- /dev/null +++ b/kubernetes/appc/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ include "common.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "so.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/appc/templates/all-services.yaml b/kubernetes/appc/templates/all-services.yaml deleted file mode 100644 index 09c8110904..0000000000 --- a/kubernetes/appc/templates/all-services.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppcDbhost }} -apiVersion: v1 -kind: Service -metadata: - name: appc-dbhost - namespace: "{{ .Values.nsPrefix }}" - labels: - app: appc-dbhost -spec: - ports: - - name: "appc-dbhost-port" - port: 3306 - selector: - app: appc-dbhost - clusterIP: None ---- -apiVersion: v1 -kind: Service -metadata: - name: appc-sdnctldb01 - namespace: "{{ .Values.nsPrefix }}" - labels: - app: appc-dbhost -spec: - ports: - - port: 3306 - selector: - app: appc-dbhost - clusterIP: None ---- -apiVersion: v1 -kind: Service -metadata: - name: appc-sdnctldb02 - namespace: "{{ .Values.nsPrefix }}" - labels: - app: appc-dbhost -spec: - ports: - - port: 3306 - selector: - app: appc-dbhost - clusterIP: None -#{{ end }} -#{{ if not .Values.disableAppcAppc }} ---- -apiVersion: v1 -kind: Service -metadata: - name: appc-sdnhost - namespace: "{{ .Values.nsPrefix }}" - labels: - app: appc -spec: - ports: - - name: "appc-port-8282" - port: 8282 - targetPort: 8181 - nodePort: {{ .Values.nodePortPrefix }}30 - - name: "appc-port-1830" - port: 1830 - nodePort: {{ .Values.nodePortPrefix }}31 - type: NodePort - selector: - app: appc -#{{ end }} -#{{ if not .Values.disableAppcAppcDgbuilder }} ---- -apiVersion: v1 -kind: Service -metadata: - name: appc-dgbuilder - namespace: "{{ .Values.nsPrefix }}" - labels: - app: appc-dgbuilder -spec: - ports: - - name: "appc-dgbuilder-port" - port: 3000 - targetPort: 3100 - nodePort: {{ .Values.nodePortPrefix }}28 - type: NodePort - selector: - app: appc-dgbuilder -#{{ end }} diff --git a/kubernetes/appc/templates/appc-configmap.yaml b/kubernetes/appc/templates/appc-configmap.yaml deleted file mode 100644 index c5500a4c4c..0000000000 --- a/kubernetes/appc/templates/appc-configmap.yaml +++ /dev/null @@ -1,87 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppc }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-openecomp-appc-data-properties-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/openecomp/appc/data/properties/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-openecomp-appc-svclogic-config-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-openecomp-appc-svclogic-bin-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/openecomp/appc/svclogic/bin/showActiveGraphs.sh").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-openecomp-appc-bin-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/openecomp/appc/bin/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-onap-sdnc-data-properties-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/data/properties/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-onap-sdnc-svclogic-config-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-onap-sdnc-svclogic-bin-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-onap-sdnc-bin-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/bin/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-scripts-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/scripts/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/appc/templates/appc-deployment.yaml b/kubernetes/appc/templates/appc-deployment.yaml deleted file mode 100644 index c80bdd40ec..0000000000 --- a/kubernetes/appc/templates/appc-deployment.yaml +++ /dev/null @@ -1,181 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppc }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: appc - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.appcReplicas }} - selector: - matchLabels: - app: appc - template: - metadata: - labels: - app: appc - name: appc - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - appc-db-container - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: appc-readiness - containers: - - command: - - /opt/openecomp/appc/bin/startODL.sh - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - - name: SDNC_CONFIG_DIR - value: /opt/openecomp/appc/data/properties - - name: APPC_CONFIG_DIR - value: /opt/openecomp/appc/data/properties - - name: DMAAP_TOPIC_ENV - value: SUCCESS - - name: MYSQL_HOST - value: appc-dbhost - image: {{ .Values.image.appc }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: appc-controller-container - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /opt/openecomp/appc/data/properties/dblib.properties - name: appc-openecomp-appc-data-properties - subPath: dblib.properties - - mountPath: /opt/openecomp/appc/data/properties/svclogic.properties - name: appc-openecomp-appc-data-properties - subPath: svclogic.properties - - mountPath: /opt/openecomp/appc/data/properties/appc.properties - name: appc-openecomp-appc-data-properties - subPath: appc.properties - - mountPath: /opt/openecomp/appc/data/properties/aaiclient.properties - name: appc-openecomp-appc-data-properties - subPath: aaiclient.properties - - mountPath: /opt/openecomp/appc/svclogic/config/svclogic.properties - name: appc-openecomp-appc-svclogic-config - subPath: svclogic.properties - - mountPath: /opt/openecomp/appc/svclogic/bin/showActiveGraphs.sh - name: appc-openecomp-appc-svclogic-bin - subPath: showActiveGraphs.sh - - mountPath: /opt/openecomp/appc/bin/startODL.sh - name: appc-openecomp-appc-bin - subPath: startODL.sh - - mountPath: /opt/openecomp/appc/bin/installAppcDb.sh - name: appc-openecomp-appc-bin - subPath: installAppcDb.sh - - mountPath: /opt/onap/sdnc/data/properties/dblib.properties - name: appc-onap-sdnc-data-properties - subPath: dblib.properties - - mountPath: /opt/onap/sdnc/data/properties/svclogic.properties - name: appc-onap-sdnc-data-properties - subPath: svclogic.properties - - mountPath: /opt/onap/sdnc/data/properties/aaiclient.properties - name: appc-onap-sdnc-data-properties - subPath: aaiclient.properties - - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties - name: appc-onap-sdnc-svclogic-config - subPath: svclogic.properties - - mountPath: /opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh - name: appc-onap-sdnc-svclogic-bin - subPath: showActiveGraphs.sh - - mountPath: /opt/onap/sdnc/bin/startODL.sh - name: appc-onap-sdnc-bin - subPath: startODL.sh - - mountPath: /opt/onap/sdnc/bin/installSdncDb.sh - name: appc-onap-sdnc-bin - subPath: installSdncDb.sh - - mountPath: /var/log/onap - name: appc-logs - - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg - name: appc-log-config - subPath: org.ops4j.pax.logging.cfg - ports: - - containerPort: 8181 - - containerPort: 1830 - readinessProbe: - tcpSocket: - port: 8181 - initialDelaySeconds: 5 - periodSeconds: 10 - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - subPath: filebeat.yml - - mountPath: /var/log/onap - name: appc-logs - - mountPath: /usr/share/filebeat/data - name: appc-data-filebeat - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: filebeat-conf - configMap: - name: appc-filebeat-configmap - - name: appc-log-config - configMap: - name: appc-logging-cfg-configmap - - name: appc-logs - emptyDir: {} - - name: appc-data-filebeat - emptyDir: {} - - name: appc-openecomp-appc-data-properties - configMap: - name: appc-openecomp-appc-data-properties-configmap - - name: appc-openecomp-appc-svclogic-config - configMap: - name: appc-openecomp-appc-svclogic-config-configmap - - name: appc-openecomp-appc-svclogic-bin - configMap: - name: appc-openecomp-appc-svclogic-bin-configmap - defaultMode: 0755 - - name: appc-openecomp-appc-bin - configMap: - name: appc-openecomp-appc-bin-configmap - defaultMode: 0755 - - name: appc-onap-sdnc-data-properties - configMap: - name: appc-onap-sdnc-data-properties-configmap - - name: appc-onap-sdnc-svclogic-config - configMap: - name: appc-onap-sdnc-svclogic-config-configmap - - name: appc-onap-sdnc-svclogic-bin - configMap: - name: appc-onap-sdnc-svclogic-bin-configmap - defaultMode: 0755 - - name: appc-onap-sdnc-bin - configMap: - name: appc-onap-sdnc-bin-configmap - defaultMode: 0755 - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/appc/templates/appc-dgbuilder-configmap.yaml b/kubernetes/appc/templates/appc-dgbuilder-configmap.yaml deleted file mode 100644 index d3ccf8f956..0000000000 --- a/kubernetes/appc/templates/appc-dgbuilder-configmap.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppc }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-dgbuilder-conf-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/dgbuilder/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-dgbuilder-scripts-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/scripts/dgbuilder/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/appc/templates/appc-log-configmap.yaml b/kubernetes/appc/templates/appc-log-configmap.yaml deleted file mode 100644 index a8e1e24247..0000000000 --- a/kubernetes/appc/templates/appc-log-configmap.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppc }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-filebeat-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/filebeat/log4j/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: appc-logging-cfg-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/appc/templates/appc-pv-pvc.yaml b/kubernetes/appc/templates/appc-pv-pvc.yaml deleted file mode 100644 index 59bf7859e5..0000000000 --- a/kubernetes/appc/templates/appc-pv-pvc.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppcDbhost }} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: "{{ .Values.nsPrefix }}-appc" - namespace: "{{ .Values.nsPrefix }}" - labels: - name: "{{ .Values.nsPrefix }}-appc" -spec: - capacity: - storage: 2Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/appc/data ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: appc-db - namespace: "{{ .Values.nsPrefix }}" -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 2Gi - selector: - matchLabels: - name: "{{ .Values.nsPrefix }}-appc" -#{{ end }} diff --git a/kubernetes/appc/templates/configmap.yaml b/kubernetes/appc/templates/configmap.yaml new file mode 100644 index 0000000000..0574cfcf22 --- /dev/null +++ b/kubernetes/appc/templates/configmap.yaml @@ -0,0 +1,79 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-sdnc-bin + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/bin/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-sdnc-data-properties + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/data/properties/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-bin + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/svclogic/bin/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/sdnc/svclogic/config/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-appc-bin + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/appc/bin/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-appc-data-properties + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/appc/data/properties/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-appc-svclogic-bin + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/appc/svclogic/bin/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-appc-svclogic-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/appc/opt/onap/appc/svclogic/config/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-filebeat + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/filebeat/log4j/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-logging-cfg + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} diff --git a/kubernetes/appc/templates/db-deployment.yaml b/kubernetes/appc/templates/db-deployment.yaml deleted file mode 100644 index 0843d60072..0000000000 --- a/kubernetes/appc/templates/db-deployment.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppcDbhost }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: appc-dbhost - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.dbReplicas }} - selector: - matchLabels: - app: appc-dbhost - template: - metadata: - labels: - app: appc-dbhost - spec: - containers: - - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - - name: MYSQL_ROOT_HOST - value: '%' - image: {{ .Values.image.mysqlServer }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: appc-db-container - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /var/lib/mysql - name: appc-data - ports: - - containerPort: 3306 - readinessProbe: - tcpSocket: - port: 3306 - initialDelaySeconds: 5 - periodSeconds: 10 - restartPolicy: Always - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: appc-data - persistentVolumeClaim: - claimName: appc-db - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/appc/templates/dgbuilder-deployment.yaml b/kubernetes/appc/templates/dgbuilder-deployment.yaml deleted file mode 100644 index dc35dfb950..0000000000 --- a/kubernetes/appc/templates/dgbuilder-deployment.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# 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. - -#{{ if not .Values.disableAppcAppcDgbuilder }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: appc-dgbuilder - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.dgbuilderReplicas }} - selector: - matchLabels: - app: appc-dgbuilder - template: - metadata: - labels: - app: appc-dgbuilder - name: appc-dgbuilder - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - appc-db-container - - --container-name - - appc-controller-container - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: appc-dgbuilder-readiness - containers: - - command: - - /bin/bash - - -c - - cd /opt/onap/sdnc/dgbuilder/ && ./start.sh sdnc1.0 && wait - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - - name: SDNC_CONFIG_DIR - value: /opt/onap/sdnc/data/properties - image: {{ .Values.image.dgbuilderSdnc }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: appc-dgbuilder-container - ports: - - containerPort: 3100 - readinessProbe: - tcpSocket: - port: 3100 - initialDelaySeconds: 5 - periodSeconds: 10 - volumeMounts: - - name: localtime - mountPath: /etc/localtime - readOnly: true - - name: dgbuilder-conf - mountPath: /opt/onap/sdnc/dgbuilder/releases/sdnc1.0/conf/svclogic.properties - subPath: svclogic.properties - - name: dgbuilder-conf - mountPath: /opt/onap/sdnc/dgbuilder/svclogic/svclogic.properties - subPath: svclogic.properties - - name: dgbuilder-scripts - mountPath: /opt/onap/sdnc/dgbuilder/createReleaseDir.sh - subPath: createReleaseDir.sh - - name: dgbuilder-scripts - mountPath: /opt/onap/sdnc/dgbuilder/releases/sdnc1.0/customSettings.js - subPath: customSettings.js - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: dgbuilder-conf - configMap: - name: appc-dgbuilder-conf-configmap - - name: dgbuilder-scripts - configMap: - name: appc-dgbuilder-scripts-configmap - defaultMode: 0755 - restartPolicy: Always - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/appc/templates/secrets.yaml b/kubernetes/appc/templates/secrets.yaml new file mode 100644 index 0000000000..345c194d96 --- /dev/null +++ b/kubernetes/appc/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }} diff --git a/kubernetes/appc/templates/service.yaml b/kubernetes/appc/templates/service.yaml new file mode 100644 index 0000000000..6ffef221a6 --- /dev/null +++ b/kubernetes/appc/templates/service.yaml @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Service +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 }} + annotations: + msb.onap.org/service-info: '[ + { + "serviceName": "appc", + "version": "v1", + "url": "/", + "protocol": "REST", + "port": "{{ .Values.service.externalPort }}", + "visualRange":"1", + "path": "/" + } + ]' +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: "{{ .Values.service.name }}-8282" + - port: {{ .Values.service.externalPort2 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} + name: "{{ .Values.service.name }}-1830" + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }}-cluster + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +spec: + ports: + - name: "{{ .Values.service.name }}-cluster-port" + port: {{ .Values.service.clusterPort }} + clusterIP: None + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + sessionAffinity: None + type: ClusterIP diff --git a/kubernetes/appc/templates/statefulset.yaml b/kubernetes/appc/templates/statefulset.yaml new file mode 100644 index 0000000000..6ecfc19342 --- /dev/null +++ b/kubernetes/appc/templates/statefulset.yaml @@ -0,0 +1,186 @@ +apiVersion: apps/v1beta1 +kind: StatefulSet +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: + serviceName: "{{ .Values.service.name }}-cluster" + replicas: {{ .Values.replicaCount }} + podManagementPolicy: Parallel + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - {{ .Values.mysql.nameOverride }} + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness + containers: + - name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /opt/appc/bin/startODL.sh + ports: + - containerPort: {{ .Values.service.internalPort }} + - containerPort: {{ .Values.service.externalPort2 }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + - name: SDNC_CONFIG_DIR + value: "{{ .Values.config.configDir }}" + - name: APPC_CONFIG_DIR + value: "{{ .Values.config.configDir }}" + - name: DMAAP_TOPIC_ENV + value: "{{ .Values.config.dmaapTopic }}" + - name: ENABLE_ODL_CLUSTER + value: "{{ .Values.config.enableClustering }}" + - name: APPC_REPLICAS + value: "{{ .Values.replicaCount }}" + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /opt/onap/appc/data/properties/dblib.properties + name: onap-appc-data-properties + subPath: dblib.properties + - mountPath: /opt/onap/appc/data/properties/svclogic.properties + name: onap-appc-data-properties + subPath: svclogic.properties + - mountPath: /opt/onap/appc/data/properties/appc.properties + name: onap-appc-data-properties + subPath: appc.properties + - mountPath: /opt/onap/appc/data/properties/aaiclient.properties + name: onap-appc-data-properties + subPath: aaiclient.properties + - mountPath: /opt/onap/appc/svclogic/config/svclogic.properties + name: onap-appc-svclogic-config + subPath: svclogic.properties + - mountPath: /opt/onap/appc/svclogic/bin/showActiveGraphs.sh + name: onap-appc-svclogic-bin + subPath: showActiveGraphs.sh + - mountPath: /opt/onap/appc/bin/startODL.sh + name: onap-appc-bin + subPath: startODL.sh + - mountPath: /opt/onap/appc/bin/installAppcDb.sh + name: onap-appc-bin + subPath: installAppcDb.sh + - mountPath: /opt/onap/sdnc/data/properties/dblib.properties + name: onap-sdnc-data-properties + subPath: dblib.properties + - mountPath: /opt/onap/sdnc/data/properties/svclogic.properties + name: onap-sdnc-data-properties + subPath: svclogic.properties + - mountPath: /opt/onap/sdnc/data/properties/aaiclient.properties + name: onap-sdnc-data-properties + subPath: aaiclient.properties + - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties + name: onap-sdnc-svclogic-config + subPath: svclogic.properties + - mountPath: /opt/onap/sdnc/svclogic/bin/showActiveGraphs.sh + name: onap-sdnc-svclogic-bin + subPath: showActiveGraphs.sh + - mountPath: /opt/onap/sdnc/bin/startODL.sh + name: onap-sdnc-bin + subPath: startODL.sh + - mountPath: /opt/onap/sdnc/bin/installSdncDb.sh + name: onap-sdnc-bin + subPath: installSdncDb.sh + - mountPath: /var/log/onap + name: logs + - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg + name: log-config + subPath: org.ops4j.pax.logging.cfg + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + + # side car containers + - name: filebeat-onap + image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - mountPath: /usr/share/filebeat/filebeat.yml + name: filebeat-conf + subPath: filebeat.yml + - mountPath: /var/log/onap + name: logs + - mountPath: /usr/share/filebeat/data + name: data-filebeat + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: filebeat-conf + configMap: + name: {{ include "common.fullname" . }}-filebeat + - name: log-config + configMap: + name: {{ include "common.fullname" . }}-logging-cfg + - name: logs + emptyDir: {} + - name: data-filebeat + emptyDir: {} + - name: onap-appc-data-properties + configMap: + name: {{ include "common.fullname" . }}-onap-appc-data-properties + - name: onap-appc-svclogic-config + configMap: + name: {{ include "common.fullname" . }}-onap-appc-svclogic-config + - name: onap-appc-svclogic-bin + configMap: + name: {{ include "common.fullname" . }}-onap-appc-svclogic-bin + defaultMode: 0755 + - name: onap-appc-bin + configMap: + name: {{ include "common.fullname" . }}-onap-appc-bin + defaultMode: 0755 + - name: onap-sdnc-data-properties + configMap: + name: {{ include "common.fullname" . }}-onap-sdnc-data-properties + - name: onap-sdnc-svclogic-config + configMap: + name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config + - name: onap-sdnc-svclogic-bin + configMap: + name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-bin + defaultMode: 0755 + - name: onap-sdnc-bin + configMap: + name: {{ include "common.fullname" . }}-onap-sdnc-bin + defaultMode: 0755 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/appc/values.yaml b/kubernetes/appc/values.yaml index e2d2ce6b2a..e31980a990 100644 --- a/kubernetes/appc/values.yaml +++ b/kubernetes/appc/values.yaml @@ -12,16 +12,104 @@ # See the License for the specific language governing permissions and # limitations under the License. -nsPrefix: onap +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.1.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 +# If mountPath is over NFS (e.g. /dockerdata-nfs is NFS mounted between the nodes), uncomment following lines. +# persistence: +# mountPath: /dockerdata + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/appc-image:1.3.0-SNAPSHOT-latest pullPolicy: Always -nodePortPrefix: 302 -appcReplicas: 1 -dbReplicas: 1 -dgbuilderReplicas: 1 -dataRootDir: /dockerdata-nfs -image: - readiness: oomk8s/readiness-check:1.1.0 - appc: nexus3.onap.org:10001/openecomp/appc-image:v1.2.0 - mysqlServer: mysql/mysql-server:5.6 - dgbuilderSdnc: nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:v0.1.0 - filebeat: docker.elastic.co/beats/filebeat:5.5.0 + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + dbRootPassword: openECOMP1.0 + enableClustering: true + configDir: /opt/onap/appc/data/properties + dmaapTopic: SUCCESS + +mysql: + nameOverride: appc-db + service: + name: appc-dbhost + nfsprovisionerPrefix: appc + sdnctlPrefix: appc + persistence: + mountSubPath: appc/data + enabled: true + disableNfsProvisioner: true + +dgbuilder: + nameOverride: appc-dgbuilder + dbPodName: appc-db + dbServiceName: appc-dbhost + +# default number of instances +replicaCount: 3 + +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 + +service: + type: NodePort + name: appc + #targetPort + internalPort: 8181 + #port + externalPort: 8282 + nodePort: 30 + + externalPort2: 1830 + nodePort2: 31 + clusterPort: 2550 + +ingress: + enabled: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/dgbuilder/.helmignore b/kubernetes/dgbuilder/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/dgbuilder/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/kubernetes/dgbuilder/Chart.yaml b/kubernetes/dgbuilder/Chart.yaml new file mode 100644 index 0000000000..e1955a137c --- /dev/null +++ b/kubernetes/dgbuilder/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: D.G. Builder application +name: dgbuilder +version: 2.0.0
\ No newline at end of file diff --git a/kubernetes/dgbuilder/requirements.yaml b/kubernetes/dgbuilder/requirements.yaml new file mode 100644 index 0000000000..acca8ef7e2 --- /dev/null +++ b/kubernetes/dgbuilder/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: common + version: ~2.0.0 + repository: '@local'
\ No newline at end of file diff --git a/kubernetes/appc/resources/config/dgbuilder/svclogic.properties b/kubernetes/dgbuilder/resources/config/svclogic.properties index 8b0723b72b..fdaf5779e2 100644 --- a/kubernetes/appc/resources/config/dgbuilder/svclogic.properties +++ b/kubernetes/dgbuilder/resources/config/svclogic.properties @@ -1,5 +1,5 @@ org.onap.ccsdk.sli.dbtype=jdbc -org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.dbServiceName}}.{{ include "common.namespace" . }}:3306/sdnctl org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl org.onap.ccsdk.sli.jdbc.password=gamma diff --git a/kubernetes/appc/resources/scripts/dgbuilder/createReleaseDir.sh b/kubernetes/dgbuilder/resources/scripts/createReleaseDir.sh index d63687a644..38f7fe2720 100755 --- a/kubernetes/appc/resources/scripts/dgbuilder/createReleaseDir.sh +++ b/kubernetes/dgbuilder/resources/scripts/createReleaseDir.sh @@ -15,7 +15,7 @@ releaseDir="$1" name="Release $releaseDir" loginId="$2" emailid="$3" -dbHost="appc-dbhost.{{.Values.nsPrefix}}" +dbHost="{{.Values.dbServiceName}}.{{.Release.Namespace}}" dbPort="3306" dbName="sdnctl" dbUser="sdnctl" @@ -96,7 +96,7 @@ fi if [ ! -e "./$svclogicPropFile" ] then echo "org.onap.ccsdk.sli.dbtype=jdbc" >$svclogicPropFile - echo "org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://appc-dbhost.{{.Values.nsPrefix}}:3306/sdnctl" >>$svclogicPropFile + echo "org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.dbServiceName}}.{{.Release.Namespace}}:3306/sdnctl" >>$svclogicPropFile echo "org.onap.ccsdk.sli.jdbc.database=sdnctl" >>$svclogicPropFile echo "org.onap.ccsdk.sli.jdbc.user=sdnctl" >>$svclogicPropFile echo "org.onap.ccsdk.sli.jdbc.password=gamma" >>$svclogicPropFile diff --git a/kubernetes/appc/resources/scripts/dgbuilder/customSettings.js b/kubernetes/dgbuilder/resources/scripts/customSettings.js index 40a624d44d..f09d396f96 100644 --- a/kubernetes/appc/resources/scripts/dgbuilder/customSettings.js +++ b/kubernetes/dgbuilder/resources/scripts/customSettings.js @@ -14,7 +14,7 @@ module.exports={ "user": "dguser", "pass": "cc03e747a6afbbcbf8be7668acfebee5" }, - "dbHost": "appc-dbhost.{{.Values.nsPrefix}}", + "dbHost": "{{.Values.dbServiceName}}.{{ include "common.namespace" . }}", "dbPort": "3306", "dbName": "sdnctl", "dbUser": "sdnctl", diff --git a/kubernetes/dgbuilder/templates/NOTES.txt b/kubernetes/dgbuilder/templates/NOTES.txt new file mode 100644 index 0000000000..2465e03634 --- /dev/null +++ b/kubernetes/dgbuilder/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ include "common.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ template "so.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/dgbuilder/templates/configmap.yaml b/kubernetes/dgbuilder/templates/configmap.yaml new file mode 100644 index 0000000000..7ef92d09e7 --- /dev/null +++ b/kubernetes/dgbuilder/templates/configmap.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-scripts + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/scripts/*").AsConfig . | indent 2 }} diff --git a/kubernetes/dgbuilder/templates/deployment.yaml b/kubernetes/dgbuilder/templates/deployment.yaml new file mode 100644 index 0000000000..4e1f1019ee --- /dev/null +++ b/kubernetes/dgbuilder/templates/deployment.yaml @@ -0,0 +1,98 @@ +apiVersion: extensions/v1beta1 +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 }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - {{ .Values.dbPodName }} + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness + containers: + - name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /bin/bash + - -c + - cd /opt/onap/sdnc/dgbuilder/ && ./start.sh sdnc1.0 && wait + ports: + - containerPort: {{ .Values.service.internalPort }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + - name: SDNC_CONFIG_DIR + value: /opt/onap/sdnc/data/properties + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - name: config + mountPath: /opt/app/application.properties + subPath: application.properties + - name: config + mountPath: /opt/onap/sdnc/dgbuilder/releases/sdnc1.0/conf/svclogic.properties + subPath: svclogic.properties + - name: config + mountPath: /opt/onap/sdnc/dgbuilder/svclogic/svclogic.properties + subPath: svclogic.properties + - name: scripts + mountPath: /opt/onap/sdnc/dgbuilder/createReleaseDir.sh + subPath: createReleaseDir.sh + - name: scripts + mountPath: /opt/onap/sdnc/dgbuilder/releases/sdnc1.0/customSettings.js + subPath: customSettings.js + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: config + configMap: + name: {{ include "common.fullname" . }}-config + - name: scripts + configMap: + name: {{ include "common.fullname" . }}-scripts + defaultMode: 0755 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/dgbuilder/templates/secrets.yaml b/kubernetes/dgbuilder/templates/secrets.yaml new file mode 100644 index 0000000000..7604be8239 --- /dev/null +++ b/kubernetes/dgbuilder/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }}
\ No newline at end of file diff --git a/kubernetes/dgbuilder/templates/service.yaml b/kubernetes/dgbuilder/templates/service.yaml new file mode 100644 index 0000000000..c61cdd549b --- /dev/null +++ b/kubernetes/dgbuilder/templates/service.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Service +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: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.name }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }}
\ No newline at end of file diff --git a/kubernetes/dgbuilder/values.yaml b/kubernetes/dgbuilder/values.yaml new file mode 100644 index 0000000000..23f8eea78e --- /dev/null +++ b/kubernetes/dgbuilder/values.yaml @@ -0,0 +1,93 @@ +# 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 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + + # readiness check + readinessRepository: oomk8s + readinessImage: readiness-check:1.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 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/ccsdk-dgbuilder-image:v0.1.0 +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + dbRootPassword: openECOMP1.0 + +# 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 + +service: + type: NodePort + name: dgbuilder + externalPort: 3000 + internalPort: 3100 + nodePort: 28 + +ingress: + enabled: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/mysql/.helmignore b/kubernetes/mysql/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/mysql/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/kubernetes/mysql/Chart.yaml b/kubernetes/mysql/Chart.yaml new file mode 100644 index 0000000000..99e7c44fb9 --- /dev/null +++ b/kubernetes/mysql/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: MySQL Server +name: mysql +version: 2.0.0 diff --git a/kubernetes/mysql/requirements.yaml b/kubernetes/mysql/requirements.yaml new file mode 100644 index 0000000000..acca8ef7e2 --- /dev/null +++ b/kubernetes/mysql/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: common + version: ~2.0.0 + repository: '@local'
\ No newline at end of file diff --git a/kubernetes/mysql/templates/configmap.yaml b/kubernetes/mysql/templates/configmap.yaml new file mode 100644 index 0000000000..dd2b5b7db2 --- /dev/null +++ b/kubernetes/mysql/templates/configmap.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-db-configmap + namespace: {{ include "common.namespace" . }} +data: + master.cnf: | + # Apply this config only on the master. + [mysqld] + log-bin + [localpathprefix] + master + slave.cnf: | + # Apply this config only on slaves. + [mysqld] + super-read-only + [localpathprefix] + slave diff --git a/kubernetes/mysql/templates/nfs-provisoner.yaml b/kubernetes/mysql/templates/nfs-provisoner.yaml new file mode 100644 index 0000000000..478224e1a1 --- /dev/null +++ b/kubernetes/mysql/templates/nfs-provisoner.yaml @@ -0,0 +1,62 @@ +#{{ if not .Values.disableNfsProvisioner }} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + 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 }} + strategy: + type: Recreate + template: + metadata: + labels: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + image: "{{ .Values.global.nfsprovisionerRepository | default .Values.nfsprovisionerRepository }}/{{ .Values.nfsprovisionerImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - name: nfs + containerPort: {{ .Values.service.nfsPort }} + - name: mountd + containerPort: {{ .Values.service.mountdPort }} + - name: rpcbind + containerPort: {{ .Values.service.rpcbindPort }} + - name: rpcbind-udp + containerPort: {{ .Values.service.rpcbindUdpPort }} + protocol: UDP + securityContext: + capabilities: + add: + - DAC_READ_SEARCH + - SYS_RESOURCE + args: + - "-provisioner={{ include "common.fullname" . }}/nfs" + env: + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: SERVICE_NAME + value: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - name: export-volume + mountPath: /export + volumes: + - name: export-volume + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountSubPath }} +#{{ end }} diff --git a/kubernetes/mysql/templates/pv.yaml b/kubernetes/mysql/templates/pv.yaml new file mode 100644 index 0000000000..ba128b95d0 --- /dev/null +++ b/kubernetes/mysql/templates/pv.yaml @@ -0,0 +1,22 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolume +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + name: {{ include "common.fullname" . }} +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + storageClassName: "{{ include "common.fullname" . }}-data" + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountSubPath }} +{{- end -}} diff --git a/kubernetes/mysql/templates/pvc.yaml b/kubernetes/mysql/templates/pvc.yaml new file mode 100644 index 0000000000..a2949fef36 --- /dev/null +++ b/kubernetes/mysql/templates/pvc.yaml @@ -0,0 +1,23 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + storageClassName: "{{ include "common.fullname" . }}-data" +{{- end -}}
\ No newline at end of file diff --git a/kubernetes/mysql/templates/secrets.yaml b/kubernetes/mysql/templates/secrets.yaml new file mode 100644 index 0000000000..7604be8239 --- /dev/null +++ b/kubernetes/mysql/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }}
\ No newline at end of file diff --git a/kubernetes/mysql/templates/service.yaml b/kubernetes/mysql/templates/service.yaml new file mode 100644 index 0000000000..c6a28c4605 --- /dev/null +++ b/kubernetes/mysql/templates/service.yaml @@ -0,0 +1,90 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + clusterIP: None +#{{ if not .Values.disableNfsProvisioner }} +--- +kind: Service +apiVersion: v1 +metadata: + name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + namespace: {{ include "common.namespace" . }} + labels: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner +spec: + ports: + - name: nfs + port: {{ .Values.service.nfsPort }} + - name: mountd + port: {{ .Values.service.mountdPort }} + - name: rpcbind + port: {{ .Values.service.rpcbindPort }} + - name: rpcbind-udp + port: {{ .Values.service.rpcbindUdpPort }} + protocol: UDP + selector: + app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner +#{{ end }} +--- +# Client service for connecting to any MySQL instance for reads. +# Only master: sdnc-dbhost-0 accepts the write request. +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }}-read + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.sdnctlPrefix }}-sdnctldb01 + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + clusterIP: None +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.sdnctlPrefix }}-sdnctldb02 + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} +spec: + ports: + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + clusterIP: None diff --git a/kubernetes/mysql/templates/statefulset.yaml b/kubernetes/mysql/templates/statefulset.yaml new file mode 100644 index 0000000000..7b55bf2be0 --- /dev/null +++ b/kubernetes/mysql/templates/statefulset.yaml @@ -0,0 +1,238 @@ +apiVersion: apps/v1beta1 +kind: StatefulSet +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: + serviceName: {{ .Values.service.name }} + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: +#{{ if not .Values.disableNfsProvisioner }} + - name: {{ include "common.name" . }}-readiness + command: + - /root/ready.py + args: + - --container-name + - {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} +#{{ end }} + - name: init-mysql + image: "{{ .Values.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - bash + - "-c" + - | + set -ex + # Generate mysql server-id from pod ordinal index. + [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 + ordinal=${BASH_REMATCH[1]} + echo BASH_REMATCH=${BASH_REMATCH} + echo [mysqld] > /mnt/conf.d/server-id.cnf + # Add an offset to avoid reserved server-id=0 value. + echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf + # Copy appropriate conf.d files from config-map to emptyDir. + if [[ $ordinal -eq 0 ]]; then + cp /mnt/config-map/master.cnf /mnt/conf.d/ + else + cp /mnt/config-map/slave.cnf /mnt/conf.d/ + fi + volumeMounts: + - name: conf + mountPath: /mnt/conf.d + - name: config-map + mountPath: /mnt/config-map + + - name: clone-mysql + image: "{{ .Values.global.xtrabackupRepository | default .Values.xtrabackupRepository }}/{{ .Values.xtrabackupImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + command: + - bash + - "-c" + - | + set -ex + # Skip the clone if data already exists. + [[ -d /var/lib/mysql/mysql ]] && exit 0 + # Skip the clone on master (ordinal index 0). + [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 + ordinal=${BASH_REMATCH[1]} + echo ${BASH_REMATCH} + [[ $ordinal -eq 0 ]] && exit 0 + # Clone data from previous peer. + ncat --recv-only {{ template "common.name" . }}-$(($ordinal-1)).{{ .Values.service.name }}.{{ include "common.namespace" . }} 3307 | xbstream -x -C /var/lib/mysql + # Prepare the backup. + xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --prepare --target-dir=/var/lib/mysql + ls -l /var/lib/mysql + volumeMounts: + - name: {{ include "common.fullname" . }}-data + mountPath: /var/lib/mysql + subPath: mysql + - name: conf + mountPath: /etc/mysql/conf.d + + containers: + #sdnc-db-container + - name: {{ include "common.name" . }} + image: "{{ .Values.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} + {{end -}} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + - name: MYSQL_ROOT_HOST + value: '%' + - name: MYSQL_ALLOW_EMPTY_PASSWORD + value: {{ .Values.config.dbAllowEmptyPassword | default "0" | quote }} + volumeMounts: + - mountPath: /var/lib/mysql + name: {{ include "common.fullname" . }}-data + subPath: mysql + - mountPath: /etc/mysql/conf.d + name: conf + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + + - name: xtrabackup + image: "{{ .Values.global.xtrabackupRepository | default .Values.xtrabackupRepository }}/{{ .Values.xtrabackupImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + ports: + - containerPort: {{ .Values.xtrabackup.internalPort }} + name: xtrabackup + command: + - bash + - "-c" + - | + set -ex + cd /var/lib/mysql + ls -l + # Determine binlog position of cloned data, if any. + if [[ -f xtrabackup_slave_info ]]; then + echo "Inside xtrabackup_slave_info" + # XtraBackup already generated a partial "CHANGE MASTER TO" query + # because we're cloning from an existing slave. + mv xtrabackup_slave_info change_master_to.sql.in + # Ignore xtrabackup_binlog_info in this case (it's useless). + rm -f xtrabackup_binlog_info + elif [[ -f xtrabackup_binlog_info ]]; then + echo "Inside xtrabackup_binlog_info" + # We're cloning directly from master. Parse binlog position. + [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1 + rm xtrabackup_binlog_info + echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\ + MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in + fi + + # Check if we need to complete a clone by starting replication. + if [[ -f change_master_to.sql.in ]]; then + echo "Waiting for mysqld to be ready (accepting connections)" + [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 + ordinal=${BASH_REMATCH[1]} + echo $ordinal + until mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h localhost -e "SELECT 1"; do sleep 1; done + + echo "Initializing replication from clone position" + # In case of container restart, attempt this at-most-once. + mv change_master_to.sql.in change_master_to.sql.orig + mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h localhost <<EOF + $(<change_master_to.sql.orig), + MASTER_HOST="{{ template "common.name" . }}-0.{{ .Values.service.name }}.{{ include "common.namespace" . }}", + MASTER_USER="root", + MASTER_PASSWORD="$MYSQL_ROOT_PASSWORD", + MASTER_CONNECT_RETRY=10; + START SLAVE; + EOF + fi + + # Start a server to send backups when requested by peers. + exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \ + "xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --backup --slave-info --stream=xbstream --host=localhost" + volumeMounts: + - name: {{ include "common.fullname" . }}-data + mountPath: /var/lib/mysql + subPath: mysql + - name: conf + mountPath: /etc/mysql/conf.d + volumes: + - name: conf + emptyDir: {} + - name: config-map + configMap: + name: {{ include "common.fullname" . }}-db-configmap + - name: localtime + hostPath: + path: /etc/localtime + - name: {{ include "common.fullname" . }}-data +#{{ if not .Values.disableNfsProvisioner }} + volumeClaimTemplates: + - metadata: + name: {{ include "common.fullname" . }}-data + annotations: + volume.beta.kubernetes.io/storage-class: "{{ include "common.fullname" . }}-data" + spec: + accessModes: ["ReadWriteMany"] + resources: + requests: + storage: 1Gi +#{{ else if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }}-data +#{{ else }} + emptyDir: {} +#{{ end }} diff --git a/kubernetes/mysql/templates/storageclass.yaml b/kubernetes/mysql/templates/storageclass.yaml new file mode 100644 index 0000000000..1a4e6b6bb7 --- /dev/null +++ b/kubernetes/mysql/templates/storageclass.yaml @@ -0,0 +1,6 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: "{{ include "common.fullname" . }}-data" + namespace: {{ include "common.namespace" . }} +provisioner: {{ include "common.fullname" . }}/nfs diff --git a/kubernetes/mysql/values.yaml b/kubernetes/mysql/values.yaml new file mode 100644 index 0000000000..c0beb6fd22 --- /dev/null +++ b/kubernetes/mysql/values.yaml @@ -0,0 +1,111 @@ +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + persistence: {} + readinessRepository: oomk8s + readinessImage: readiness-check:1.0.0 + + +################################################################# +# Application configuration defaults. +################################################################# + +#repository: mysql +repository: registry.hub.docker.com +image: library/mysql:5.7 +pullPolicy: Always + +# application configuration +config: + dbRootPassword: openECOMP1.0 + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 5 + periodSeconds: 10 + +## Persist data to a persitent volume +persistence: + enabled: false + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + volumeReclaimPolicy: Retain + + ## database data Persistent Volume Storage Class + ## If defined, storageClassName: <storageClass> + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + accessMode: ReadWriteMany + size: 1Gi + mountPath: /dockerdata-nfs + mountSubPath: mysql/data + +service: + name: mysql + internalPort: 3306 + # nfs provisioner ports + nfsPort: 2049 + mountdPort: 20048 + rpcbindPort: 111 + rpcbindUdpPort: 111 + +ingress: + enabled: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi + +################################################################# +# Sidecar Configuration. +# +# xtrabackup configuration defaults. +################################################################# +xtrabackupRepository: gcr.io/google-samples +xtrabackupImage: xtrabackup:1.0 +xtrabackup: + internalPort: 3307 + +nfsprovisionerRepository: quay.io +nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8 +nfsprovisionerPrefix: mysql + +sdnctlPrefix: mysql diff --git a/kubernetes/onap/requirements.yaml b/kubernetes/onap/requirements.yaml index 32f24703f8..0b511503b9 100644 --- a/kubernetes/onap/requirements.yaml +++ b/kubernetes/onap/requirements.yaml @@ -26,7 +26,7 @@ dependencies: repository: '@local' condition: aai.enabled - name: appc - version: ~0.1.0 + version: ~2.0.0 repository: '@local' condition: appc.enabled - name: clamp diff --git a/kubernetes/oneclick/setenv.bash b/kubernetes/oneclick/setenv.bash index 3f1af4de8a..716b76c410 100644 --- a/kubernetes/oneclick/setenv.bash +++ b/kubernetes/oneclick/setenv.bash @@ -1,7 +1,7 @@ #!/bin/bash # Deploying MSB first so the started ONAP services can be registered to MSB -HELM_APPS=('consul' 'msb' 'mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'appc' 'aai' 'sdc' 'dcaegen2' 'log' 'cli' 'multicloud' 'clamp' 'vnfsdk' 'uui' 'aaf' 'vfc' 'esr') +HELM_APPS=('consul' 'msb' 'mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'aai' 'sdc' 'dcaegen2' 'log' 'cli' 'multicloud' 'clamp' 'vnfsdk' 'uui' 'aaf' 'vfc' 'esr') ONAP_DOCKER_REGISTRY=${ONAP_DOCKER_REGISTRY:-nexus3.onap.org:10001} ONAP_DOCKER_USER=${ONAP_DOCKER_USER:-docker} ONAP_DOCKER_PASS=${ONAP_DOCKER_PASS:-docker} |