diff options
-rw-r--r-- | kubernetes/onap/resources/environments/dev.yaml | 4 | ||||
-rw-r--r-- | kubernetes/onap/values.yaml | 4 | ||||
-rwxr-xr-x | kubernetes/sdnc/resources/config/bin/startODL.sh | 33 | ||||
-rwxr-xr-x | kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster | 2 | ||||
-rw-r--r-- | kubernetes/sdnc/templates/service.yaml | 18 | ||||
-rw-r--r-- | kubernetes/sdnc/templates/statefulset.yaml | 8 | ||||
-rw-r--r-- | kubernetes/sdnc/values.yaml | 7 |
7 files changed, 43 insertions, 33 deletions
diff --git a/kubernetes/onap/resources/environments/dev.yaml b/kubernetes/onap/resources/environments/dev.yaml index e8d1eb1392..9b10012879 100644 --- a/kubernetes/onap/resources/environments/dev.yaml +++ b/kubernetes/onap/resources/environments/dev.yaml @@ -91,11 +91,7 @@ sdnc: replicaCount: 1 - config: - enableClustering: false - mysql: - disableNfsProvisioner: false replicaCount: 1 so: enabled: true diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml index d0b06630fd..c5a56aa715 100644 --- a/kubernetes/onap/values.yaml +++ b/kubernetes/onap/values.yaml @@ -106,11 +106,7 @@ sdnc: replicaCount: 1 - config: - enableClustering: false - mysql: - disableNfsProvisioner: true replicaCount: 1 so: enabled: true diff --git a/kubernetes/sdnc/resources/config/bin/startODL.sh b/kubernetes/sdnc/resources/config/bin/startODL.sh index 288ce11b8b..86f45d3fbd 100755 --- a/kubernetes/sdnc/resources/config/bin/startODL.sh +++ b/kubernetes/sdnc/resources/config/bin/startODL.sh @@ -38,18 +38,14 @@ function enable_odl_cluster(){ node_index=($(echo ${hm} | awk -F"-" '{print $NF}')) member_offset=1 - if [ -z $PEER_ODL_CLUSTER ]; then - echo "This is a local cluster" - node_list="${node}-0.{{.Values.service.name}}-cluster.{{.Release.Namespace}}"; - - for ((i=1;i<${SDNC_REPLICAS};i++)); - do - node_list="${node_list} ${node}-$i.{{.Values.service.name}}-cluster.{{.Release.Namespace}}" - done - /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list} - else + if $GEO_ENABLED; then echo "This is a Geo cluster" + if [ -z $IS_PRIMARY_CLUSTER ] || [ -z $MY_ODL_CLUSTER ] || [ -z $PEER_ODL_CLUSTER ]; then + echo "IS_PRIMARY_CLUSTER, MY_ODL_CLUSTER and PEER_ODL_CLUSTER must all be configured in Env field" + return + fi + if $IS_PRIMARY_CLUSTER; then PRIMARY_NODE=${MY_ODL_CLUSTER} SECONDARY_NODE=${PEER_ODL_CLUSTER} @@ -60,7 +56,19 @@ function enable_odl_cluster(){ fi node_list="${PRIMARY_NODE} ${SECONDARY_NODE}" + /opt/onap/sdnc/bin/configure_geo_cluster.sh $((node_index+member_offset)) ${node_list} + else + echo "This is a local cluster" + + node_list="${node}-0.{{.Values.service.name}}-cluster.{{.Release.Namespace}}"; + + for ((i=1;i<${SDNC_REPLICAS};i++)); + do + node_list="${node_list} ${node}-$i.{{.Values.service.name}}-cluster.{{.Release.Namespace}}" + done + + /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list} fi } @@ -73,10 +81,9 @@ SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} CCSDK_HOME=${CCSDK_HOME:-/opt/onap/ccsdk} SLEEP_TIME=${SLEEP_TIME:-120} MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} -ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false} MYSQL_HOST=${MYSQL_HOST:-{{.Release.Name}}-{{.Values.mysql.nameOverride}}-0.{{.Values.mysql.service.name}}.{{.Release.Namespace}}} -IS_PRIMARY_CLUSTER=${IS_PRIMARY_CLUSTER:-false} -MY_ODL_CLUSTER=${MY_ODL_CLUSTER:-127.0.0.1} +ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false} +GEO_ENABLED=${GEO_ENABLED:-false} # # Wait for database to init properly diff --git a/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster b/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster index 8e816c4153..77fc65fe39 100755 --- a/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster +++ b/kubernetes/sdnc/resources/geo/bin/sdnc.isPrimaryCluster @@ -2,7 +2,7 @@ OOM_HOME=${OOM_HOME:-$HOME} -IS_PRIMARY_CLUSTER=`awk '/isPrimaryODLCluster/ {print $2}' ${OOM_HOME}/oom/kubernetes/sdnc/values.yaml` +IS_PRIMARY_CLUSTER=`awk '/isPrimaryCluster/ {print $2}' ${OOM_HOME}/oom/kubernetes/sdnc/values.yaml` if [ "$?" -eq "2" ]; then echo "Make sure you are ubuntu user." >&2 diff --git a/kubernetes/sdnc/templates/service.yaml b/kubernetes/sdnc/templates/service.yaml index a1648c2e30..63a85a39aa 100644 --- a/kubernetes/sdnc/templates/service.yaml +++ b/kubernetes/sdnc/templates/service.yaml @@ -84,7 +84,7 @@ spec: sessionAffinity: None type: ClusterIP -{{ if .Values.geoEnabled }} +{{ if .Values.config.geoEnabled }} --- apiVersion: v1 kind: Service @@ -98,16 +98,16 @@ spec: - name: {{ .Values.service.portName }}-0-port-{{ .Values.service.internalPort4 }} port: {{ .Values.service.clusterPort2 }} targetPort: {{ .Values.service.internalPort4 }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort4 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort4 }} - name: {{ .Values.service.portName }}-0-port-{{ .Values.service.internalPort }} port: {{ .Values.service.clusterPort3 }} targetPort: {{ .Values.service.internalPort }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort1 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort1 }} type: NodePort selector: statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0 {{ end }} -{{ if .Values.geoEnabled }} +{{ if .Values.config.geoEnabled }} --- apiVersion: v1 kind: Service @@ -121,16 +121,16 @@ spec: - name: {{ .Values.service.portName }}-1-port-{{ .Values.service.internalPort4 }} port: {{ .Values.service.clusterPort2 }} targetPort: {{ .Values.service.internalPort4 }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort5 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort5 }} - name: {{ .Values.service.portName }}-1-port-{{ .Values.service.internalPort }} port: {{ .Values.service.clusterPort3 }} targetPort: {{ .Values.service.internalPort }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort2 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort2 }} type: NodePort selector: statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-1 {{ end }} -{{ if .Values.geoEnabled }} +{{ if .Values.config.geoEnabled }} --- apiVersion: v1 kind: Service @@ -144,11 +144,11 @@ spec: - name: {{ .Values.service.portName }}-2-port-{{ .Values.service.internalPort4 }} port: {{ .Values.service.clusterPort2 }} targetPort: {{ .Values.service.internalPort4 }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort6 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort6 }} - name: {{ .Values.service.portName }}-2-port-{{ .Values.service.internalPort }} port: {{ .Values.service.clusterPort3 }} targetPort: {{ .Values.service.internalPort }} - nodePort: {{ .Values.nodePortPrefix }}{{ .Values.service.geoNodePort3 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.geoNodePort3 }} type: NodePort selector: statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-2 diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml index 63175c4c4b..4898b30c71 100644 --- a/kubernetes/sdnc/templates/statefulset.yaml +++ b/kubernetes/sdnc/templates/statefulset.yaml @@ -78,6 +78,14 @@ spec: value: "{{ .Values.config.configDir }}" - name: ENABLE_ODL_CLUSTER value: "{{ .Values.config.enableClustering }}" + - name: MY_ODL_CLUSTER + value: "{{ .Values.config.myODLCluster }}" + - name: PEER_ODL_CLUSTER + value: "{{ .Values.config.peerODLCluster }}" + - name: IS_PRIMARY_CLUSTER + value: "{{ .Values.config.isPrimaryCluster }}" + - name: GEO_ENABLED + value: "{{ .Values.config.geoEnabled}}" - name: SDNC_REPLICAS value: "{{ .Values.replicaCount }}" - name: MYSQL_HOST diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index f077f94bb0..15b28bffd7 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -36,14 +36,17 @@ image: onap/sdnc-image:1.3-STAGING-latest # flag to enable debugging - application support required debugEnabled: false -geoEnabled: false - # application configuration config: odlPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U dbRootPassword: openECOMP1.0 enableClustering: true binDir: /opt/onap/sdnc/bin + geoEnabled: false +# 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 configDir: /opt/onap/sdnc/data/properties dmaapTopic: SUCCESS dmaapPort: 3904 |