From 70863e11b3d0816ad7b8f938fe60eb293b2748db Mon Sep 17 00:00:00 2001 From: jmac Date: Wed, 16 May 2018 14:53:03 +0000 Subject: make sdnctl user db password configurable for SDNC Change-Id: Ic5eda9c33abca03e2f0bc788261a3a769c5ad7ab Signed-off-by: jmac Issue-ID: OOM-970 --- .../common/dgbuilder/resources/config/svclogic.properties | 2 +- .../common/dgbuilder/resources/scripts/createReleaseDir.sh | 4 ++-- .../common/dgbuilder/resources/scripts/customSettings.js | 8 ++++---- kubernetes/common/dgbuilder/values.yaml | 4 +++- .../charts/sdnc-portal/resources/config/admportal.json | 2 +- .../charts/sdnc-portal/resources/config/dblib.properties | 2 +- .../sdnc-portal/resources/config/svclogic.properties | 2 +- .../resources/config/svclogic.properties.sdnctldb02 | 2 +- kubernetes/sdnc/charts/sdnc-portal/values.yaml | 1 + kubernetes/sdnc/resources/config/conf/dblib.properties | 2 +- kubernetes/sdnc/resources/config/conf/svclogic.properties | 2 +- kubernetes/sdnc/templates/secrets.yaml | 14 ++++++++++++++ kubernetes/sdnc/templates/statefulset.yaml | 5 +++++ kubernetes/sdnc/values.yaml | 4 ++++ 14 files changed, 40 insertions(+), 14 deletions(-) diff --git a/kubernetes/common/dgbuilder/resources/config/svclogic.properties b/kubernetes/common/dgbuilder/resources/config/svclogic.properties index dc3980de21..82eeec5e61 100644 --- a/kubernetes/common/dgbuilder/resources/config/svclogic.properties +++ b/kubernetes/common/dgbuilder/resources/config/svclogic.properties @@ -2,4 +2,4 @@ org.onap.ccsdk.sli.dbtype=jdbc org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.config.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 +org.onap.ccsdk.sli.jdbc.password={{.Values.config.dbSdnctlPassword}} diff --git a/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh index 76d17700b0..961792be3f 100755 --- a/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh +++ b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh @@ -19,7 +19,7 @@ dbHost="{{.Values.config.dbServiceName}}.{{.Release.Namespace}}" dbPort="3306" dbName="sdnctl" dbUser="sdnctl" -dbPassword="gamma" +dbPassword="{{.Values.config.dbSdnctlPassword}}" gitLocalRepository="$4" lastPort=$(find "releases/" -name "customSettings.js" |xargs grep uiPort|cut -d: -f2|sed -e s/,//|sort|tail -1) @@ -99,7 +99,7 @@ then echo "org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.config.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 + echo "org.onap.ccsdk.sli.jdbc.password={{.Values.config.dbSdnctlPassword}}" >>$svclogicPropFile fi if [ ! -e "${appDir}/flowShareUsers.js" ] then diff --git a/kubernetes/common/dgbuilder/resources/scripts/customSettings.js b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js index 22810baabd..e3349b9d5a 100644 --- a/kubernetes/common/dgbuilder/resources/scripts/customSettings.js +++ b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js @@ -27,25 +27,25 @@ module.exports={ "userDir": "releases/sdnc1.0", "httpAuth": { "user": "dguser", - "pass": "cc03e747a6afbbcbf8be7668acfebee5" + "pass": "{{.Values.config.dgUserPassword}}" }, "dbHost": "{{.Values.config.dbServiceName}}.{{ include "common.namespace" . }}", "dbPort": "3306", "dbName": "sdnctl", "dbUser": "sdnctl", - "dbPassword": "gamma", + "dbPassword": "{{.Values.config.dbSdnctlPassword}}", "gitLocalRepository": "", "httpRoot": "/", "disableEditor": false, "httpAdminRoot": "/", "httpAdminAuth": { "user": "dguser", - "pass": "cc03e747a6afbbcbf8be7668acfebee5" + "pass": "{{.Values.config.dgUserPassword}}" }, "httpNodeRoot": "/", "httpNodeAuth": { "user": "dguser", - "pass": "cc03e747a6afbbcbf8be7668acfebee5" + "pass": "{{.Values.config.dgUserPassword}}" }, "uiHost": "0.0.0.0", "version": "0.9.1", diff --git a/kubernetes/common/dgbuilder/values.yaml b/kubernetes/common/dgbuilder/values.yaml index e7c18c4140..025e52829b 100644 --- a/kubernetes/common/dgbuilder/values.yaml +++ b/kubernetes/common/dgbuilder/values.yaml @@ -42,9 +42,11 @@ debugEnabled: false # application configuration config: dbRootPassword: openECOMP1.0 + dbSdnctlPassword: gamma dbPodName: mysql-db dbServiceName: sdnc-dbhost - + # MD5 hash of dguser password ( default: test123 ) + dgUserPassword: cc03e747a6afbbcbf8be7668acfebee5 # default number of instances replicaCount: 1 diff --git a/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json b/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json index f6d202ef09..a6950fdd70 100644 --- a/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json +++ b/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json @@ -36,7 +36,7 @@ "dbFabricPassword": "admin", "dbFabricDB": "mysql", "dbUser": "sdnctl", - "dbPassword": "gamma", + "dbPassword": "{{.Values.config.dbSdnctlPassword}}", "dbName": "sdnctl", "odlProtocol": "http", "odlHost": "sdnc.{{.Release.Namespace}}", diff --git a/kubernetes/sdnc/charts/sdnc-portal/resources/config/dblib.properties b/kubernetes/sdnc/charts/sdnc-portal/resources/config/dblib.properties index 9e4c88a879..68357baae6 100644 --- a/kubernetes/sdnc/charts/sdnc-portal/resources/config/dblib.properties +++ b/kubernetes/sdnc/charts/sdnc-portal/resources/config/dblib.properties @@ -22,7 +22,7 @@ org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Relea org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl -org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.password={{.Values.config.dbSdnctlPassword}} org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 org.onap.ccsdk.sli.jdbc.connection.timeout=50 org.onap.ccsdk.sli.jdbc.request.timeout=100 diff --git a/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties b/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties index e0e3295735..cc13a9d707 100644 --- a/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties +++ b/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties @@ -2,4 +2,4 @@ org.openecomp.sdnctl.sli.dbtype = jdbc org.openecomp.sdnctl.sli.jdbc.url = jdbc:mysql://sdnc-sdnctldb01:3306/sdnctl org.openecomp.sdnctl.sli.jdbc.database = sdnctl org.openecomp.sdnctl.sli.jdbc.user = sdnctl -org.openecomp.sdnctl.sli.jdbc.password = gamma \ No newline at end of file +org.openecomp.sdnctl.sli.jdbc.password = {{.Values.config.dbSdnctlPassword}} \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties.sdnctldb02 b/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties.sdnctldb02 index e665a56d75..c75c603f22 100644 --- a/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties.sdnctldb02 +++ b/kubernetes/sdnc/charts/sdnc-portal/resources/config/svclogic.properties.sdnctldb02 @@ -2,4 +2,4 @@ org.openecomp.sdnctl.sli.dbtype = jdbc org.openecomp.sdnctl.sli.jdbc.url = jdbc:mysql://sdnc-sdnctldb02:3306/sdnctl org.openecomp.sdnctl.sli.jdbc.database = sdnctl org.openecomp.sdnctl.sli.jdbc.user = sdnctl -org.openecomp.sdnctl.sli.jdbc.password = gamma \ No newline at end of file +org.openecomp.sdnctl.sli.jdbc.password = {{.Values.config.dbSdnctlPassword}} \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-portal/values.yaml b/kubernetes/sdnc/charts/sdnc-portal/values.yaml index f5cd48c12f..09ee0d06b6 100644 --- a/kubernetes/sdnc/charts/sdnc-portal/values.yaml +++ b/kubernetes/sdnc/charts/sdnc-portal/values.yaml @@ -37,6 +37,7 @@ debugEnabled: false config: mysqlChartName: sdnc-db dbRootPassword: openECOMP1.0 + dbSdnctlPassword: gamma sdncChartName: sdnc configDir: /opt/onap/sdnc/data/properties odlPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U diff --git a/kubernetes/sdnc/resources/config/conf/dblib.properties b/kubernetes/sdnc/resources/config/conf/dblib.properties index 362726a6d8..dd2bcabcc5 100644 --- a/kubernetes/sdnc/resources/config/conf/dblib.properties +++ b/kubernetes/sdnc/resources/config/conf/dblib.properties @@ -22,7 +22,7 @@ org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Relea org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver org.onap.ccsdk.sli.jdbc.database=sdnctl org.onap.ccsdk.sli.jdbc.user=sdnctl -org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.password={{.Values.config.dbSdnctlPassword}} org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 org.onap.ccsdk.sli.jdbc.connection.timeout=50 org.onap.ccsdk.sli.jdbc.request.timeout=100 diff --git a/kubernetes/sdnc/resources/config/conf/svclogic.properties b/kubernetes/sdnc/resources/config/conf/svclogic.properties index 99f6cf84b7..e564012c8f 100644 --- a/kubernetes/sdnc/resources/config/conf/svclogic.properties +++ b/kubernetes/sdnc/resources/config/conf/svclogic.properties @@ -23,5 +23,5 @@ org.onap.ccsdk.sli.dbtype = jdbc org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:{{.Values.mysql.service.internalPort}}/sdnctl org.onap.ccsdk.sli.jdbc.database = sdnctl org.onap.ccsdk.sli.jdbc.user = sdnctl -org.onap.ccsdk.sli.jdbc.password = gamma +org.onap.ccsdk.sli.jdbc.password = {{.Values.config.dbSdnctlPassword}} diff --git a/kubernetes/sdnc/templates/secrets.yaml b/kubernetes/sdnc/templates/secrets.yaml index 754f117e38..a900132c31 100644 --- a/kubernetes/sdnc/templates/secrets.yaml +++ b/kubernetes/sdnc/templates/secrets.yaml @@ -25,3 +25,17 @@ metadata: type: Opaque data: odl-password: {{ .Values.config.odlPassword | b64enc | quote }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }}-sdnctl + 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-sdnctl-password: {{ .Values.config.dbSdnctlPassword | b64enc | quote }} diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml index e821406d45..28e9803d62 100644 --- a/kubernetes/sdnc/templates/statefulset.yaml +++ b/kubernetes/sdnc/templates/statefulset.yaml @@ -74,6 +74,11 @@ spec: secretKeyRef: name: {{ template "common.fullname" . }}-odl key: odl-password + - name: SDNC_DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }}-sdnctl + key: db-sdnctl-password - name: SDNC_CONFIG_DIR value: "{{ .Values.config.configDir }}" - name: ENABLE_ODL_CLUSTER diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index a550b22e11..da1430513a 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -40,6 +40,7 @@ debugEnabled: false config: odlPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U dbRootPassword: openECOMP1.0 + dbSdnctlPassword: gamma enableClustering: true binDir: /opt/onap/sdnc/bin geoEnabled: false @@ -82,6 +83,7 @@ sdnc-portal: mysqlChartName: sdnc-db configDir: /opt/onap/sdnc/data/properties dbRootPassword: openECOMP1.0 + dbSdnctlPassword: gamma odlPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U sdnc-ansible-server: @@ -110,6 +112,8 @@ dgbuilder: dbPodName: sdnc-db dbServiceName: sdnc-dbhost dbRootPassword: openECOMP1.0 + dbSdnctlPassword: gamma + dgUserPassword: cc03e747a6afbbcbf8be7668acfebee5 service: name: sdnc-dgbuilder nodePort: "03" -- cgit 1.2.3-korg From f461397b673a94a146e6a25d426253bdcfd72d19 Mon Sep 17 00:00:00 2001 From: Jimmy Forsyth Date: Fri, 8 Jun 2018 14:30:27 -0400 Subject: Reconfigure haproxy to use dns resolution Issue-ID: AAI-1217 Change-Id: If3bf828a69d9fbb46e776082541b21ab2bbb861d Signed-off-by: Jimmy Forsyth --- kubernetes/aai/resources/config/haproxy/haproxy.cfg | 8 ++++++-- kubernetes/aai/values.yaml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kubernetes/aai/resources/config/haproxy/haproxy.cfg b/kubernetes/aai/resources/config/haproxy/haproxy.cfg index b9721ae41a..e90f737bff 100644 --- a/kubernetes/aai/resources/config/haproxy/haproxy.cfg +++ b/kubernetes/aai/resources/config/haproxy/haproxy.cfg @@ -22,6 +22,9 @@ defaults log global mode http option httplog + option ssl-hello-chk + option httpchk GET /aai/util/echo HTTP/1.1\r\nHost:\ aai\r\nX-TransactionId:\ haproxy-0111\r\nX-FromAppId:\ haproxy\r\nAccept:\ application/json\r\nAuthorization:\ Basic\ QUFJOkFBSQ== + default-server init-addr none # option dontlognull # errorfile 400 /etc/haproxy/errors/400.http # errorfile 403 /etc/haproxy/errors/403.http @@ -95,7 +98,8 @@ backend IST_Default_8447 balance roundrobin http-request set-header X-Forwarded-Port %[src_port] http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; - server aai-resources.{{.Release.Namespace}} aai-resources.{{.Release.Namespace}}:8447 port 8447 ssl verify none + server aai-resources.{{.Release.Namespace}} aai-resources.{{.Release.Namespace}}.svc.cluster.local:8447 resolvers kubernetes check check-ssl port 8447 ssl verify none + ####################### # BACKEND 8446######### @@ -105,7 +109,7 @@ backend IST_AAI_8446 balance roundrobin http-request set-header X-Forwarded-Port %[src_port] http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; - server aai-traversal.{{.Release.Namespace}} aai-traversal.{{.Release.Namespace}}:8446 port 8446 ssl verify none + server aai-traversal.{{.Release.Namespace}} aai-traversal.{{.Release.Namespace}}.svc.cluster.local:8446 resolvers kubernetes check check-ssl port 8446 ssl verify none listen IST_AAI_STATS mode http diff --git a/kubernetes/aai/values.yaml b/kubernetes/aai/values.yaml index 017d0c282d..b07048e134 100644 --- a/kubernetes/aai/values.yaml +++ b/kubernetes/aai/values.yaml @@ -56,7 +56,7 @@ global: # global defaults # application image dockerhubRepository: registry.hub.docker.com -image: aaionap/haproxy:1.2.3 +image: aaionap/haproxy:1.2.4 pullPolicy: Always # flag to enable debugging - application support required -- cgit 1.2.3-korg From 145818b3aaf7181c7c3ded1d6744047fece4a0ee Mon Sep 17 00:00:00 2001 From: Aaron Hay Date: Tue, 5 Jun 2018 13:23:50 -0400 Subject: Update OOM APPC chart to enhance AAF support Added AAF config parameters and files needed to allow AAF to work in an APPC OOM environment. Change-Id: I39f0769e721889a68c6a111adf29d685b9f97dbf Issue-ID: OOM-1124 Signed-off-by: Aaron Hay --- .../config/appc/opt/onap/appc/bin/startODL.sh | 12 ++- .../onap/appc/data/properties/aaa-app-config.xml | 120 +++++++++++++++++++++ kubernetes/appc/templates/statefulset.yaml | 5 + kubernetes/appc/values.yaml | 5 +- 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaa-app-config.xml diff --git a/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh index a990739d55..18a2783c5f 100755 --- a/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh @@ -55,6 +55,9 @@ APPC_HOME=${APPC_HOME:-/opt/onap/appc} SLEEP_TIME=${SLEEP_TIME:-120} MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false} +ENABLE_AAF=${ENABLE_AAF:-false} +AAF_EXT_IP=${AAF_EXT_IP:-{{.Values.config.aafExtIP}}} +AAF_EXT_FQDN=${AAF_EXT_FQDN:-{{.Values.config.aafExtFQDN}}} appcInstallStartTime=$(date +%s) @@ -143,8 +146,13 @@ then echo "" >> ${ODL_HOME}/etc/system.properties echo "Copying the aaa shiro configuration into opendaylight" - cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml - + if $ENABLE_AAF + then + echo "${AAF_EXT_IP} ${AAF_EXT_FQDN}" >> /etc/hosts + cp ${APPC_HOME}/data/properties/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml + else + cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml + fi echo "Restarting OpenDaylight" ${ODL_HOME}/bin/stop diff --git a/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaa-app-config.xml b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaa-app-config.xml new file mode 100644 index 0000000000..31bc4e31de --- /dev/null +++ b/kubernetes/appc/resources/config/appc/opt/onap/appc/data/properties/aaa-app-config.xml @@ -0,0 +1,120 @@ + + + + + + +
+ tokenAuthRealm + + org.onap.aaf.cadi.shiro.AAFRealm +
+ + + +
+ securityManager.realms + $tokenAuthRealm +
+ + +
+ authcBasic + org.opendaylight.aaa.shiro.filters.ODLHttpAuthenticationFilter +
+ + +
+ accountingListener + org.opendaylight.aaa.shiro.filters.AuthenticationListener +
+
+ securityManager.authenticator.authenticationListeners + $accountingListener +
+ + +
+ dynamicAuthorization + org.opendaylight.aaa.shiro.realm.MDSALDynamicAuthorizationFilter +
+ + + + + + + /auth/** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/config/aaa-cert-mdsal** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/operational/aaa-cert-mdsal** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/operations/aaa-cert-rpc** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/config/aaa-authn-model** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/operational/aaa-authn-model** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /restconf/operations/cluster-admin** + + authcBasic, roles[org.onap.appc.odl|odl-admin|*] + + + /** + + authcBasic, roles[org.onap.appc.odl|odl-api|*] + +
+ diff --git a/kubernetes/appc/templates/statefulset.yaml b/kubernetes/appc/templates/statefulset.yaml index f4409697b3..791d93393e 100644 --- a/kubernetes/appc/templates/statefulset.yaml +++ b/kubernetes/appc/templates/statefulset.yaml @@ -62,6 +62,8 @@ spec: value: "{{ .Values.config.configDir }}" - name: DMAAP_TOPIC_ENV value: "{{ .Values.config.dmaapTopic }}" + - name: ENABLE_AAF + value: "{{ .Values.config.enableAAF }}" - name: ENABLE_ODL_CLUSTER value: "{{ .Values.config.enableClustering }}" - name: APPC_REPLICAS @@ -82,6 +84,9 @@ spec: - mountPath: /opt/onap/appc/data/properties/aaiclient.properties name: onap-appc-data-properties subPath: aaiclient.properties + - mountPath: /opt/onap/appc/data/properties/aaa-app-config.xml + name: onap-appc-data-properties + subPath: aaa-app-config.xml - mountPath: /opt/onap/appc/svclogic/config/svclogic.properties name: onap-appc-svclogic-config subPath: svclogic.properties diff --git a/kubernetes/appc/values.yaml b/kubernetes/appc/values.yaml index 4b47c63a42..1c20977b90 100644 --- a/kubernetes/appc/values.yaml +++ b/kubernetes/appc/values.yaml @@ -29,7 +29,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/appc-image:1.3.0 +image: onap/appc-image:1.4.0-SNAPSHOT-latest pullPolicy: Always # flag to enable debugging - application support required @@ -37,7 +37,10 @@ debugEnabled: false # application configuration config: + aafExtIP: 127.0.0.1 + aafExtFQDN: aaf-onap-beijing-test.osaaf.org dbRootPassword: openECOMP1.0 + enableAAF: false enableClustering: true configDir: /opt/onap/appc/data/properties dmaapTopic: SUCCESS -- cgit 1.2.3-korg From f529a46e99b3578573f336329594ab404e7bb6d7 Mon Sep 17 00:00:00 2001 From: Michael Arrastia Date: Wed, 13 Jun 2018 17:01:15 +0100 Subject: Add schemaIngest properties resource to aai-gizmo This file is required to configure the location of the OXM and DB Edge Rules that are ingested by the Gizmo microservice. Change-Id: I51a24bc24ddc757e6e11b3f3a855fff6696c6a64 Issue-ID: AAI-1227 Signed-off-by: Michael Arrastia --- .../resources/config/schemaIngest.properties | 31 ++++++++++++++++++++++ .../aai/charts/aai-gizmo/templates/deployment.yaml | 5 ++++ 2 files changed, 36 insertions(+) create mode 100644 kubernetes/aai/charts/aai-gizmo/resources/config/schemaIngest.properties diff --git a/kubernetes/aai/charts/aai-gizmo/resources/config/schemaIngest.properties b/kubernetes/aai/charts/aai-gizmo/resources/config/schemaIngest.properties new file mode 100644 index 0000000000..dfdf3e07af --- /dev/null +++ b/kubernetes/aai/charts/aai-gizmo/resources/config/schemaIngest.properties @@ -0,0 +1,31 @@ +# +# ============LICENSE_START======================================================= +# org.onap.aai +# ================================================================================ +# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright © 2017-2018 Amdocs +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= +# + +# Properties for the SchemaLocationsBean + +# The AAI Schema jar will be unpacked to bundleconfig/etc +schemaConfig=NA +# OXM files named aai_oxm_v*.xml are unpacked here: +nodeDir=/opt/app/crud-api/bundleconfig/etc/oxm +# DB Edge Rules are unpacked here: +edgeDir=/opt/app/crud-api/bundleconfig/etc/dbedgerules +# DB Edge Property files are copied here: +edgePropsDir=/opt/app/crud-service/config/model diff --git a/kubernetes/aai/charts/aai-gizmo/templates/deployment.yaml b/kubernetes/aai/charts/aai-gizmo/templates/deployment.yaml index 7b0a57791c..c69b3a068b 100644 --- a/kubernetes/aai/charts/aai-gizmo/templates/deployment.yaml +++ b/kubernetes/aai/charts/aai-gizmo/templates/deployment.yaml @@ -72,6 +72,9 @@ spec: - mountPath: /opt/app/crud-service/config/crud-api.properties subPath: crud-api.properties name: {{ include "common.fullname" . }}-config + - mountPath: /opt/app/crud-service/config/schemaIngest.properties + subPath: schemaIngest.properties + name: {{ include "common.fullname" . }}-config - mountPath: /opt/app/crud-service/config/model/ name: {{ include "common.fullname" . }}-model-config - mountPath: /opt/app/crud-service/config/auth @@ -127,6 +130,8 @@ spec: items: - key: crud-api.properties path: crud-api.properties + - key: schemaIngest.properties + path: schemaIngest.properties - key: crud-beans.xml path: crud-beans.xml - name: {{ include "common.fullname" . }}-logback-config -- cgit 1.2.3-korg From e610648f4c57c5fccfd8a952b9a098c88b49d5f2 Mon Sep 17 00:00:00 2001 From: Michael Arrastia Date: Fri, 15 Jun 2018 16:30:04 +0100 Subject: Add schemaIngest resource to aai-data-router This file is required to configure the location of the OXM files ingested by the data-router microservice. Change-Id: Ie360f0b80af39c709a5c3dcb18ce06768fbb40a6 Issue-ID: AAI-1229 Signed-off-by: Michael Arrastia --- .../resources/config/schemaIngest.properties | 31 ++++++++++++++++++++++ .../aai-data-router/templates/configmap.yaml | 2 +- .../aai-data-router/templates/deployment.yaml | 10 ++++++- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 kubernetes/aai/charts/aai-data-router/resources/config/schemaIngest.properties diff --git a/kubernetes/aai/charts/aai-data-router/resources/config/schemaIngest.properties b/kubernetes/aai/charts/aai-data-router/resources/config/schemaIngest.properties new file mode 100644 index 0000000000..9174d2f5a2 --- /dev/null +++ b/kubernetes/aai/charts/aai-data-router/resources/config/schemaIngest.properties @@ -0,0 +1,31 @@ +# +# ============LICENSE_START======================================================= +# org.onap.aai +# ================================================================================ +# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright © 2017-2018 Amdocs +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= +# + +# Properties for the SchemaLocationsBean + +# The AAI Schema jar will be unpacked to bundleconfig/etc +schemaConfig=NA +# OXM files named aai_oxm_v*.xml are unpacked here: +nodeDir=/opt/app/data-router/bundleconfig/etc/oxm +# DB Edge Rules are unpacked here: +edgeDir= +# DB Edge Property files are copied here: +edgePropsDir= diff --git a/kubernetes/aai/charts/aai-data-router/templates/configmap.yaml b/kubernetes/aai/charts/aai-data-router/templates/configmap.yaml index 9652712aa6..badb53fb97 100644 --- a/kubernetes/aai/charts/aai-data-router/templates/configmap.yaml +++ b/kubernetes/aai/charts/aai-data-router/templates/configmap.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "common.fullname" . }}-prop namespace: {{ include "common.namespace" . }} data: -{{ tpl (.Files.Glob "resources/config/data-router.properties").AsConfig . | indent 2 }} +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} --- apiVersion: v1 kind: ConfigMap diff --git a/kubernetes/aai/charts/aai-data-router/templates/deployment.yaml b/kubernetes/aai/charts/aai-data-router/templates/deployment.yaml index 2d45a0b097..a045189299 100644 --- a/kubernetes/aai/charts/aai-data-router/templates/deployment.yaml +++ b/kubernetes/aai/charts/aai-data-router/templates/deployment.yaml @@ -82,8 +82,11 @@ spec: - mountPath: /opt/app/data-router/config/auth name: {{ include "common.fullname" . }}-auth - mountPath: /opt/app/data-router/config/data-router.properties - name: {{ include "common.fullname" . }}-properties subPath: data-router.properties + name: {{ include "common.fullname" . }}-properties + - mountPath: /opt/app/data-router/config/schemaIngest.properties + subPath: schemaIngest.properties + name: {{ include "common.fullname" . }}-properties - mountPath: /opt/app/data-router/dynamic/routes/entity-event.route subPath: entity-event.route name: {{ include "common.fullname" . }}-dynamic-route @@ -116,6 +119,11 @@ spec: - name: {{ include "common.fullname" . }}-properties configMap: name: {{ include "common.fullname" . }}-prop + items: + - key: data-router.properties + path: data-router.properties + - key: schemaIngest.properties + path: schemaIngest.properties - name: {{ include "common.fullname" . }}-dynamic-route configMap: name: {{ include "common.fullname" . }}-dynamic -- cgit 1.2.3-korg From 1b061396f99141cf55d958cb016dad709641c25b Mon Sep 17 00:00:00 2001 From: priyanshua Date: Tue, 29 May 2018 12:50:14 +0530 Subject: Activity-Spec support in OOM - Casablanca Release Activity spec support for OOM deployment via K8S Change-Id: Iba4a2c6ff2eaf0c435b93ac7d47261f86d3dfdc1 Issue-ID: SDC-1048 Signed-off-by: priyanshua --- kubernetes/sdc/charts/sdc-act/.helmignore | 21 +++++ kubernetes/sdc/charts/sdc-act/Chart.yaml | 18 ++++ .../sdc-act/resources/config/configuration.yaml | 12 +++ kubernetes/sdc/charts/sdc-act/templates/NOTES.txt | 33 ++++++++ .../sdc/charts/sdc-act/templates/configmap.yaml | 21 +++++ .../sdc/charts/sdc-act/templates/deployment.yaml | 80 ++++++++++++++++++ kubernetes/sdc/charts/sdc-act/templates/job.yaml | 64 +++++++++++++++ .../sdc/charts/sdc-act/templates/service.yaml | 39 +++++++++ kubernetes/sdc/charts/sdc-act/values.yaml | 95 ++++++++++++++++++++++ 9 files changed, 383 insertions(+) create mode 100644 kubernetes/sdc/charts/sdc-act/.helmignore create mode 100644 kubernetes/sdc/charts/sdc-act/Chart.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/resources/config/configuration.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/templates/NOTES.txt create mode 100644 kubernetes/sdc/charts/sdc-act/templates/configmap.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/templates/deployment.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/templates/job.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/templates/service.yaml create mode 100644 kubernetes/sdc/charts/sdc-act/values.yaml diff --git a/kubernetes/sdc/charts/sdc-act/.helmignore b/kubernetes/sdc/charts/sdc-act/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/.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/sdc/charts/sdc-act/Chart.yaml b/kubernetes/sdc/charts/sdc-act/Chart.yaml new file mode 100644 index 0000000000..7fa0d2d008 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/Chart.yaml @@ -0,0 +1,18 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +description: ONAP Activity Spec WebService +name: sdc-act +version: 2.0.0 \ No newline at end of file diff --git a/kubernetes/sdc/charts/sdc-act/resources/config/configuration.yaml b/kubernetes/sdc/charts/sdc-act/resources/config/configuration.yaml new file mode 100644 index 0000000000..af380172e0 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/resources/config/configuration.yaml @@ -0,0 +1,12 @@ +cassandraConfig: + cassandraHosts: {{ .Values.config.cassandraHosts }} + reconnectTimeout : {{ .Values.config.cassandraReconnectTimeout }} + socketReadTimeout: {{ .Values.config.cassandraSocketReadTimeout }} + socketConnectTimeout: {{ .Values.config.cassandraSocketConnectTimeout }} + authenticate: true + username: {{ .Values.config.cassandraUserName }} + password: {{ .Values.config.cassandraUserPassword }} + ssl: {{ .Values.config.cassandraSslEnabled }} + truststorePath : {{ .Values.config.cassandraTruststorePath }} + truststorePassword : {{ .Values.config.cassandraTruststorePassword }} + diff --git a/kubernetes/sdc/charts/sdc-act/templates/NOTES.txt b/kubernetes/sdc/charts/sdc-act/templates/NOTES.txt new file mode 100644 index 0000000000..41f9706fec --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/templates/NOTES.txt @@ -0,0 +1,33 @@ +# Copyright © 2018 Amdocs, AT&T, 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. + +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={{ include "common.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/sdc/charts/sdc-act/templates/configmap.yaml b/kubernetes/sdc/charts/sdc-act/templates/configmap.yaml new file mode 100644 index 0000000000..4ccc7cc526 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} \ No newline at end of file diff --git a/kubernetes/sdc/charts/sdc-act/templates/deployment.yaml b/kubernetes/sdc/charts/sdc-act/templates/deployment.yaml new file mode 100644 index 0000000000..542982fd63 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/templates/deployment.yaml @@ -0,0 +1,80 @@ +# Copyright © 2017 Amdocs, AT&T, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: 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: + - name: {{ include "common.name" . }}-job-completion + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}" + command: + - /root/job_complete.py + args: + - --job-name + - {{ include "common.fullname" . }}-init-activity-spec + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + containers: + - name: {{ include "common.name" . }} + image: "{{ include "common.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 .Values.liveness.enabled }} + livenessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{ end }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + env: + - name: JAVA_OPTIONS + value: {{ .Values.config.javaOptions }} + volumeMounts: + - name: {{ include "common.fullname" . }}-config + mountPath: /etc/onap/activity-spec/be/config + volumes: + - name: {{ include "common.fullname" . }}-config + configMap: + name : {{ include "common.fullname" . }}-configmap + defaultMode: 0755 + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" \ No newline at end of file diff --git a/kubernetes/sdc/charts/sdc-act/templates/job.yaml b/kubernetes/sdc/charts/sdc-act/templates/job.yaml new file mode 100644 index 0000000000..bd9d9d1e00 --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/templates/job.yaml @@ -0,0 +1,64 @@ +# Copyright © 2017 Amdocs, AT&T, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "common.fullname" . }}-init-activity-spec + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }}-job + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + backoffLimit: 20 + template: + metadata: + labels: + app: {{ include "common.name" . }}-job + release: {{ .Release.Name }} + spec: + restartPolicy: Never + initContainers: + - name: {{ include "common.name" . }}-init-readiness + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - /root/ready.py + args: + - --container-name + - sdc-cs + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + containers: + - name: {{ include "common.name" . }}-job + image: "{{ include "common.repository" . }}/{{ .Values.configInitImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + env: + - name: CS_HOST + value: sdc-cs + - name: CS_USER + valueFrom: + secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_user} + - name: CS_PASSWORD + valueFrom: + secretKeyRef: {name: {{ .Release.Name }}-sdc-cs-secrets, key: sdc_password} + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" + restartPolicy: Never diff --git a/kubernetes/sdc/charts/sdc-act/templates/service.yaml b/kubernetes/sdc/charts/sdc-act/templates/service.yaml new file mode 100644 index 0000000000..736ef740ee --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/templates/service.yaml @@ -0,0 +1,39 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename" . }} + 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.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.portName | default "http" }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName | default "http" }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/kubernetes/sdc/charts/sdc-act/values.yaml b/kubernetes/sdc/charts/sdc-act/values.yaml new file mode 100644 index 0000000000..0df41573ea --- /dev/null +++ b/kubernetes/sdc/charts/sdc-act/values.yaml @@ -0,0 +1,95 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + readinessRepository: oomk8s + readinessImage: readiness-check:2.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/activity-spec:1.3.0-SNAPSHOT +configInitImage: onap/activity-spec-init:1.3.0-SNAPSHOT +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +config: + javaOptions: "-Xmx1536m -Xms1536m" + cassandraSslEnabled: "false" + cassandraHosts: ['sdc-cs'] + cassandraUserName: "asdc_user" + cassandraUserPassword: "Aa1234%^!" + cassandraReconnectTimeout: 30000 + cassandraSocketReadTimeout: 20000 + cassandraSocketConnectTimeout: 20000 + cassandraTruststorePath: "/path/path" + cassandraTruststorePassword: "Aa123456" + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 60 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 60 + periodSeconds: 10 + +service: + type: NodePort + internalPort: 8080 + externalPort: 8080 + portName: sdc-act + nodePort: "57" + +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 -- cgit 1.2.3-korg From dfadfeb71f183943ece2b1641a2d51bcf6219ab6 Mon Sep 17 00:00:00 2001 From: "Lee, Tian (tl5884)" Date: Fri, 29 Jun 2018 12:00:08 +0100 Subject: Add new Widget ids to Babel config Add additional Widget ids in support of the new Port Mirroring configuration model generation feature Change-Id: I9c9440042e34c5ca422c4a2428ae1e73212fc1f3 Issue-ID: AAI-1345 Signed-off-by: Lee, Tian (tl5884) --- .../charts/aai-babel/resources/config/artifact-generator.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kubernetes/aai/charts/aai-babel/resources/config/artifact-generator.properties b/kubernetes/aai/charts/aai-babel/resources/config/artifact-generator.properties index 1d7e5fa01a..74897d69a4 100644 --- a/kubernetes/aai/charts/aai-babel/resources/config/artifact-generator.properties +++ b/kubernetes/aai/charts/aai-babel/resources/config/artifact-generator.properties @@ -22,6 +22,9 @@ AAI.model-invariant-id.cloud-region=425b2158-e51d-4509-9945-dad4556474a3 #complex widget details AAI.model-invariant-id.complex=af91c2f7-35fc-43cf-a13d-443f385b2353 AAI.model-version-id.complex=3a8ab1ee-9220-4fe8-b89c-9251d160ddc2 +#configuration widget details +AAI.model-invariant-id.configuration=166c050d-f69d-4305-943e-0bc58c3a26cf +AAI.model-version-id.configuration=5a175add-57e4-4a5d-8b02-c36f1d69c52b #connector widget details AAI.model-version-id.connector=22104c9f-29fd-462f-be07-96cd6b46dd33 AAI.model-invariant-id.connector=4c01c948-7607-4d66-8a6c-99c2c2717936 -- cgit 1.2.3-korg From cb498886c780178f7a8538a65308e3eca95657b1 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Mon, 9 Jul 2018 11:35:38 -0500 Subject: update software artifacts: beijing -> casablanca Change-Id: I9b162cd02aa472e16e146518e1294f57de1e306b Issue-ID: POLICY-959 Signed-off-by: Jorge Hernandez --- kubernetes/policy/charts/brmsgw/values.yaml | 2 +- kubernetes/policy/charts/drools/values.yaml | 2 +- kubernetes/policy/charts/pdp/values.yaml | 2 +- kubernetes/policy/resources/config/pe/push-policies.sh | 2 +- kubernetes/policy/values.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kubernetes/policy/charts/brmsgw/values.yaml b/kubernetes/policy/charts/brmsgw/values.yaml index d8cbda4aaf..9815f4d93b 100644 --- a/kubernetes/policy/charts/brmsgw/values.yaml +++ b/kubernetes/policy/charts/brmsgw/values.yaml @@ -25,7 +25,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/policy-pe:1.2.3 +image: onap/policy-pe:1.3-SNAPSHOT-latest pullPolicy: Always # flag to enable debugging - application support required diff --git a/kubernetes/policy/charts/drools/values.yaml b/kubernetes/policy/charts/drools/values.yaml index b469ce703f..fb50f700a9 100644 --- a/kubernetes/policy/charts/drools/values.yaml +++ b/kubernetes/policy/charts/drools/values.yaml @@ -27,7 +27,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/policy-drools:1.2.3 +image: onap/policy-drools:1.3-SNAPSHOT-latest pullPolicy: Always # flag to enable debugging - application support required diff --git a/kubernetes/policy/charts/pdp/values.yaml b/kubernetes/policy/charts/pdp/values.yaml index 45d8d60f5c..dcaefb32a3 100644 --- a/kubernetes/policy/charts/pdp/values.yaml +++ b/kubernetes/policy/charts/pdp/values.yaml @@ -27,7 +27,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/policy-pe:1.2.3 +image: onap/policy-pe:1.3-SNAPSHOT-latest pullPolicy: Always # flag to enable debugging - application support required diff --git a/kubernetes/policy/resources/config/pe/push-policies.sh b/kubernetes/policy/resources/config/pe/push-policies.sh index dcd3afb9ad..5172086d8a 100644 --- a/kubernetes/policy/resources/config/pe/push-policies.sh +++ b/kubernetes/policy/resources/config/pe/push-policies.sh @@ -22,7 +22,7 @@ echo "Upload BRMS Param Template" sleep 2 -wget -O cl-amsterdam-template.drl https://git.onap.org/policy/drools-applications/plain/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl?h=beijing +wget -O cl-amsterdam-template.drl https://git.onap.org/policy/drools-applications/plain/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl sleep 2 diff --git a/kubernetes/policy/values.yaml b/kubernetes/policy/values.yaml index 6aa8c7e61a..0d2ff545fe 100644 --- a/kubernetes/policy/values.yaml +++ b/kubernetes/policy/values.yaml @@ -40,7 +40,7 @@ global: ################################################################# # application image repository: nexus3.onap.org:10001 -image: onap/policy-pe:1.2.3 +image: onap/policy-pe:1.3-SNAPSHOT-latest pullPolicy: Always subChartsOnly: -- cgit 1.2.3-korg From 444f749beb97004beae57da122484818f6cbe88a Mon Sep 17 00:00:00 2001 From: Kiran Kamineni Date: Tue, 10 Jul 2018 10:32:00 -0700 Subject: Add apiVersion to service definition Adding apiVersion to the service definition for consul-server-ui. This is flagged as an error when using kubectl apply after generating template using helm template. Issue-ID: OOM-1280 Change-Id: Icb7378acbd66b851b6a83bfd8b30373e95cb15fd Signed-off-by: Kiran Kamineni --- kubernetes/consul/charts/consul-server/templates/service.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/kubernetes/consul/charts/consul-server/templates/service.yaml b/kubernetes/consul/charts/consul-server/templates/service.yaml index c0f8726826..0b16cf6920 100644 --- a/kubernetes/consul/charts/consul-server/templates/service.yaml +++ b/kubernetes/consul/charts/consul-server/templates/service.yaml @@ -38,6 +38,7 @@ spec: release: {{ .Release.Name }} clusterIP: None --- +apiVersion: v1 kind: Service metadata: name: {{ include "common.servicename" . }}-ui -- cgit 1.2.3-korg From b642ee553d6dd486fc375755af9da2fdd9c94885 Mon Sep 17 00:00:00 2001 From: Mohammadreza Pasandideh Date: Tue, 19 Jun 2018 15:19:53 -0400 Subject: SDN-C Multi-site High-availability - Auto-failover Change-Id: I4e028b31ce7a60154d2c04c63431c5ea996de8f8 Signed-off-by: Mohammadreza Pasandideh Issue-ID: SDNC-213 --- .../scripts/sdnc-cluster-health.sh | 58 ++++++++++ .../consul-agent-config/sdnc-cluster-health.json | 14 +++ .../sdnc-sdnctldb01-healthcheck.json | 2 +- .../sdnc-sdnctldb02-healthcheck.json | 2 +- .../config/consul-agent-config/sdnc-sdnhost.json | 2 +- kubernetes/consul/templates/deployment.yaml | 6 + kubernetes/consul/values.yaml | 10 ++ kubernetes/sdnc/Makefile | 51 +++++++++ kubernetes/sdnc/requirements.yaml | 6 +- kubernetes/sdnc/resources/env.yaml | 19 ++++ kubernetes/sdnc/resources/geo/bin/sdnc.cluster | 36 ++++-- kubernetes/sdnc/resources/geo/bin/sdnc.failover | 65 ----------- .../sdnc/resources/geo/bin/sdnc.isPrimaryCluster | 18 ++- kubernetes/sdnc/resources/geo/bin/sdnc.makeActive | 45 ++++++++ kubernetes/sdnc/resources/geo/bin/sdnc.monitor | 39 +++++++ kubernetes/sdnc/resources/geo/bin/switchVoting.sh | 46 ++++++-- kubernetes/sdnc/sdnc-prom/Chart.yaml | 18 +++ kubernetes/sdnc/sdnc-prom/requirements.yaml | 18 +++ .../sdnc-prom/resources/bin/ensureSdncActive.sh | 105 +++++++++++++++++ .../sdnc-prom/resources/bin/ensureSdncStandby.sh | 58 ++++++++++ kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh | 31 +++++ .../sdnc/sdnc-prom/resources/bin/sdnc.cluster | 61 ++++++++++ .../sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch | 22 ++++ .../sdnc/sdnc-prom/resources/bin/sdnc.failover | 86 ++++++++++++++ .../sdnc/sdnc-prom/resources/bin/sdnc.monitor | 125 +++++++++++++++++++++ .../sdnc/sdnc-prom/resources/bin/switchVoting.sh | 110 ++++++++++++++++++ .../sdnc/sdnc-prom/resources/config/config.json | 19 ++++ .../sdnc-prom/resources/config/healthchecks.json | 1 + kubernetes/sdnc/sdnc-prom/templates/configmap.yaml | 29 +++++ .../sdnc/sdnc-prom/templates/deployment.yaml | 95 ++++++++++++++++ kubernetes/sdnc/sdnc-prom/values.yaml | 102 +++++++++++++++++ kubernetes/sdnc/templates/configmap.yaml | 8 ++ kubernetes/sdnc/values.yaml | 3 +- 33 files changed, 1218 insertions(+), 92 deletions(-) create mode 100644 kubernetes/consul/resources/config/consul-agent-config/scripts/sdnc-cluster-health.sh create mode 100644 kubernetes/consul/resources/config/consul-agent-config/sdnc-cluster-health.json create mode 100644 kubernetes/sdnc/Makefile create mode 100644 kubernetes/sdnc/resources/env.yaml delete mode 100755 kubernetes/sdnc/resources/geo/bin/sdnc.failover create mode 100755 kubernetes/sdnc/resources/geo/bin/sdnc.makeActive create mode 100755 kubernetes/sdnc/resources/geo/bin/sdnc.monitor create mode 100644 kubernetes/sdnc/sdnc-prom/Chart.yaml create mode 100644 kubernetes/sdnc/sdnc-prom/requirements.yaml create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor create mode 100755 kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh create mode 100644 kubernetes/sdnc/sdnc-prom/resources/config/config.json create mode 100644 kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json create mode 100644 kubernetes/sdnc/sdnc-prom/templates/configmap.yaml create mode 100644 kubernetes/sdnc/sdnc-prom/templates/deployment.yaml create mode 100644 kubernetes/sdnc/sdnc-prom/values.yaml diff --git a/kubernetes/consul/resources/config/consul-agent-config/scripts/sdnc-cluster-health.sh b/kubernetes/consul/resources/config/consul-agent-config/scripts/sdnc-cluster-health.sh new file mode 100644 index 0000000000..3b186547ce --- /dev/null +++ b/kubernetes/consul/resources/config/consul-agent-config/scripts/sdnc-cluster-health.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# Copyright © 2018 Amdocs +# +# 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. + +# query ODL cluster state +USERNAME="{{.Values.odl.jolokia.username}}" +PASSWORD="{{.Values.odl.jolokia.password}}" + +count=${SDNC_ODL_COUNT:-1} +siteId=0 +if [ "$SDNC_IS_PRIMARY_CLUSTER" = "false" ];then + siteId=1 +fi + +for instance in $(seq $count);do + shard=member-$(( $siteId*$count + $instance ))-shard-default-config + mbean=Category=Shards,name=$shard,type=DistributedConfigDatastore + url=http://{{.Release.Name}}-sdnc-$(( $instance-1 )).sdnc-cluster.{{.Release.Namespace}}:8181/jolokia/read/org.opendaylight.controller:$mbean + + response=$( curl -s -u $USERNAME:$PASSWORD $url ) + rc=$? + if [ $rc -ne 0 ];then + # failed to contact SDN-C instance - try another + echo "Unable to connect to $shard [rc=$?]" + continue + fi + + status=$( echo "$response" | jq -r ".status" ) + if [ "$status" != "200" ];then + # query failed, try another instance + echo "$shard query failed [http-status=$status]" + continue + fi + + raftState=$( echo "$response" | jq -r ".value.RaftState" ) + if [ "$raftState" = "Leader" -o "$raftState" = "Follower" ];then + # cluster has a leader and is healthy + echo "$shard is healthy [RaftState=$raftState]" + exit 0 + else + echo "$shard is not healthy [RaftState=$raftState]" + fi +done + +# ODL cluster is not healthy +exit 2 diff --git a/kubernetes/consul/resources/config/consul-agent-config/sdnc-cluster-health.json b/kubernetes/consul/resources/config/consul-agent-config/sdnc-cluster-health.json new file mode 100644 index 0000000000..86a7630392 --- /dev/null +++ b/kubernetes/consul/resources/config/consul-agent-config/sdnc-cluster-health.json @@ -0,0 +1,14 @@ +{ + "service": { + "name": "Health Check: SDNC ODL Cluster", + "checks": [ + { + "id": "sdnc-odl-cluster-healthcheck", + "name": "SDNC ODL Cluster Health Check", + "script": "/consul/scripts/sdnc-cluster-health.sh", + "interval": "15s", + "timeout": "10s" + } + ] + } +} diff --git a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb01-healthcheck.json b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb01-healthcheck.json index e684c09da8..ed196bd0cf 100644 --- a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb01-healthcheck.json +++ b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb01-healthcheck.json @@ -5,7 +5,7 @@ { "id": "sdnctldb01", "name": "SDNC SDNCTLDB01 Health Check", - "tcp": "sdnc-dbhost:3306", + "tcp": "sdnc-sdnctldb01:3306", "interval": "10s", "timeout": "1s" } diff --git a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb02-healthcheck.json b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb02-healthcheck.json index ae4820a3e6..b63329f544 100644 --- a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb02-healthcheck.json +++ b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnctldb02-healthcheck.json @@ -5,7 +5,7 @@ { "id": "sdnctldb02", "name": "SDNC SDNCTLDB02 Health Check", - "tcp": "sdnc-dbhost:3306", + "tcp": "sdnc-sdnctldb02:3306", "interval": "10s", "timeout": "1s" } diff --git a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnhost.json b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnhost.json index 604b5be901..db84164fc7 100644 --- a/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnhost.json +++ b/kubernetes/consul/resources/config/consul-agent-config/sdnc-sdnhost.json @@ -5,7 +5,7 @@ { "id": "sdnc-sdnhost", "name": "SDNC SDN Host Health Check", - "http": "http://sdnhost:8282/apidoc/explorer/index.html", + "http": "http://sdnc:8282/apidoc/explorer/index.html", "method": "HEAD", "header": { "Authorization": ["Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=="], diff --git a/kubernetes/consul/templates/deployment.yaml b/kubernetes/consul/templates/deployment.yaml index d37521b5e6..2df4d2ac12 100644 --- a/kubernetes/consul/templates/deployment.yaml +++ b/kubernetes/consul/templates/deployment.yaml @@ -42,9 +42,15 @@ spec: - /bin/sh - "-c" - | + apk update && apk add jq cp /tmp/consul/config/* /consul/config /usr/local/bin/docker-entrypoint.sh agent -client 0.0.0.0 -enable-script-checks -retry-join {{ .Values.consulServer.nameOverride }} name: {{ include "common.name" . }} + env: + - name: SDNC_ODL_COUNT + value: "{{ .Values.sdnc.replicaCount }}" + - name: SDNC_IS_PRIMARY_CLUSTER + value: "{{ .Values.sdnc.config.isPrimaryCluster }}" volumeMounts: - mountPath: /tmp/consul/config name: consul-agent-config diff --git a/kubernetes/consul/values.yaml b/kubernetes/consul/values.yaml index abfc9ef0ef..37e74f38d5 100644 --- a/kubernetes/consul/values.yaml +++ b/kubernetes/consul/values.yaml @@ -61,3 +61,13 @@ ingress: enabled: false resources: {} + +odl: + jolokia: + username: admin + password: admin + +sdnc: + config: + isPrimaryCluster: true + replicaCount: 1 diff --git a/kubernetes/sdnc/Makefile b/kubernetes/sdnc/Makefile new file mode 100644 index 0000000000..d634a8c506 --- /dev/null +++ b/kubernetes/sdnc/Makefile @@ -0,0 +1,51 @@ +# 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. + +# FIXME OOM-765 +ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +OUTPUT_DIR := $(ROOT_DIR)/../dist +PACKAGE_DIR := $(OUTPUT_DIR)/packages +SECRET_DIR := $(OUTPUT_DIR)/secrets + +EXCLUDES := +HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) + +.PHONY: $(EXCLUDES) $(HELM_CHARTS) + +all: $(HELM_CHARTS) + +$(HELM_CHARTS): + @echo "\n[$@]" + @make package-$@ + +make-%: + @if [ -f $*/Makefile ]; then make -C $*; fi + +dep-%: make-% + @if [ -f $*/requirements.yaml ]; then helm dep up $*; fi + +lint-%: dep-% + @if [ -f $*/Chart.yaml ]; then helm lint $*; fi + +package-%: lint-% + @mkdir -p $(PACKAGE_DIR) + @if [ -f $*/Chart.yaml ]; then helm package -d $(PACKAGE_DIR) $*; fi + @helm repo index $(PACKAGE_DIR) + +clean: + @rm -f */requirements.lock + @rm -f *tgz */charts/*tgz + @rm -rf $(PACKAGE_DIR) +%: + @: \ No newline at end of file diff --git a/kubernetes/sdnc/requirements.yaml b/kubernetes/sdnc/requirements.yaml index c458755a85..09348140be 100644 --- a/kubernetes/sdnc/requirements.yaml +++ b/kubernetes/sdnc/requirements.yaml @@ -21,4 +21,8 @@ dependencies: repository: '@local' - name: dgbuilder version: ~2.0.0 - repository: '@local' \ No newline at end of file + repository: '@local' + - name: sdnc-prom + version: ~2.0.0 + repository: '@local' + condition: config.geoEnabled diff --git a/kubernetes/sdnc/resources/env.yaml b/kubernetes/sdnc/resources/env.yaml new file mode 100644 index 0000000000..2ad42f79a6 --- /dev/null +++ b/kubernetes/sdnc/resources/env.yaml @@ -0,0 +1,19 @@ +# Copyright © 2018 Amdocs +# +# 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. + +SDNC_GEO_ENABLED: "{{ .Values.config.geoEnabled }}" +SDNC_IS_PRIMARY_CLUSTER: "{{ .Values.config.isPrimaryCluster }}" +SDNC_ODL_COUNT: "{{ .Values.replicaCount }}" +SDNC_LOCAL_K8S_CLUSTER_MASTER: "{{ .Values.config.myODLCluster }}" +SDNC_REMOTE_K8S_CLUSTER_MASTER: "{{ .Values.config.peerODLCluster }}" diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.cluster b/kubernetes/sdnc/resources/geo/bin/sdnc.cluster index d59718fa27..87cdeffe89 100755 --- a/kubernetes/sdnc/resources/geo/bin/sdnc.cluster +++ b/kubernetes/sdnc/resources/geo/bin/sdnc.cluster @@ -1,6 +1,18 @@ #!/bin/bash -OOM_HOME=${OOM_HOME:-$HOME} +# Copyright © 2018 Amdocs +# +# 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 ! [ "$(command -v jq)" ]; then echo "Error: jq is not installed." @@ -8,7 +20,8 @@ if ! [ "$(command -v jq)" ]; then exit 1 fi -IS_PRIMARY_CLUSTER=`./sdnc.isPrimaryCluster` +dir=$( dirname $0 ) +IS_PRIMARY_CLUSTER=$( $dir/sdnc.isPrimaryCluster ) case $IS_PRIMARY_CLUSTER in true) @@ -18,21 +31,30 @@ false) MEMBER_NUMBER=4 ;; *) - echo "Error: isPrimaryODLCluster not defined in ${OOM_HOME}/oom/kubernetes/sdnc/values.yaml." + echo "Error: isPrimaryCluster not defined in $dir/../../../values.yaml." exit 1 ;; esac +USERNAME=admin +PASSWORD=admin + for pod_number in {0..2} do - curl "http://localhost:3026$((${pod_number} + 1))" > /dev/null 2>&1 - if [ "$?" = "7" ]; then + + response=`curl -s -u $USERNAME:$PASSWORD -H "Content-Type: application/json" -H "Accept: application/json" -X GET http://localhost:3026$((${pod_number} + 1))/jolokia/read/org.opendaylight.controller:Category=Shards,name=member-$((${MEMBER_NUMBER} + ${pod_number}))-shard-default-config,type=DistributedConfigDatastore` + + if [ $? -ne 0 ]; then continue fi - VOTING_RESULT=`curl -u admin:admin -H "Content-Type: application/json" -H "Accept: application/json" -X GET http://localhost:3026$((${pod_number} + 1))/jolokia/read/org.opendaylight.controller:Category=Shards,name=member-$((${MEMBER_NUMBER} + ${pod_number}))-shard-default-config,type=DistributedConfigDatastore 2>/dev/null | jq '.value.Voting'` + status=$( echo -E "$response" | jq -r ".status" ) + if [ "$status" != "200" ]; then + continue + fi - case $VOTING_RESULT in + voting=$( echo -E "$response" | jq -r ".value.Voting" ) + case $voting in true) echo "active" exit 0 diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.failover b/kubernetes/sdnc/resources/geo/bin/sdnc.failover deleted file mode 100755 index 961a5cb5cf..0000000000 --- a/kubernetes/sdnc/resources/geo/bin/sdnc.failover +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl -s -use strict; - -my $keyWord_standby = "standby"; -my $keyWord_active = "active"; -my $keyWord_true = "true"; -my $keyWord_false = "false"; -my $keyWord_success = "success"; -my $keyWord_failure = "failure"; -my $file_cluster = "sdnc.cluster"; -my $file_switchVoting = "switchVoting.sh"; -my $file_isPrimaryCluster = "sdnc.isPrimaryCluster"; - -if ((!(-e $file_cluster)) || (!(-e $file_switchVoting))|| (!(-e $file_isPrimaryCluster))) { - # file not exist. - print qq|$keyWord_failure\n|; - exit 1; -} - -my $roleRes = qx("./$file_isPrimaryCluster"); -my $clusterRes = qx("./$file_cluster"); - -if ( index ($clusterRes, $keyWord_standby) != -1) { - # We are at standby side - if ( index ($roleRes, $keyWord_false) != -1) { - # We are at Secondary cluster - sub_activate_secondary(); - } elsif ( index ($roleRes, $keyWord_true) != -1) { - # We are at Primary cluster - sub_activate_primary(); - } else { - # Error. - print qq|$keyWord_failure\n|; - exit 1; - } -} elsif ( index ($clusterRes, $keyWord_active) != -1) { - # We are at active side - if ( index ($roleRes, $keyWord_false) != -1) { - # We are at Secondary cluster - sub_activate_primary(); - } elsif ( index ($roleRes, $keyWord_true) != -1) { - # We are at Primary cluster - sub_activate_secondary(); - } else { - # Error. - print qq|$keyWord_failure\n|; - exit 1; - } -} else { - # Error. - print qq|$keyWord_failure\n|; - exit 1; -} - -sub sub_activate_primary { - #Switching voting in Primary cluster - system("./$file_switchVoting primary"); - print qq|$keyWord_success\n|; -} - -sub sub_activate_secondary { - #Switching voting in secondary cluster - system("./$file_switchVoting secondary"); - print qq|$keyWord_success\n|; -} diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster b/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster index 77fc65fe39..7a4f6a7dd0 100755 --- a/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster +++ b/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster @@ -1,8 +1,22 @@ #!/bin/bash -OOM_HOME=${OOM_HOME:-$HOME} +# Copyright © 2018 Amdocs +# +# 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. -IS_PRIMARY_CLUSTER=`awk '/isPrimaryCluster/ {print $2}' ${OOM_HOME}/oom/kubernetes/sdnc/values.yaml` +dir=$( dirname $0 ) + +IS_PRIMARY_CLUSTER=`awk '/isPrimaryCluster/ {print $2}' $dir/../../../values.yaml` if [ "$?" -eq "2" ]; then echo "Make sure you are ubuntu user." >&2 diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.makeActive b/kubernetes/sdnc/resources/geo/bin/sdnc.makeActive new file mode 100755 index 0000000000..76eca48af5 --- /dev/null +++ b/kubernetes/sdnc/resources/geo/bin/sdnc.makeActive @@ -0,0 +1,45 @@ +#!/bin/sh + +# Copyright © 2018 Amdocs +# +# 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 [ $# -lt 1 ];then + echo "Usage: makeactive [namespace]" + exit 1 +fi + +RELEASE=$1 +NAMESPACE=onap +if [ -n "$2" ];then + NAMESPACE=$2 +fi + +dir=$(dirname $0) +isPrimary=$( $dir/sdnc.isPrimaryCluster) +if [ "$isPrimary" = "true" ];then + SITE_NAME="sdnc01" +elif [ "$isPrimary" = "false" ];then + SITE_NAME="sdnc02" +else + echo "sdnc.isPrimaryCluster returned unexpected value \"$isPrimary\"" + exit 1 +fi + +pod=$( kubectl -n $NAMESPACE get pods -l app=sdnc-prom,release=$RELEASE | grep Running | cut -f1 -d' ' ) +if [ -z "$pod" ];then + echo "prom pod not found - is prom running?" + exit 1 +fi + +kubectl -n $NAMESPACE exec $pod -- /app/promoverride.py --id $SITE_NAME --config /app/config/config.json diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.monitor b/kubernetes/sdnc/resources/geo/bin/sdnc.monitor new file mode 100755 index 0000000000..b14bd7325d --- /dev/null +++ b/kubernetes/sdnc/resources/geo/bin/sdnc.monitor @@ -0,0 +1,39 @@ +#!/bin/sh + +# Copyright © 2018 Amdocs +# +# 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 [ $# -lt 1 ];then + echo "Usage: $(basename $0) [--debug] [namespace]" + exit 1 +fi + +if [ "$1" = "--debug" -o "$1" = "-debug" -o "$1" = "-d" ];then + DEBUG="--debug" + shift +fi + +RELEASE=$1 +NAMESPACE=onap +if [ -n "$2" ];then + NAMESPACE=$2 +fi + +pod=$( kubectl -n $NAMESPACE get pods -l app=sdnc-prom,release=$RELEASE | grep Running | cut -f1 -d' ' ) +if [ -z "$pod" ];then + echo "prom pod not found - is prom running?" + exit 1 +fi + +kubectl -n $NAMESPACE exec $pod -- /app/bin/sdnc.monitor $DEBUG diff --git a/kubernetes/sdnc/resources/geo/bin/switchVoting.sh b/kubernetes/sdnc/resources/geo/bin/switchVoting.sh index 27e4ead99d..7a1c193492 100755 --- a/kubernetes/sdnc/resources/geo/bin/switchVoting.sh +++ b/kubernetes/sdnc/resources/geo/bin/switchVoting.sh @@ -1,5 +1,19 @@ #!/bin/bash +# Copyright © 2018 Amdocs +# +# 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. + function usage() { echo usage: switchVoting.sh primary\|secondary @@ -10,18 +24,26 @@ if [ $# -ne 1 ]; then usage fi -partition=$1 +dir=$( dirname $0 ) +USERNAME=admin +PASSWORD=`awk '/odlPassword/ {print $2}' $dir/../../../values.yaml | head -1` -if [ "$partition" == "primary" ]; then - curl -u admin:{{.Values.config.odlPassword}} -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":true}, { "member-name" : "member-2", "voting":true}, { "member-name" : "member-3", "voting":true},{ "member-name" : "member-4", "voting":false},{ "member-name" : "member-5", "voting":false},{ "member-name" : "member-6", "voting":false}] } }' > switch_voting_resp.json 2>/dev/null - echo "" >> switch_voting_resp.json - exit 0 -fi +case "$1" in -if [ "$partition" == "secondary" ]; then - curl -u admin:{{.Values.config.odlPassword}} -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":false}, { "member-name" : "member-2", "voting":false}, { "member-name" : "member-3", "voting":false},{ "member-name" : "member-4", "voting":true},{ "member-name" : "member-5", "voting":true},{ "member-name" : "member-6", "voting":true}] } }' > switch_voting_resp.json 2>/dev/null - echo "" >> switch_voting_resp.json - exit 0 -fi +primary) + status=$(curl -u $USERNAME:$PASSWORD -o /dev/null -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":true}, { "member-name" : "member-2", "voting":true}, { "member-name" : "member-3", "voting":true},{ "member-name" : "member-4", "voting":false},{ "member-name" : "member-5", "voting":false},{ "member-name" : "member-6", "voting":false}] } }' -w "%{http_code}\n" $url 2> /dev/null) +;; -usage +secondary) + status=$(curl -u $USERNAME:$PASSWORD -o /dev/null -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":false}, { "member-name" : "member-2", "voting":false}, { "member-name" : "member-3", "voting":false},{ "member-name" : "member-4", "voting":true},{ "member-name" : "member-5", "voting":true},{ "member-name" : "member-6", "voting":true}] } }' -w "%{http_code}\n" $url 2> /dev/null) +;; + +*) + usage +esac + +if [ $status -ne 200 ];then + echo "failure" +else + echo "success" +fi diff --git a/kubernetes/sdnc/sdnc-prom/Chart.yaml b/kubernetes/sdnc/sdnc-prom/Chart.yaml new file mode 100644 index 0000000000..3c678e2b92 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/Chart.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +description: ONAP SDNC Policy Driven Ownership Management +name: sdnc-prom +version: 2.0.0 diff --git a/kubernetes/sdnc/sdnc-prom/requirements.yaml b/kubernetes/sdnc/sdnc-prom/requirements.yaml new file mode 100644 index 0000000000..37545fe2e0 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/requirements.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh b/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh new file mode 100755 index 0000000000..fb24653129 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# Copyright © 2018 Amdocs +# +# 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. + +debugLog(){ + if [ "$enableDebugLogging" == true ]; then + if [ $# -eq 0 ]; then + echo "" >> $LOGFILE + else + echo $( date ) $@ >> $LOGFILE + fi + fi +} + +failover(){ + lockFile=/tmp/sdnc.failover.lock + # make sure that no failover is currently running + if [ -e ${lockFile} ] && kill -0 $(cat ${lockFile}) 2> /dev/null; then + debugLog "Currently running sdnc and dns failover" + return + fi + trap "rm -f ${lockFile}" INT TERM RETURN + echo $BASHPID > ${lockFile} + + # perform takeover + debugLog "Started executing sdnc.failover for $SITE_NAME" + takeoverResult=$( /app/bin/sdnc.failover ) + debugLog "Completed executing sdnc.failover. takeoverResult is: $takeoverResult" + if [ "success" = "$takeoverResult" ]; then + # update CoreDNS upon successful execution of sdnc.failover script + debugLog "Executing sdnc.dnsswitch" + /app/bin/sdnc.dnsswitch + rc=$? + debugLog "Completed executing sdnc.dnsswitch for $SITE_NAME. rc=$rc" + else + debugLog "Cluster takeover current status: $takeoverResult on $SITE_NAME." + rc=1 + fi + + if [ $rc -ne 0 ];then + takeoverResult="failure" + fi + + data="{\ +\"type\": \"failover\",\ +\"status\": \"$takeoverResult\",\ +\"site\": \"$SITE_NAME\",\ +\"deployment\": \"{{.Values.config.deployment}}\",\ +\"timestamp\": \"$(date '+%F %T')\"\ +}" + + # notifications are best-effort - ignore any failures + curl -H "Content-Type: application/json" -X POST --data "$data" http://$message_router/events/$topic >/dev/null 2>&1 + +} + +LOGFILE="/app/geo.log" +enableDebugLogging=true +message_router=message-router:3904 +topic={{.Values.config.messageRouterTopic}} +SITE_NAME="sdnc01" +if [ "$SDNC_IS_PRIMARY_CLUSTER" = "false" ];then + SITE_NAME="sdnc02" +fi + +debugLog +debugLog "Executing ensureSdncActive" + +# query SDN-C cluster status +debugLog "Started executing sdnc.cluster" +clusterStatus=$( /app/bin/sdnc.cluster ) +debugLog "Completed executing sdnc.cluster. Cluster status is: $clusterStatus" + +if [ "active" = "$clusterStatus" ]; then + # peform health-check + debugLog "Started excuting sdnc.monitor" + health=$( /app/bin/sdnc.monitor ) + debugLog "Completed executing sdnc.monitor. Cluster is: $health" + + if [ "healthy" = "$health" ]; then + # Cluster is ACTIVE and HEALTHY + exit 0 + fi + exit 1 + +elif [ "standby" = "$clusterStatus" ]; then + # Run failover in background process and allow PROM to continue + ( failover & ) + exit 0 +fi + +# Unknown cluster status +exit 1 diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh b/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh new file mode 100755 index 0000000000..8dd84bd3ea --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Copyright © 2018 Amdocs +# +# 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. + +debugLog(){ + if [ "$enableDebugLogging" == true ]; then + if [ $# -eq 0 ]; then + echo "" >> $LOGFILE + else + echo $( date ) $@ >> $LOGFILE + fi + fi +} + +LOGFILE="/app/geo.log" +enableDebugLogging=true + +debugLog +debugLog "Executing ensureSdncStandby" + +# query SDN-C cluster status +debugLog "Started executing sdnc.cluster" +clusterStatus=$( /app/bin/sdnc.cluster ) +debugLog "Completed executing sdnc.cluster. Cluster status is: $clusterStatus" + +if [ "active" = "$clusterStatus" ]; then + # assume transient error as other side transitions to ACTIVE + debugLog "Cluster status: $clusterStatus. exit 0" + exit 0 + +elif [ "standby" = "$clusterStatus" ]; then + # check that standby cluster is healthy + debugLog "Started executing sdnc.monitor. Cluster status is: $clusterStatus" + health=$( /app/bin/sdnc.monitor ) + debugLog "Completed executing sdnc.monitor. Cluster is: $health" + if [ "failure" = "$health" ];then + # Backup site is unhealthy - can't accept traffic! + exit 1 + fi + # Cluster is standing by + exit 0 +fi + +debugLog "Unknown cluster status: $clusterStatus" +# Unknown cluster status +exit 1 diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh b/kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh new file mode 100755 index 0000000000..c93ba24bd7 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Copyright © 2018 Amdocs +# +# 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 [ "${SDNC_IS_PRIMARY_CLUSTER:-true}" = "true" ];then + id=sdnc01 +else + id=sdnc02 +fi + +# should PROM start as passive? +state=$( bin/sdnc.cluster ) +if [ "$state" == "standby" ]; then + echo "Starting PROM in passive mode" + passive="-p" +fi + +# start PROM as foreground process +java -jar prom.jar --id $id $passive --config config diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster new file mode 100755 index 0000000000..76603410d4 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright © 2018 Amdocs +# +# 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. + +# query ODL cluster state +USERNAME="{{.Values.odl.jolokia.username}}" +PASSWORD="{{.Values.odl.jolokia.password}}" + +count=${SDNC_ODL_COUNT:-1} +memberStart=0 +if [ "${SDNC_IS_PRIMARY_CLUSTER:-true}" != "true" ];then + memberStart=$(( $memberStart + $count )) +fi + +for instance in $(seq $count);do + shard=member-$(( $memberStart + $instance ))-shard-default-config + mbean=Category=Shards,name=$shard,type=DistributedConfigDatastore + url=http://{{.Release.Name}}-sdnc-$(( $instance-1 )).sdnc-cluster.{{.Release.Namespace}}:8181/jolokia/read/org.opendaylight.controller:$mbean + + response=$( curl -s -u $USERNAME:$PASSWORD $url ) + rc=$? + if [ $rc -ne 0 ];then + # failed to contact SDN-C instance - try another + continue + fi + status=$( echo -E "$response" | jq -r ".status" ) + if [ "$status" != "200" ];then + # query failed, try another instance + continue + fi + + voting=$( echo -E "$response" | jq -r ".value.Voting" ) + case $voting in + true) + echo "active" + exit 0 + ;; + false) + echo "standby" + exit 0 + ;; + *) + echo "Error: Voting status could not be determined." + exit 1 + ;; + esac +done +echo "Error: Voting status could not be determined." +exit 1 diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch new file mode 100755 index 0000000000..209352c4e3 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch @@ -0,0 +1,22 @@ +#! /bin/bash + +# Copyright © 2018 Amdocs +# +# 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. + +#################################################################################################### +# sdncDnsSwitchWrapper.bash: Wrapper script to invoke SDNC DNS Switch for domain: sdnc.example.com # +#################################################################################################### +ssh -i {{.Values.coreDNS.sshKeyFile}} -o StrictHostKeyChecking=no {{.Values.coreDNS.sshUser}}@{{.Values.coreDNS.host}} "{{.Values.coreDNS.switchScript}} $SDNC_LOCAL_K8S_CLUSTER_MASTER {{.Values.config.deployment}}" + +exit $? diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover new file mode 100755 index 0000000000..e78b7eeee3 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover @@ -0,0 +1,86 @@ +#!/bin/bash + +# Copyright © 2018 Amdocs +# +# 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. + +LOGFILE="/app/geo.log" +enableDebugLogging=true +message_router=message-router:3904 +topic={{.Values.config.messageRouterTopic}} +KEYWORD_success="success" +KEYWORD_failure="failure" +SITE_NAME="sdnc01" +if [ "$SDNC_IS_PRIMARY_CLUSTER" = "false" ];then + SITE_NAME="sdnc02" +fi + +APP_BIN=/app/bin + +debugLog(){ + if [ "$enableDebugLogging" == true ]; then + if [ $# -eq 0 ]; then + echo "" >> $LOGFILE + else + echo $( date ) $@ >> $LOGFILE + fi + fi +} + +EXC_SIMPLE_FAILOVER=`${APP_BIN}/switchVoting.sh` + +if [ "$EXC_SIMPLE_FAILOVER" == "success" ]; then + debugLog "Simple failover success. SDNC failover completed." +else + # Simple failover failed. Trying catastrophic failover ... + debugLog "Simple failover failed. Trying catastrophic failover for $SITE_NAME ..." + + # Notify Dmaap before executing catastrophic failover, because all connections will be reset. + data="{\ + \"type\": \"Catastrophic failover\",\ + \"reason\": \"Simple failover failed\",\ + \"message_router\": \"$message_router\",\ + \"topic\": \"$topic\",\ + \"site\": \"$SITE_NAME\",\ + \"deployment\": \"{{.Values.config.deployment}}\",\ + \"timestamp\": \"$(date '+%F %T')\"\ + }" + + debugLog "$data" + + # notifications to Dmaap + curl -H "Content-Type: application/json" -X POST --data "$data" http://$message_router/events/$topic >/dev/null 2>&1 + + # We're going to kill prom, so we need to do dnsswitch now + + debugLog "Executing sdnc.dnsswitch" + + /app/bin/sdnc.dnsswitch > /dev/null 2>&1 + rc=$? + if [ $rc -ne 0 ];then + debugLog "sdnc.dnsswitch FAILED" + echo $KEYWORD_failure + exit 0 + fi + + # Now do catastrophic failure + + debugLog "Catastrophic failover in progress" + + ssh -o StrictHostKeyChecking=no -i /app/config/coredns/master.key root@$SDNC_LOCAL_K8S_CLUSTER_MASTER "su - ubuntu bash -c 'helm upgrade --set sdnc.config.geoEnabled=false dev local/onap --namespace onap; kubectl -n onap delete pods -l app=sdnc'" > /dev/null 2>&1 + + # Sleep here so prom can die without us passing control back to ensureSDNCActive + sleep 300 +fi + +echo $KEYWORD_success diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor new file mode 100755 index 0000000000..0042ac368a --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor @@ -0,0 +1,125 @@ +#!/usr/bin/env python2 +# encoding: utf-8 + +# Copyright © 2018 Amdocs +# +# 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. + +import sys +import os +import json +import requests +from datetime import datetime + +consul_server = "consul-server:8500" +message_router = "message-router:3904" +topic = '{{.Values.config.messageRouterTopic}}' +log_file='/app/monitor.log' +status_file='/app/.health' +logEnabled=False + +siteName='sdnc01' +if os.environ.get('SDNC_IS_PRIMARY_CLUSTER', 'true') == 'false': + siteName='sdnc02' + +debug=False +if len(sys.argv) > 1 and sys.argv[1] == '--debug': + debug=True + +def get_state(healthcheck): + response = requests.get("http://" + consul_server + "/v1/health/checks/" + healthcheck) + if response.status_code != 200: + raise RuntimeError("HTTP " + str(response.status_code)) + data = response.json() + if len(data) == 0: + raise RuntimeError(healthcheck + " not found") + if len(data) > 1: + raise RuntimeError("Multiple states for " + healthcheck + " found") + + return data[0] + + +def log(message): + if logEnabled: + with open(log_file, 'a') as f: + f.write(str(datetime.now()) + " " + message + "\n") + +def healthcheck(checks, failFirst=True): + if len(checks) == 0: + return True + + for check in checks: + if type(check) is list: + passing = healthcheck(check, False) + else: + state = get_state(check) + status = state['Status'] + passing = status == "passing" or status == "warning" + log(check + " " + status) + if debug: + if status == "passing": + color = "\033[32m" # green + elif status == "warning": + color = "\033[33m" # yellow + else: + color = "\033[31m" # red + print check, color + status + "\033[0m" + if not passing: + print "\tCause:", state['Output'] + + + if passing: + if not failFirst: + # found a passing check so can stop here + return True + else: + if failFirst: + # found a failing check so can stop here + return False + + return failFirst + + +try: + with open("/app/config/healthchecks.json") as f: + checks = json.load(f) + + try: + with open(status_file) as f: + previous_result = f.read() + except IOError: + # file doesn't exist + previous_result = 'unknown' + + if healthcheck(checks): + result = "healthy" + else: + result = "unhealthy" + + print result + + # save current result to file + with open(status_file, 'w') as f: + f.write(result) + + if previous_result != 'unknown' and result != previous_result: + payload = { 'type' : 'health-change', 'status': result, 'site': siteName, 'deployment': '{{.Values.config.deployment}}', 'timestamp': str(datetime.now()) } + log("Posting event " + str(payload)) + try: + requests.post("http://" + message_router + "/events/" + topic, data=json.dumps(payload), headers={ 'Content-Type' : 'application/json' } ) + except Exception: + # events are best-effort + pass + +except Exception as e: + sys.exit(str(e)) diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh b/kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh new file mode 100755 index 0000000000..f13196e7e8 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh @@ -0,0 +1,110 @@ +#/bin/sh + +# Copyright © 2018 Amdocs +# +# 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. + +set -e +primary=${SDNC_IS_PRIMARY_CLUSTER:-true} + +url=http://sdnc:8282/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards +username="${ODL_USERNAME:-{{.Values.odl.restconf.username}}}" +password="${ODL_PASSWORD:-{{.Values.odl.restconf.password}}}" +LOGFILE="/app/geo.log" +enableDebugLogging=true + +debugLog(){ + if [ "$enableDebugLogging" == true ]; then + if [ $# -eq 0 ]; then + echo "" >> $LOGFILE + else + echo $( date ) $@ >> $LOGFILE + fi + fi +} + + +if [ "$primary" = "true" ]; then + votingState=' +{ + "input": { + "member-voting-state": [ + { + "member-name": "member-1", + "voting": true + }, + { + "member-name": "member-2", + "voting": true + }, + { + "member-name": "member-3", + "voting": true + }, + { + "member-name": "member-4", + "voting": false + }, + { + "member-name": "member-5", + "voting": false + }, + { + "member-name": "member-6", + "voting": false + } + ] + } +}' +else + votingState=' +{ + "input": { + "member-voting-state": [ + { + "member-name": "member-1", + "voting": false + }, + { + "member-name": "member-2", + "voting": false + }, + { + "member-name": "member-3", + "voting": false + }, + { + "member-name": "member-4", + "voting": true + }, + { + "member-name": "member-5", + "voting": true + }, + { + "member-name": "member-6", + "voting": true + } + ] + } +}' +fi + +status=$(curl -s -u $username:$password -o /dev/null -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "$votingState" -w "%{http_code}\n" $url 2> /dev/null) +if [ $status -ne 200 ];then + debugLog "Switch voting failed. status: $status ,username: $username ,password: $password ,votingState: $votingState ,url:$url " + echo "failure" +else + echo "success" +fi + diff --git a/kubernetes/sdnc/sdnc-prom/resources/config/config.json b/kubernetes/sdnc/sdnc-prom/resources/config/config.json new file mode 100644 index 0000000000..54f95c140c --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/config/config.json @@ -0,0 +1,19 @@ +{ + "app-name": "{{.Values.config.deployment}}", + "aid": "{{.Values.config.aid}}", + "namespace": "{{.Values.config.deployment}}", + "userid": "{{.Values.config.deployment}}", + "password": "{{.Values.config.password}}", + "prom-timeout": "{{.Values.config.promTimeout}}", + "core-monitor-sleep-time": "{{.Values.config.coreMonitorSleepTime}}", + "no-of-retry-attempts": "{{.Values.config.noOfRetryAttempts}}", + "restart-backoff-time": "{{.Values.config.restartBackoffTime}}", + "replica-id-list": [ "sdnc01", "sdnc02" ], + "ensure-active-sdnc01": "/app/bin/ensureSdncActive.sh", + "ensure-active-sdnc02": "/app/bin/ensureSdncActive.sh", + "ensure-passive-sdnc01": "/app/bin/ensureSdncStandby.sh", + "ensure-passive-sdnc02": "/app/bin/ensureSdncStandby.sh", + "music-connection-timeout-ms": "{{.Values.config.musicConnectionTimeoutMs}}", + "music-location": {{.Values.config.musicLocation|toJson}}, + "music-version": "2" +} diff --git a/kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json b/kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json new file mode 100644 index 0000000000..ea8ceccc0c --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json @@ -0,0 +1 @@ +{{.Values.config.healthChecks|toJson}} diff --git a/kubernetes/sdnc/sdnc-prom/templates/configmap.yaml b/kubernetes/sdnc/sdnc-prom/templates/configmap.yaml new file mode 100644 index 0000000000..cf4332334b --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/templates/configmap.yaml @@ -0,0 +1,29 @@ +# Copyright © 2018 Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-configmap + 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/bin/*").AsConfig . | indent 2 }} diff --git a/kubernetes/sdnc/sdnc-prom/templates/deployment.yaml b/kubernetes/sdnc/sdnc-prom/templates/deployment.yaml new file mode 100644 index 0000000000..76f722c65f --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/templates/deployment.yaml @@ -0,0 +1,95 @@ +# Copyright © 2018 Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: extensions/v1beta1 +kind: 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: 1 + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - sdnc + - --container-name + - consul + 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: "{{ include "common.repository" . }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + envFrom: + - configMapRef: + name: {{ .Release.Name }}-sdnc-env + workingDir: "/app" + command: [ "bin/prom.sh" ] + volumeMounts: + - name: localtime + mountPath: /etc/localtime + readOnly: true + - name: prom-config + mountPath: /app/config + - name: prom-scripts + mountPath: /app/bin + - name: core-dns-keyfile + mountPath: /app/config/coredns + + 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: prom-config + configMap: + name: {{ include "common.fullname" . }}-configmap + - name: prom-scripts + configMap: + name: {{ include "common.fullname" . }}-scripts + defaultMode: 0755 + - name: core-dns-keyfile + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} + imagePullSecrets: + - name: {{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/sdnc/sdnc-prom/values.yaml b/kubernetes/sdnc/sdnc-prom/values.yaml new file mode 100644 index 0000000000..fbee9b9d96 --- /dev/null +++ b/kubernetes/sdnc/sdnc-prom/values.yaml @@ -0,0 +1,102 @@ +# Copyright © 2018 Amdocs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + repository: nexus3.onap.org:10001 + readinessRepository: oomk8s + readinessImage: readiness-check:2.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + persistence: + mountPath: /dockerdata-nfs + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +pullPolicy: Always +image: onap/music/prom:1.0.5-latest + +# application configuration +config: + # generate aid from onboarding your app in MUSIC + aid: "aid_for_your_app" + deployment: "test_onap" + password: "onap123" + musicLocation: + - "1.2.3.4" + - "1.2.3.5" + - "1.2.3.6" + musicConnectionTimeoutMs: "1000" + promTimeout: "35000" + coreMonitorSleepTime: "15000" + noOfRetryAttempts: "2" + restartBackoffTime: "15000" + healthChecks: + # All top-level checks must pass + - "Health Check: SDNC - SDN Host" + - "Health Check: SDNC" + - "Health Check: SDNC ODL Cluster" + - "Health Check: SDNC Portal" + # Within nested lists, only one must pass + - - "Health Check: SDNC-SDN-CTL-DB-01" + - "Health Check: SDNC-SDN-CTL-DB-02" + messageRouterTopic: "SDNC-GEO-REDUNDANCY" + +odl: + jolokia: + username: "admin" + password: "admin" + restconf: + username: "admin" + password: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" + +coreDNS: + host: 1.2.3.7 + sshUser: root + sshKeyFile: /app/config/coredns/coredns.key + switchScript: /home/ubuntu/dnsSwitch.bash + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 90 + periodSeconds: 90 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +persistence: + enabled: true + accessMode: ReadWriteOnce + size: 1Gi + mountPath: /dockerdata-nfs + mountSubPath: coredns + +ingress: + enabled: false + +resources: {} diff --git a/kubernetes/sdnc/templates/configmap.yaml b/kubernetes/sdnc/templates/configmap.yaml index e9498cb8dc..6f4ee2285e 100644 --- a/kubernetes/sdnc/templates/configmap.yaml +++ b/kubernetes/sdnc/templates/configmap.yaml @@ -43,3 +43,11 @@ metadata: namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/conf/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-env + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Get "resources/env.yaml") . | indent 2 }} diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index 0c602e50cd..c214d71a81 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -48,7 +48,7 @@ config: # if geoEnabled is set to true the following 3 values must be set to their proper values myODLCluster: 127.0.0.1 peerODLCluster: 127.0.0.1 - isPrimaryCluster: false + isPrimaryCluster: true configDir: /opt/onap/sdnc/data/properties dmaapTopic: SUCCESS dmaapPort: 3904 @@ -57,7 +57,6 @@ config: ansibleServiceName: sdnc-ansible-server ansiblePort: 8000 - # dependency / sub-chart configuration dmaap-listener: nameOverride: sdnc-dmaap-listener -- cgit 1.2.3-korg From b53c6a3e7dc5fb0c1af7eefcc398dcd5a8cd8fa8 Mon Sep 17 00:00:00 2001 From: hb123f Date: Thu, 12 Jul 2018 14:21:16 -0400 Subject: Expose portal sdk port Issue-ID: OOM-1117 Expose portal sdk port on OOM Change-Id: Ie663733cab6bad1650c7b92efab60c6478e3b06f Signed-off-by: hb123f --- kubernetes/portal/charts/portal-mariadb/values.yaml | 2 +- kubernetes/portal/charts/portal-sdk/templates/service.yaml | 2 +- kubernetes/portal/charts/portal-sdk/values.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kubernetes/portal/charts/portal-mariadb/values.yaml b/kubernetes/portal/charts/portal-mariadb/values.yaml index fe41734ea7..cc662507b2 100644 --- a/kubernetes/portal/charts/portal-mariadb/values.yaml +++ b/kubernetes/portal/charts/portal-mariadb/values.yaml @@ -56,7 +56,7 @@ config: # application's front end hostname. Must be resolvable on the client side environment cliHostName: "cli.api.simpledemo.onap.org" # portal sdk (demo app) ui assignment for port 8990 - portalSdkPort: "" # TODO: populate with port + portalSdkPort: "30235" # application's front end hostname. Must be resolvable on the client side environment portalSdkHostName: "portal-sdk.simpledemo.onap.org" # dmaap bus controller ui assignment for port ? diff --git a/kubernetes/portal/charts/portal-sdk/templates/service.yaml b/kubernetes/portal/charts/portal-sdk/templates/service.yaml index 75d4a14dcf..7cd05606e8 100644 --- a/kubernetes/portal/charts/portal-sdk/templates/service.yaml +++ b/kubernetes/portal/charts/portal-sdk/templates/service.yaml @@ -26,7 +26,7 @@ spec: type: {{ .Values.service.type }} ports: {{if eq .Values.service.type "NodePort" -}} - - port: {{ .Values.service.externalPort }} + - port: {{ .Values.service.internalPort }} targetPort: {{ .Values.service.internalPort }} nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} name: {{ .Values.service.portName }} diff --git a/kubernetes/portal/charts/portal-sdk/values.yaml b/kubernetes/portal/charts/portal-sdk/values.yaml index fb4d0765e1..b92685c12c 100644 --- a/kubernetes/portal/charts/portal-sdk/values.yaml +++ b/kubernetes/portal/charts/portal-sdk/values.yaml @@ -53,11 +53,11 @@ readiness: periodSeconds: 10 service: - type: ClusterIP + type: NodePort name: portal-sdk portName: portal-sdk - externalPort: 8990 internalPort: 8080 + nodePort: 35 mariadb: service: -- cgit 1.2.3-korg From cdbd3ab5d9dc4c56614e1feb329366e516f24a1e Mon Sep 17 00:00:00 2001 From: BorislavG Date: Tue, 17 Jul 2018 08:42:23 +0000 Subject: Fix portal-sdk nodePort Issue-ID: OOM-1284 Change-Id: Ibbed1af73656585fd4ce9284b13d52d452718d4c Signed-off-by: BorislavG --- kubernetes/portal/charts/portal-mariadb/values.yaml | 2 +- kubernetes/portal/charts/portal-sdk/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kubernetes/portal/charts/portal-mariadb/values.yaml b/kubernetes/portal/charts/portal-mariadb/values.yaml index cc662507b2..0fb6c0e812 100644 --- a/kubernetes/portal/charts/portal-mariadb/values.yaml +++ b/kubernetes/portal/charts/portal-mariadb/values.yaml @@ -56,7 +56,7 @@ config: # application's front end hostname. Must be resolvable on the client side environment cliHostName: "cli.api.simpledemo.onap.org" # portal sdk (demo app) ui assignment for port 8990 - portalSdkPort: "30235" + portalSdkPort: "30212" # application's front end hostname. Must be resolvable on the client side environment portalSdkHostName: "portal-sdk.simpledemo.onap.org" # dmaap bus controller ui assignment for port ? diff --git a/kubernetes/portal/charts/portal-sdk/values.yaml b/kubernetes/portal/charts/portal-sdk/values.yaml index b92685c12c..928c0a305f 100644 --- a/kubernetes/portal/charts/portal-sdk/values.yaml +++ b/kubernetes/portal/charts/portal-sdk/values.yaml @@ -57,7 +57,7 @@ service: name: portal-sdk portName: portal-sdk internalPort: 8080 - nodePort: 35 + nodePort: 12 mariadb: service: -- cgit 1.2.3-korg From 01a80afbf5e04b9c05b3f590d643c81b16088b3b Mon Sep 17 00:00:00 2001 From: "Arul.Nambi" Date: Tue, 17 Jul 2018 16:02:30 -0400 Subject: AAI-UI es index are not getting populated This change request contains the following fixes 1) SSL exception when contacting search service 2) AAI not posting to DMaap as it could not contact message-router 3) Search service unable to reach elastic search 4) Index name different between synapse and AAI-UI 5) Sparky starting before es which leads to the indexes not being created 6) Changing the DMaaP topic on synapse to listen to the ones posted by AAI Issue-ID: OOM-1290 Change-Id: I8126755c50f6842d8aee429436fb57b8b96a3819 Signed-off-by: Arul.Nambi --- .../resources/dynamic/conf/entity-event-policy.xml | 4 ++-- .../aai-elasticsearch/templates/deployment.yaml | 1 + .../charts/aai-elasticsearch/templates/service.yaml | 2 +- .../resources/config/application.properties | 2 +- kubernetes/aai/charts/aai-search-data/values.yaml | 2 +- .../config/spring-beans/sparky-core-sync.xml | 8 ++++---- .../charts/aai-sparky-be/templates/deployment.yaml | 19 +++++++++++++++++++ 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/kubernetes/aai/charts/aai-data-router/resources/dynamic/conf/entity-event-policy.xml b/kubernetes/aai/charts/aai-data-router/resources/dynamic/conf/entity-event-policy.xml index e995053f12..5db9092951 100644 --- a/kubernetes/aai/charts/aai-data-router/resources/dynamic/conf/entity-event-policy.xml +++ b/kubernetes/aai/charts/aai-data-router/resources/dynamic/conf/entity-event-policy.xml @@ -5,8 +5,8 @@ http://www.springframework.org/schema/beans/spring-beans.xsd"> - - + + diff --git a/kubernetes/aai/charts/aai-elasticsearch/templates/deployment.yaml b/kubernetes/aai/charts/aai-elasticsearch/templates/deployment.yaml index 0417536625..40c621068c 100644 --- a/kubernetes/aai/charts/aai-elasticsearch/templates/deployment.yaml +++ b/kubernetes/aai/charts/aai-elasticsearch/templates/deployment.yaml @@ -17,6 +17,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} + release: {{ .Release.Name }} name: {{ include "common.name" . }} spec: initContainers: diff --git a/kubernetes/aai/charts/aai-elasticsearch/templates/service.yaml b/kubernetes/aai/charts/aai-elasticsearch/templates/service.yaml index 54ee8b670d..f3a6dbbc5e 100644 --- a/kubernetes/aai/charts/aai-elasticsearch/templates/service.yaml +++ b/kubernetes/aai/charts/aai-elasticsearch/templates/service.yaml @@ -20,6 +20,6 @@ spec: name: {{ .Values.service.portName }} {{- end}} selector: - app: {{ include "common.fullname" . }} + app: {{ include "common.name" . }} release: {{ .Release.Name }} clusterIP: None diff --git a/kubernetes/aai/charts/aai-resources/resources/config/application.properties b/kubernetes/aai/charts/aai-resources/resources/config/application.properties index a65c04e4f0..cfeabb9e0d 100644 --- a/kubernetes/aai/charts/aai-resources/resources/config/application.properties +++ b/kubernetes/aai/charts/aai-resources/resources/config/application.properties @@ -44,7 +44,7 @@ server.ssl.key-store-type=JKS # JMS bind address host port jms.bind.address=tcp://localhost:61647 dmaap.ribbon.eureka.enabled=false -dmaap.ribbon.listOfServers=dmaap.{{ include "common.namespace" . }}:3904 +dmaap.ribbon.listOfServers=message-router.{{.Release.Namespace}}:3904 # Number of milliseconds to wait before making ping requests again dmaap.ribbon.ServerListRefreshInterval=75000 dmaap.ribbon.NFLoadBalancerPingInterval=75000 diff --git a/kubernetes/aai/charts/aai-search-data/values.yaml b/kubernetes/aai/charts/aai-search-data/values.yaml index f781662e79..2c3a005db9 100644 --- a/kubernetes/aai/charts/aai-search-data/values.yaml +++ b/kubernetes/aai/charts/aai-search-data/values.yaml @@ -9,7 +9,7 @@ global: # global defaults # application image repository: nexus3.onap.org:10001 -image: onap/search-data-service:1.2.1 +image: onap/search-data-service:1.2.2 pullPolicy: Always restartPolicy: Always diff --git a/kubernetes/aai/charts/aai-sparky-be/resources/config/spring-beans/sparky-core-sync.xml b/kubernetes/aai/charts/aai-sparky-be/resources/config/spring-beans/sparky-core-sync.xml index 0763f94cd1..29eb4a311a 100644 --- a/kubernetes/aai/charts/aai-sparky-be/resources/config/spring-beans/sparky-core-sync.xml +++ b/kubernetes/aai/charts/aai-sparky-be/resources/config/spring-beans/sparky-core-sync.xml @@ -142,7 +142,7 @@ - + @@ -212,7 +212,7 @@ - + @@ -296,7 +296,7 @@ - + @@ -336,7 +336,7 @@ - + diff --git a/kubernetes/aai/charts/aai-sparky-be/templates/deployment.yaml b/kubernetes/aai/charts/aai-sparky-be/templates/deployment.yaml index b459646a6b..b9de92bb28 100644 --- a/kubernetes/aai/charts/aai-sparky-be/templates/deployment.yaml +++ b/kubernetes/aai/charts/aai-sparky-be/templates/deployment.yaml @@ -34,6 +34,25 @@ spec: release: {{ .Release.Name }} name: {{ include "common.name" . }} spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - aai-elasticsearch + - --container-name + - aai-search-data + - --container-name + - aai + 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: "{{ include "common.repository" . }}/{{ .Values.image }}" -- cgit 1.2.3-korg