From: jmac Date: Thu, 29 Mar 2018 01:18:02 +0000 (+0000) Subject: Add Standardized Configuration to SDN-C Chart X-Git-Tag: 2.0.0-ONAP~327^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=065e2ce2d14ddc3a698a8ad4dfb77ade8e3f95f4;p=oom.git Add Standardized Configuration to SDN-C Chart Change-Id: I9f4d43c2a3f0766b9c8477a180f5a0bd45fde243 Signed-off-by: jmac Issue-ID: OOM-748 --- diff --git a/kubernetes/onap/requirements.yaml b/kubernetes/onap/requirements.yaml index 08b643782a..eeeb970d62 100644 --- a/kubernetes/onap/requirements.yaml +++ b/kubernetes/onap/requirements.yaml @@ -89,7 +89,7 @@ dependencies: repository: '@local' condition: sdc.enabled - name: sdnc - version: ~0.1.0 + version: ~2.0.0 repository: '@local' condition: sdnc.enabled - name: so diff --git a/kubernetes/onap/resources/environments/dev.yaml b/kubernetes/onap/resources/environments/dev.yaml index 8bbaa279e8..308c7ca647 100644 --- a/kubernetes/onap/resources/environments/dev.yaml +++ b/kubernetes/onap/resources/environments/dev.yaml @@ -82,6 +82,11 @@ sdc: enabled: false sdnc: enabled: false + + dmaap-listener: + config: + dmaapPort: 3904 + so: # Service Orchestrator enabled: true diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml index ee7d00b441..c4a73c8a96 100644 --- a/kubernetes/onap/values.yaml +++ b/kubernetes/onap/values.yaml @@ -83,6 +83,11 @@ sdc: enabled: true sdnc: enabled: true + + dmaap-listener: + config: + dmaapPort: 3904 + so: # Service Orchestrator enabled: true diff --git a/kubernetes/sdnc/.helmignore b/kubernetes/sdnc/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/sdnc/.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/sdnc/Chart.yaml b/kubernetes/sdnc/Chart.yaml index 6e0ec8d433..fe27426f13 100644 --- a/kubernetes/sdnc/Chart.yaml +++ b/kubernetes/sdnc/Chart.yaml @@ -13,6 +13,6 @@ # limitations under the License. apiVersion: v1 -description: A Helm chart for Kubernetes +description: SDN Controller name: sdnc -version: 0.1.0 +version: 2.0.0 diff --git a/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml b/kubernetes/sdnc/charts/dmaap-listener/Chart.yaml similarity index 68% rename from kubernetes/sdnc/templates/sdnc-data-storageclass.yaml rename to kubernetes/sdnc/charts/dmaap-listener/Chart.yaml index 1e6bf53b21..ba2e574d06 100644 --- a/kubernetes/sdnc/templates/sdnc-data-storageclass.yaml +++ b/kubernetes/sdnc/charts/dmaap-listener/Chart.yaml @@ -12,13 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncSdncDbhost }} -#{{ if not .Values.disableNfsProvisioner }} -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: "{{ .Values.nsPrefix }}-sdnc-data" - namespace: "{{ .Values.nsPrefix }}" -provisioner: sdnc/nfs -#{{ end }} -#{{ end }} +apiVersion: v1 +description: SDNC DMaaP Listener +name: dmaap-listener +version: 2.0.0 \ No newline at end of file diff --git a/kubernetes/sdnc/charts/dmaap-listener/requirements.yaml b/kubernetes/sdnc/charts/dmaap-listener/requirements.yaml new file mode 100644 index 0000000000..ce82a2f838 --- /dev/null +++ b/kubernetes/sdnc/charts/dmaap-listener/requirements.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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' diff --git a/kubernetes/sdnc/resources/config/dmaap/dhcpalert.properties b/kubernetes/sdnc/charts/dmaap-listener/resources/config/dhcpalert.properties similarity index 88% rename from kubernetes/sdnc/resources/config/dmaap/dhcpalert.properties rename to kubernetes/sdnc/charts/dmaap-listener/resources/config/dhcpalert.properties index cfc8e130be..dc0deb278e 100644 --- a/kubernetes/sdnc/resources/config/dmaap/dhcpalert.properties +++ b/kubernetes/sdnc/charts/dmaap-listener/resources/config/dhcpalert.properties @@ -14,7 +14,7 @@ password =admin contenttype =application/json authKey=fxoW4jZrO7mdLWWa:f4KxkoBtToyoEG7suMoV8KhnkwM= authDate=2016-02-18T13:57:37-0800 -host=dmaap.{{.Values.nsPrefix}}:3904 +host=dmaap.{{.Release.Namespace}}:3904 topic=VCPE-DHCP-EVENT group=jmsgrp id=sdnc1 @@ -32,4 +32,4 @@ sessionstickinessrequired=NO DME2preferredRouterFilePath=/opt/onap/sdnc/data/properties/dmaap-listener.preferredRoute.txt sdnc.odl.user=admin sdnc.odl.password=admin -sdnc.odl.url-base=https://sdnhost.{{.Values.nsPrefix}}:8443/restconf/operations +sdnc.odl.url-base=https://sdnhost.{{.Release.Namespace}}:8443/restconf/operations diff --git a/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml b/kubernetes/sdnc/charts/dmaap-listener/templates/configmap.yaml similarity index 80% rename from kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml rename to kubernetes/sdnc/charts/dmaap-listener/templates/configmap.yaml index b2b8a45cbc..ee3c6a1c99 100644 --- a/kubernetes/sdnc/templates/dmaap-deployment-configmap.yaml +++ b/kubernetes/sdnc/charts/dmaap-listener/templates/configmap.yaml @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncDmaap }} apiVersion: v1 kind: ConfigMap metadata: name: sdnc-dmaap-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: -{{ tpl (.Files.Glob "resources/config/dmaap/*").AsConfig . | indent 2 }} -#{{ end }} +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/sdnc/templates/dmaap-deployment.yaml b/kubernetes/sdnc/charts/dmaap-listener/templates/deployment.yaml similarity index 51% rename from kubernetes/sdnc/templates/dmaap-deployment.yaml rename to kubernetes/sdnc/charts/dmaap-listener/templates/deployment.yaml index ca092ff261..e712a410c8 100644 --- a/kubernetes/sdnc/templates/dmaap-deployment.yaml +++ b/kubernetes/sdnc/charts/dmaap-listener/templates/deployment.yaml @@ -12,58 +12,70 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncDmaap }} apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: sdnc-dmaap-listener - namespace: "{{ .Values.nsPrefix }}" + 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.dmaapReplicas }} - selector: - matchLabels: - app: dmaap-listener + replicas: {{ .Values.replicaCount }} template: metadata: labels: - app: dmaap-listener - name: sdnc-dmaap-listener + app: {{ include "common.name" . }} + release: {{ .Release.Name }} spec: initContainers: - command: - /root/ready.py args: - --container-name - - sdnc-db-container + - {{ .Values.config.mysqlChartName }} - --container-name - - sdnc-controller-container + - {{ .Values.config.sdncChartName }} env: - name: NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: sdnc-dmaap-readiness + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness containers: - command: - /opt/onap/sdnc/dmaap-listener/bin/start-dmaap-listener.sh + name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} env: - name: PROPERTY_DIR - value: /opt/onap/sdnc/data/properties + value: "{{ .Values.config.configDir }}" - name: SDNC_CONFIG_DIR - value: /opt/onap/sdnc/data/properties - image: {{ .Values.image.dmaaplistener }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: dmaapp-listener-container + value: "{{ .Values.config.configDir }}" volumeMounts: - mountPath: /etc/localtime name: localtime readOnly: true - - mountPath: /opt/onap/sdnc/data/properties/dhcpalert.properties + - mountPath: {{ .Values.config.configDir }}/dhcpalert.properties subPath: dhcpalert.properties name: dmaap-dhcapalert-config + 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: @@ -72,5 +84,4 @@ spec: configMap: name: sdnc-dmaap-configmap imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} + - name: "{{ include "common.namespace" . }}-docker-registry-key" \ No newline at end of file diff --git a/kubernetes/sdnc/templates/mysql-configmap.yaml b/kubernetes/sdnc/charts/dmaap-listener/templates/service.yaml similarity index 64% rename from kubernetes/sdnc/templates/mysql-configmap.yaml rename to kubernetes/sdnc/charts/dmaap-listener/templates/service.yaml index e8c267261c..a76592e89d 100644 --- a/kubernetes/sdnc/templates/mysql-configmap.yaml +++ b/kubernetes/sdnc/charts/dmaap-listener/templates/service.yaml @@ -13,22 +13,16 @@ # limitations under the License. apiVersion: v1 -kind: ConfigMap +kind: Service metadata: - name: sdnc-mysql - namespace: "{{ .Values.nsPrefix }}" + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} labels: - app: mysql -data: - master.cnf: | - # Apply this config only on the master. - [mysqld] - log-bin - [localpathprefix] - master - slave.cnf: | - # Apply this config only on slaves. - [mysqld] - super-read-only - [localpathprefix] - slave + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: +spec: + type: ClusterIP + clusterIP: None diff --git a/kubernetes/sdnc/charts/dmaap-listener/values.yaml b/kubernetes/sdnc/charts/dmaap-listener/values.yaml new file mode 100644 index 0000000000..601e9bb411 --- /dev/null +++ b/kubernetes/sdnc/charts/dmaap-listener/values.yaml @@ -0,0 +1,73 @@ +# 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 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/sdnc-dmaap-listener-image:1.3-STAGING-latest +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + dmaapPort: 3904 + mysqlChartName: sdnc-dbhost + sdncChartName: sdnc + configDir: /opt/onap/sdnc/data/properties + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +ingress: + enabled: false + +resources: {} +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/sdnc/charts/sdnc-portal/.helmignore b/kubernetes/sdnc/charts/sdnc-portal/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/.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/sdnc/charts/sdnc-portal/Chart.yaml b/kubernetes/sdnc/charts/sdnc-portal/Chart.yaml new file mode 100644 index 0000000000..193c38ffce --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/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: SDN-C Admin Portal +name: sdnc-portal +version: 2.0.0 \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-portal/requirements.yaml b/kubernetes/sdnc/charts/sdnc-portal/requirements.yaml new file mode 100644 index 0000000000..1e8f788318 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/requirements.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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' \ No newline at end of file diff --git a/kubernetes/sdnc/resources/config/conf/admportal.json b/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json old mode 100755 new mode 100644 similarity index 94% rename from kubernetes/sdnc/resources/config/conf/admportal.json rename to kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json index ee575c22ac..4c0754b691 --- a/kubernetes/sdnc/resources/config/conf/admportal.json +++ b/kubernetes/sdnc/charts/sdnc-portal/resources/config/admportal.json @@ -39,8 +39,8 @@ "dbPassword": "gamma", "dbName": "sdnctl", "odlProtocol": "http", - "odlHost": "sdnhost.{{.Values.nsPrefix}}", - "odlConexusHost": "sdnhost.{{.Values.nsPrefix}}", + "odlHost": "sdnhost.{{.Release.Namespace}}", + "odlConexusHost": "sdnhost.{{.Release.Namespace}}", "odlPort": "8181", "odlConexusPort": "8181", "odlUser": "admin", diff --git a/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml b/kubernetes/sdnc/charts/sdnc-portal/templates/configmap.yaml similarity index 77% rename from kubernetes/sdnc/templates/sdnc-conf-configmap.yaml rename to kubernetes/sdnc/charts/sdnc-portal/templates/configmap.yaml index 3d89f20cab..f2f2524dfd 100644 --- a/kubernetes/sdnc/templates/sdnc-conf-configmap.yaml +++ b/kubernetes/sdnc/charts/sdnc-portal/templates/configmap.yaml @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncSdnc }} apiVersion: v1 kind: ConfigMap metadata: - name: sdnc-conf-configmap - namespace: {{ .Values.nsPrefix }} + name: sdnc-portal-configmap + namespace: {{ include "common.namespace" . }} data: -{{ tpl (.Files.Glob "resources/config/conf/*").AsConfig . | indent 2 }} -#{{ end }} +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml b/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml new file mode 100644 index 0000000000..5e1293c37f --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/templates/deployment.yaml @@ -0,0 +1,104 @@ +# 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: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} + spec: + initContainers: + - command: + - /root/ready.py + args: + - --container-name + - {{ .Values.config.mysqlChartName }} + - --container-name + - {{ .Values.config.sdncChartName }} + 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" . }} + command: ["/bin/bash"] + args: ["-c", "cd /opt/onap/sdnc/admportal/shell && ./start_portal.sh"] + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + 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: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + - name: SDNC_CONFIG_DIR + value: "{{ .Values.config.configDir }}" + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: {{ .Values.config.configDir }} + name: sdnc-conf + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: sdnc-conf + configMap: + name: sdnc-portal-configmap + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-portal/templates/secrets.yaml b/kubernetes/sdnc/charts/sdnc-portal/templates/secrets.yaml new file mode 100644 index 0000000000..345c194d96 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }} diff --git a/kubernetes/sdnc/charts/sdnc-portal/templates/service.yaml b/kubernetes/sdnc/charts/sdnc-portal/templates/service.yaml new file mode 100644 index 0000000000..2d67c1f26e --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/templates/service.yaml @@ -0,0 +1,50 @@ +# 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.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + msb.onap.org/service-info: '[ + { + "serviceName": "sdnc-portal", + "version": "v1", + "url": "/", + "protocol": "UI", + "port": "{{ .Values.service.externalPort }}", + "visualRange":"0|1" + } + ]' +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.name }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/kubernetes/sdnc/charts/sdnc-portal/values.yaml b/kubernetes/sdnc/charts/sdnc-portal/values.yaml new file mode 100644 index 0000000000..b5be3a61c6 --- /dev/null +++ b/kubernetes/sdnc/charts/sdnc-portal/values.yaml @@ -0,0 +1,80 @@ +# 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 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/admportal-sdnc-image:1.3-STAGING-latest +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + mysqlChartName: sdnc-dbhost + dbRootPassword: openECOMP1.0 + sdncChartName: sdnc + configDir: /opt/onap/sdnc/data/properties + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +service: + type: NodePort + name: sdnc-portal + internalPort: 8443 + externalPort: 8443 + nodePort: "01" + +ingress: + enabled: false + +resources: {} +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/sdnc/charts/ueb-listener/Chart.yaml b/kubernetes/sdnc/charts/ueb-listener/Chart.yaml new file mode 100644 index 0000000000..35b2a2e9c3 --- /dev/null +++ b/kubernetes/sdnc/charts/ueb-listener/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: SDNC UEB Listener +name: ueb-listener +version: 2.0.0 \ No newline at end of file diff --git a/kubernetes/sdnc/charts/ueb-listener/requirements.yaml b/kubernetes/sdnc/charts/ueb-listener/requirements.yaml new file mode 100644 index 0000000000..ce82a2f838 --- /dev/null +++ b/kubernetes/sdnc/charts/ueb-listener/requirements.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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' diff --git a/kubernetes/sdnc/resources/config/ueb/ueb-listener.properties b/kubernetes/sdnc/charts/ueb-listener/resources/config/ueb-listener.properties similarity index 91% rename from kubernetes/sdnc/resources/config/ueb/ueb-listener.properties rename to kubernetes/sdnc/charts/ueb-listener/resources/config/ueb-listener.properties index fb6e26da11..72dee15938 100644 --- a/kubernetes/sdnc/resources/config/ueb/ueb-listener.properties +++ b/kubernetes/sdnc/charts/ueb-listener/resources/config/ueb-listener.properties @@ -1,4 +1,4 @@ -org.onap.ccsdk.sli.northbound.uebclient.asdc-address=sdc-be.{{.Values.nsPrefix}}:8443 +org.onap.ccsdk.sli.northbound.uebclient.asdc-address=sdc-be.{{.Release.Namespace}}:8443 org.onap.ccsdk.sli.northbound.uebclient.consumer-group=sdc-OpenSource-Env1-sdnc-dockero org.onap.ccsdk.sli.northbound.uebclient.consumer-id=sdc-COpenSource-Env11-sdnc-dockero org.onap.ccsdk.sli.northbound.uebclient.environment-name=AUTO @@ -6,7 +6,7 @@ org.onap.ccsdk.sli.northbound.uebclient.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84 org.onap.ccsdk.sli.northbound.uebclient.user=sdnc org.onap.ccsdk.sli.northbound.uebclient.sdnc-user=admin org.onap.ccsdk.sli.northbound.uebclient.sdnc-passwd=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -org.onap.ccsdk.sli.northbound.uebclient.asdc-api-base-url=http://sdnhost.{{.Values.nsPrefix}}:8282/restconf/operations/ +org.onap.ccsdk.sli.northbound.uebclient.asdc-api-base-url=http://sdnhost.{{.Release.Namespace}}:8282/restconf/operations/ org.onap.ccsdk.sli.northbound.uebclient.asdc-api-namespace=org:onap:ccsdk org.onap.ccsdk.sli.northbound.uebclient.spool.incoming=/opt/onap/sdnc/ueb-listener/spool/incoming org.onap.ccsdk.sli.northbound.uebclient.spool.archive=/opt/onap/sdnc/ueb-listener/spool/archive diff --git a/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml b/kubernetes/sdnc/charts/ueb-listener/templates/configmap.yaml similarity index 81% rename from kubernetes/sdnc/templates/ueb-deployment-configmap.yaml rename to kubernetes/sdnc/charts/ueb-listener/templates/configmap.yaml index 0e5b3ac62e..397303ffd8 100644 --- a/kubernetes/sdnc/templates/ueb-deployment-configmap.yaml +++ b/kubernetes/sdnc/charts/ueb-listener/templates/configmap.yaml @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncUeb }} apiVersion: v1 kind: ConfigMap metadata: name: sdnc-ueb-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: -{{ tpl (.Files.Glob "resources/config/ueb/*").AsConfig . | indent 2 }} -#{{ end }} +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/sdnc/templates/ueb-deployment.yaml b/kubernetes/sdnc/charts/ueb-listener/templates/deployment.yaml similarity index 53% rename from kubernetes/sdnc/templates/ueb-deployment.yaml rename to kubernetes/sdnc/charts/ueb-listener/templates/deployment.yaml index f785cf7411..b11cf95277 100644 --- a/kubernetes/sdnc/templates/ueb-deployment.yaml +++ b/kubernetes/sdnc/charts/ueb-listener/templates/deployment.yaml @@ -12,51 +12,52 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableSdncUeb }} apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: sdnc-ueb-listener - namespace: "{{ .Values.nsPrefix }}" + 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.uebReplicas }} - selector: - matchLabels: - app: ueb-listener + replicas: {{ .Values.replicaCount }} template: metadata: labels: - app: ueb-listener - name: sdnc-ueb-listener + app: {{ include "common.name" . }} + release: {{ .Release.Name }} spec: initContainers: - command: - /root/ready.py args: - --container-name - - sdnc-db-container + - {{ .Values.config.mysqlChartName }} - --container-name - - sdnc-controller-container + - {{ .Values.config.sdncChartName }} env: - name: NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: sdnc-ueb-readiness + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness containers: - command: - /opt/onap/sdnc/ueb-listener/bin/start-ueb-listener.sh + name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} env: - name: PROPERTY_DIR - value: /opt/onap/sdnc/data/properties + value: "{{ .Values.config.configDir }}" - name: SDNC_CONFIG_DIR - value: /opt/onap/sdnc/data/properties - image: {{ .Values.image.ueblistener }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: ueb-listener-container + value: "{{ .Values.config.configDir }}" volumeMounts: - mountPath: /etc/localtime name: localtime @@ -64,6 +65,17 @@ spec: - mountPath: /opt/onap/sdnc/data/properties/ueb-listener.properties subPath: ueb-listener.properties name: ueb-config + 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: @@ -72,5 +84,4 @@ spec: configMap: name: sdnc-ueb-configmap imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} + - name: "{{ include "common.namespace" . }}-docker-registry-key" \ No newline at end of file diff --git a/kubernetes/sdnc/charts/ueb-listener/templates/service.yaml b/kubernetes/sdnc/charts/ueb-listener/templates/service.yaml new file mode 100644 index 0000000000..a76592e89d --- /dev/null +++ b/kubernetes/sdnc/charts/ueb-listener/templates/service.yaml @@ -0,0 +1,28 @@ +# 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.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: +spec: + type: ClusterIP + clusterIP: None diff --git a/kubernetes/sdnc/charts/ueb-listener/values.yaml b/kubernetes/sdnc/charts/ueb-listener/values.yaml new file mode 100644 index 0000000000..0f22647408 --- /dev/null +++ b/kubernetes/sdnc/charts/ueb-listener/values.yaml @@ -0,0 +1,74 @@ +# 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 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +repository: nexus3.onap.org:10001 +image: onap/sdnc-ueb-listener-image:1.3-STAGING-latest +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +config: + uebPort: 3904 + mysqlChartName: sdnc-dbhost + sdncChartName: sdnc + configDir: /opt/onap/sdnc/data/properties + + +# default number of instances +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: true + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + +ingress: + enabled: false + +resources: {} +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/sdnc/requirements.yaml b/kubernetes/sdnc/requirements.yaml new file mode 100644 index 0000000000..c458755a85 --- /dev/null +++ b/kubernetes/sdnc/requirements.yaml @@ -0,0 +1,24 @@ +# 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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' + - name: mysql + version: ~2.0.0 + repository: '@local' + - name: dgbuilder + version: ~2.0.0 + repository: '@local' \ No newline at end of file diff --git a/kubernetes/sdnc/resources/config/bin/installSdncDb.sh b/kubernetes/sdnc/resources/config/bin/installSdncDb.sh new file mode 100644 index 0000000000..f2c133cdc1 --- /dev/null +++ b/kubernetes/sdnc/resources/config/bin/installSdncDb.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# ONAP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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========================================================= +### + +SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} +MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} + +SDNC_DB_USER=${SDNC_DB_USER:-sdnctl} +SDNC_DB_PASSWD=${SDNC_DB_PASSWD:-gamma} +SDNC_DB_DATABASE=${SDN_DB_DATABASE:-sdnctl} + + +# Create tablespace and user account +mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END +CREATE DATABASE ${SDNC_DB_DATABASE}; +CREATE USER '${SDNC_DB_USER}'@'localhost' IDENTIFIED BY '${SDNC_DB_PASSWD}'; +CREATE USER '${SDNC_DB_USER}'@'%' IDENTIFIED BY '${SDNC_DB_PASSWD}'; +GRANT ALL PRIVILEGES ON ${SDNC_DB_DATABASE}.* TO '${SDNC_DB_USER}'@'localhost' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON ${SDNC_DB_DATABASE}.* TO '${SDNC_DB_USER}'@'%' WITH GRANT OPTION; +commit; +END + +# load schema +if [ -f ${SDNC_HOME}/data/sdnctl.dump ] +then + mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} sdnctl < ${SDNC_HOME}/data/sdnctl.dump +fi + +for datafile in ${SDNC_HOME}/data/*.data.dump +do + mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} sdnctl < $datafile +done + +# Create VNIs 100-199 +${SDNC_HOME}/bin/addVnis.sh 100 199 diff --git a/kubernetes/sdnc/resources/config/bin/startODL.sh b/kubernetes/sdnc/resources/config/bin/startODL.sh new file mode 100755 index 0000000000..ee8106ccfe --- /dev/null +++ b/kubernetes/sdnc/resources/config/bin/startODL.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# SDNC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# 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========================================================= +### + +function enable_odl_cluster(){ + if [ -z $SDNC_REPLICAS ]; then + echo "SDNC_REPLICAS is not configured in Env field" + exit + fi + + echo "Installing Opendaylight cluster features" + ${ODL_HOME}/bin/client -u karaf feature:install odl-mdsal-clustering + ${ODL_HOME}/bin/client -u karaf feature:install odl-jolokia + + echo "Update cluster information statically" + hm=$(hostname) + echo "Get current Hostname ${hm}" + + node=($(echo ${hm} | sed 's/-[0-9]*$//g')) + node_index=($(echo ${hm} | awk -F"-" '{print $NF}')) + node_list="${node}-0.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}"; + + for ((i=1;i<${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} +} + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} +SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc} +SLEEP_TIME=${SLEEP_TIME:-120} +MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}} +ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false} + +# +# Wait for database to init properly +# +echo "Waiting for mysql" +until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null +do + printf "." + sleep 1 +done +echo -e "\nmysql ready" + +if [ ! -f ${SDNC_HOME}/.installed ] +then + echo "Installing SDNC database" + ${SDNC_HOME}/bin/installSdncDb.sh + echo "Installing SDN-C keyStore" + ${SDNC_HOME}/bin/addSdncKeyStore.sh + echo "Starting OpenDaylight" + ${ODL_HOME}/bin/start + echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize" + sleep ${SLEEP_TIME} + echo "Installing SDN-C platform features" + ${SDNC_HOME}/bin/installFeatures.sh + if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ] + then + echo "Installing directed graphs" + ${SDNC_HOME}/svclogic/bin/install.sh + fi + + if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi + + echo "Restarting OpenDaylight" + ${ODL_HOME}/bin/stop + echo "Installed at `date`" > ${SDNC_HOME}/.installed +fi + +exec ${ODL_HOME}/bin/karaf + diff --git a/kubernetes/sdnc/resources/config/conf/aaiclient.properties b/kubernetes/sdnc/resources/config/conf/aaiclient.properties index 81f63ecdde..b5d1560d7e 100755 --- a/kubernetes/sdnc/resources/config/conf/aaiclient.properties +++ b/kubernetes/sdnc/resources/config/conf/aaiclient.properties @@ -40,7 +40,7 @@ org.onap.ccsdk.sli.adaptors.aai.application=openECOMP # # Configuration file for A&AI Client # -org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Values.nsPrefix}}:8443 +org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-service.{{.Release.Namespace}}:8443 # query @@ -134,8 +134,8 @@ org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v11/service-design-and # UBB Notify org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v11/actions/notify -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Values.nsPrefix}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Values.nsPrefix}}:8543/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://aai-service.{{.Release.Namespace}}:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} +org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://aai-service.{{.Release.Namespace}}:8543/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information # Service org.onap.ccsdk.sli.adaptors.aai.path.service=/aai/v11/service-design-and-creation/services/service/{service-id} diff --git a/kubernetes/sdnc/resources/config/conf/dblib.properties b/kubernetes/sdnc/resources/config/conf/dblib.properties new file mode 100644 index 0000000000..4edae2b46c --- /dev/null +++ b/kubernetes/sdnc/resources/config/conf/dblib.properties @@ -0,0 +1,37 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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========================================================= +### + +# dblib.properrties +org.onap.ccsdk.sli.dbtype=jdbc + +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver +org.onap.ccsdk.sli.jdbc.database=sdnctl +org.onap.ccsdk.sli.jdbc.user=sdnctl +org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 +org.onap.ccsdk.sli.jdbc.connection.timeout=50 +org.onap.ccsdk.sli.jdbc.request.timeout=100 +org.onap.ccsdk.sli.jdbc.limit.init=10 +org.onap.ccsdk.sli.jdbc.limit.min=10 +org.onap.ccsdk.sli.jdbc.limit.max=20 +org.onap.dblib.connection.recovery=false diff --git a/kubernetes/sdnc/resources/config/conf/svclogic.properties b/kubernetes/sdnc/resources/config/conf/svclogic.properties new file mode 100644 index 0000000000..44ae32f9cc --- /dev/null +++ b/kubernetes/sdnc/resources/config/conf/svclogic.properties @@ -0,0 +1,27 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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========================================================= +### + +org.onap.ccsdk.sli.dbtype = jdbc +org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://{{.Values.mysql.service.name}}.{{.Release.Namespace}}:3306/sdnctl +org.onap.ccsdk.sli.jdbc.database = sdnctl +org.onap.ccsdk.sli.jdbc.user = sdnctl +org.onap.ccsdk.sli.jdbc.password = gamma + diff --git a/kubernetes/sdnc/resources/config/log/org.ops4j.pax.logging.cfg b/kubernetes/sdnc/resources/config/log/org.ops4j.pax.logging.cfg index 50818a3d18..7b6563656b 100644 --- a/kubernetes/sdnc/resources/config/log/org.ops4j.pax.logging.cfg +++ b/kubernetes/sdnc/resources/config/log/org.ops4j.pax.logging.cfg @@ -1,57 +1,151 @@ -################################################################################ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# -################################################################################ - -# Root logger -log4j.rootLogger=INFO, async, osgi:* -log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer - -# Log Directory -logDir=/var/log/onap -componentName=sdnc -logDirectory=${logDir}/${componentName} -maxFileSize=100MB -maxBackupIndex=20 - -# CONSOLE appender not used by default -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS}\t%-16.16t\t%-5.5p\t%c{36}\t%X{bundle.id} - %X{bundle.name} - %X{bundle.version}\t%m%n - -# Async appender forwarding to file appender -log4j.appender.async=org.apache.log4j.AsyncAppender -log4j.appender.async.appenders=out - -# File appender -log4j.appender.out=org.apache.log4j.RollingFileAppender -log4j.appender.out.layout=org.apache.log4j.xml.XMLLayout -log4j.appender.out.layout.Properties=true -log4j.appender.out.file=${logDirectory}/karaf.log -log4j.appender.out.append=true -log4j.appender.out.maxFileSize=${maxFileSize} -log4j.appender.out.maxBackupIndex=${maxBackupIndex} - -# Sift appender -log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender -log4j.appender.sift.key=bundle.name -log4j.appender.sift.default=karaf -log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender -log4j.appender.sift.appender.layout=org.apache.log4j.xml.XMLLayout -log4j.appender.sift.appender.layout.Properties=true -log4j.appender.sift.appender.file=${logDirectory}/$\\{bundle.name\\}.log -log4j.appender.sift.appender.append=true +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +################################################################################ + +# Root logger +log4j.rootLogger=INFO, async, osgi:* +log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer + +maxFileSize=100MB +maxBackupIndex=20 +logDir=/var/log/onap +componentName=sdnc +logDirectory=${logDir}/${componentName} +karafLogName=karaf +errorLogName=error +metricsLogName=metrics +auditLogName=audit +debugLogName=debug + + +# CONSOLE appender not used by default +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS}\t%-16.16t\t%-5.5p\t%c{36}\t%X{bundle.id} - %X{bundle.name} - %X{bundle.version}\t%m%n + +# Async appender forwarding to file appender +log4j.appender.async=org.apache.log4j.AsyncAppender +log4j.appender.async.appenders=out + +# File appender +log4j.appender.out=org.apache.log4j.RollingFileAppender +log4j.appender.out.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.out.layout.Properties=true +log4j.appender.out.file=${logDirectory}/${karafLogName}.log +log4j.appender.out.append=true +log4j.appender.out.maxFileSize=${maxFileSize} +log4j.appender.out.maxBackupIndex=${maxBackupIndex} + +# Sift appender +log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender +log4j.appender.sift.key=bundle.name +log4j.appender.sift.default=karaf +log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender +log4j.appender.sift.appender.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.sift.appender.layout.Properties=true +log4j.appender.sift.appender.file=${logDirectory}/$\\{bundle.name\\}.log +log4j.appender.sift.appender.append=true + + + +log4j.category.org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPusherImpl=DEBUG +log4j.category.org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPersisterActivator=DEBUG + + +#ECOMP Debug appender +log4j.appender.debug=org.apache.log4j.RollingFileAppender +log4j.appender.debug.key=bundle.name +log4j.appender.debug.default=karaf +log4j.appender.debug.appName=EELFDebug +log4j.appender.debug.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.debug.layout.Properties=true +log4j.appender.debug.file=${logDirectory}/${debugLogName}.log +log4j.appender.debug.append=true +log4j.appender.debug.maxFileSize=${maxFileSize} +log4j.appender.debug.maxBackupIndex=${maxBackupIndex} +#log4j.appender.debug.filter.f1=org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.debug.filter.f1.LevelMax=WARN +#log4j.appender.debug.filter.f1.LevelMin=TRACE + + +#Error appender +log4j.appender.error=org.apache.log4j.RollingFileAppender +log4j.appender.error.appName=EELFError +log4j.appender.error.File=${logDirectory}/${errorLogName}.log +log4j.appender.error.Threshold=ERROR +log4j.appender.error.maxFileSize=${maxFileSize} +log4j.appender.error.maxBackupIndex=${maxBackupIndex} +log4j.appender.error.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.error.layout.Properties=true + +#Metrics appender +log4j.appender.metric=org.apache.log4j.RollingFileAppender +log4j.appender.metric.appName=EELFMetrics +log4j.appender.metric.File=${logDirectory}/${metricsLogName}.log +log4j.appender.metric.maxFileSize=${maxFileSize} +log4j.appender.metric.maxBackupIndex=${maxBackupIndex} +log4j.appender.metric.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.metric.layout.Properties=true + +#Audit appender +log4j.appender.audit=org.apache.log4j.RollingFileAppender +log4j.appender.audit.appName=EELFAudit +log4j.appender.audit.File=${logDirectory}/${auditLogName}.log +log4j.appender.audit.maxFileSize=${maxFileSize} +log4j.appender.audit.maxBackupIndex=${maxBackupIndex} +log4j.appender.audit.layout=org.apache.log4j.xml.XMLLayout +log4j.appender.audit.layout.Properties=true + +#Loggers +#Routing of all messages from root logger +log4j.logger.com.att=TRACE, debug, error +#Store to the same log file messages from upper level appender or not +log4j.additivity.com.att=false + +#EELFManager loggers +#EELF parent logger +log4j.logger.com.att.eelf=TRACE, debug +log4j.additivity.com.att.eelf=false + +#Audit logger routing +log4j.logger.com.att.eelf.audit=DEBUG, audit +log4j.additivity.com.att.eelf.audit=false + +#Metric logger routing +log4j.logger.com.att.eelf.metrics=DEBUG, metric +log4j.additivity.com.att.eelf.metrics=false + +#Performance logger routing +log4j.logger.com.att.eelf.perf=DEBUG, metric +log4j.additivity.com.att.eelf.perf=false + +#Server logger routing +log4j.logger.com.att.eelf.server=DEBUG, debug +log4j.additivity.com.att.eelf.server=false + +#Policy logger routing +log4j.logger.com.att.eelf.policy=DEBUG, debug +log4j.additivity.com.att.eelf.policy=false + +#Error logger routing +log4j.logger.com.att.eelf.error=DEBUG, error +log4j.additivity.com.att.eelf.error=false + +#Debug logger routing +log4j.logger.com.att.eelf.debug=DEBUG, debug +log4j.additivity.com.att.eelf.debug=false diff --git a/kubernetes/sdnc/templates/all-services.yaml b/kubernetes/sdnc/templates/all-services.yaml deleted file mode 100644 index 14d7b01a59..0000000000 --- a/kubernetes/sdnc/templates/all-services.yaml +++ /dev/null @@ -1,200 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disableSdncSdncDbhost }} -apiVersion: v1 -kind: Service -metadata: - name: dbhost - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-dbhost -spec: - ports: - - port: 3306 - selector: - app: sdnc-dbhost - clusterIP: None ---- -# Client service for connecting to any MySQL instance for reads. -# Only master: sdnc-dbhost-0 accepts the write request. -apiVersion: v1 -kind: Service -metadata: - name: dbhost-read - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-dbhost -spec: - ports: - - name: sdnc-dbhost - port: 3306 - selector: - app: sdnc-dbhost ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnctldb01 - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-dbhost -spec: - ports: - - port: 3306 - selector: - app: sdnc-dbhost - clusterIP: None ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnctldb02 - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-dbhost -spec: - ports: - - port: 3306 - selector: - app: sdnc-dbhost - clusterIP: None -#{{ end }} -#{{ if not .Values.disableSdncSdnc }} ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnc-dgbuilder - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-dgbuilder -spec: - ports: - - name: "sdnc-dgbuilder-port" - port: 3000 - targetPort: 3100 - nodePort: {{ .Values.nodePortPrefix }}03 - type: NodePort - selector: - app: sdnc-dgbuilder ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnhost - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc - annotations: - msb.onap.org/service-info: '[ - { - "serviceName": "sdnc", - "version": "v1", - "url": "/", - "protocol": "REST", - "port": "8282", - "visualRange":"1", - "path": "/" - } - ]' -spec: - ports: - - name: "sdnc-port-8181" - port: 8282 - targetPort: 8181 - nodePort: {{ .Values.nodePortPrefix }}02 - - name: "sdnc-port-8101" - port: 8201 - targetPort: 8101 - nodePort: {{ .Values.nodePortPrefix }}08 - - name: "sdnc-jolokia-port-8080" - port: 8280 - targetPort: 8080 - nodePort: {{ .Values.nodePortPrefix }}46 - type: NodePort - selector: - app: sdnc ---- -kind: Service -apiVersion: v1 -metadata: - name: nfs-provisioner - namespace: "{{ .Values.nsPrefix }}" - labels: - app: nfs-provisioner -spec: - ports: - - name: nfs - port: 2049 - - name: mountd - port: 20048 - - name: rpcbind - port: 111 - - name: rpcbind-udp - port: 111 - protocol: UDP - selector: - app: nfs-provisioner -#{{ end }} -#{{ if not .Values.disableSdncSdncPortal }} ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnc-portal - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc-portal - annotations: - msb.onap.org/service-info: '[ - { - "serviceName": "sdnc-portal", - "version": "v1", - "url": "/", - "protocol": "UI", - "port": "8843", - "visualRange":"0|1" - } - ]' -spec: - ports: - - name: "sdnc-portal-port" - port: 8843 - nodePort: {{ .Values.nodePortPrefix }}01 - type: NodePort - selector: - app: sdnc-portal -#{{ end }} -#{{ if .Values.enableODLCluster }} ---- -apiVersion: v1 -kind: Service -metadata: - name: sdnhost-cluster - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sdnc - annotations: - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" -spec: - ports: - - name: "sdnc-cluster-port" - port: 2550 - clusterIP: None - selector: - app: sdnc - sessionAffinity: None - type: ClusterIP -#{{ end }} diff --git a/kubernetes/sdnc/templates/configmap.yaml b/kubernetes/sdnc/templates/configmap.yaml new file mode 100644 index 0000000000..54de05cd61 --- /dev/null +++ b/kubernetes/sdnc/templates/configmap.yaml @@ -0,0 +1,77 @@ +# 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" . }}-filebeat-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/filebeat/log4j/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-log-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-startodl + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/bin/startODL.sh").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-installsdncdb + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/bin/installSdncDb.sh").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-aaiclient-properties + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/conf/aaiclient.properties").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-dblib-properties + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/conf/dblib.properties").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-svclogic-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/conf/svclogic.properties").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/conf/svclogic.properties").AsConfig . | indent 2 }} diff --git a/kubernetes/sdnc/templates/db-statefulset.yaml b/kubernetes/sdnc/templates/db-statefulset.yaml deleted file mode 100644 index 29d592a6a7..0000000000 --- a/kubernetes/sdnc/templates/db-statefulset.yaml +++ /dev/null @@ -1,220 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#{{ if not .Values.disableSdncSdncDbhost }} -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: sdnc-dbhost - namespace: "{{ .Values.nsPrefix }}" -spec: - serviceName: "dbhost" - replicas: {{ .Values.numberOfDbReplicas }} - selector: - matchLabels: - app: sdnc-dbhost - template: - metadata: - labels: - app: sdnc-dbhost - name: sdnc-dbhost - spec: - initContainers: - - name: init-mysql - image: {{ .Values.image.mysql }} - imagePullPolicy: {{ .Values.pullPolicy }} - command: - - bash - - "-c" - - | - set -ex - # Generate mysql server-id from pod ordinal index. - [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 - ordinal=${BASH_REMATCH[1]} - echo BASH_REMATCH=${BASH_REMATCH} - echo [mysqld] > /mnt/conf.d/server-id.cnf - # Add an offset to avoid reserved server-id=0 value. - echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf - # Copy appropriate conf.d files from config-map to emptyDir. - if [[ $ordinal -eq 0 ]]; then - cp /mnt/config-map/master.cnf /mnt/conf.d/ - else - cp /mnt/config-map/slave.cnf /mnt/conf.d/ - fi - volumeMounts: - - name: conf - mountPath: /mnt/conf.d - - name: config-map - mountPath: /mnt/config-map - - name: clone-mysql - image: {{ .Values.image.xtrabackup }} - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - command: - - bash - - "-c" - - | - set -ex - # Skip the clone if data already exists. - [[ -d /var/lib/mysql/mysql ]] && exit 0 - # Skip the clone on master (ordinal index 0). - [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 - ordinal=${BASH_REMATCH[1]} - echo ${BASH_REMATCH} - [[ $ordinal -eq 0 ]] && exit 0 - # Clone data from previous peer. - ncat --recv-only sdnc-dbhost-$(($ordinal-1)).dbhost.{{ .Values.nsPrefix }} 3307 | xbstream -x -C /var/lib/mysql - # Prepare the backup. - xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --prepare --target-dir=/var/lib/mysql - ls -l /var/lib/mysql - volumeMounts: - - name: sdnc-data - mountPath: /var/lib/mysql -#{{ if not .Values.disableNfsProvisioner }} - subPath: mysql -#{{ end }} - - name: conf - mountPath: /etc/mysql/conf.d - containers: - - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - - name: MYSQL_ROOT_HOST - value: '%' - - name: MYSQL_ALLOW_EMPTY_PASSWORD - value: "0" - image: {{ .Values.image.mysql }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: sdnc-db-container - volumeMounts: - - mountPath: /var/lib/mysql - name: sdnc-data -#{{ if not .Values.disableNfsProvisioner }} - subPath: mysql -#{{ end }} - - name: conf - mountPath: /etc/mysql/conf.d - ports: - - containerPort: 3306 - resources: - requests: - cpu: 500m - memory: 1Gi - livenessProbe: - exec: - command: ["mysqladmin", "ping"] - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - readinessProbe: - tcpSocket: - port: 3306 - initialDelaySeconds: 5 - periodSeconds: 10 - - name: xtrabackup - image: {{ .Values.image.xtrabackup }} - env: - - name: MYSQL_ROOT_PASSWORD - value: openECOMP1.0 - ports: - - name: xtrabackup - containerPort: 3307 - command: - - bash - - "-c" - - | - set -ex - cd /var/lib/mysql - ls -l - # Determine binlog position of cloned data, if any. - if [[ -f xtrabackup_slave_info ]]; then - echo "Inside xtrabackup_slave_info" - # XtraBackup already generated a partial "CHANGE MASTER TO" query - # because we're cloning from an existing slave. - mv xtrabackup_slave_info change_master_to.sql.in - # Ignore xtrabackup_binlog_info in this case (it's useless). - rm -f xtrabackup_binlog_info - elif [[ -f xtrabackup_binlog_info ]]; then - echo "Inside xtrabackup_binlog_info" - # We're cloning directly from master. Parse binlog position. - [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1 - rm xtrabackup_binlog_info - echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\ - MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in - fi - - # Check if we need to complete a clone by starting replication. - if [[ -f change_master_to.sql.in ]]; then - echo "Waiting for mysqld to be ready (accepting connections)" - [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 - ordinal=${BASH_REMATCH[1]} - echo $ordinal - until mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h 127.0.0.1 -e "SELECT 1"; do sleep 1; done - - echo "Initializing replication from clone position" - # In case of container restart, attempt this at-most-once. - mv change_master_to.sql.in change_master_to.sql.orig - mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h 127.0.0.1 <