From 282751f1c3c062ab6c0c3aa6c49b32417de360e4 Mon Sep 17 00:00:00 2001 From: Mike Elliott Date: Thu, 19 Apr 2018 17:24:08 -0400 Subject: Fix SO healthcheck on multi-node cluster Aligned service names (and numerous other minor fixes) with latest best practices and standard templates. Change-Id: I740fe299053805df60abcd6a6043031d8beda7e8 Issue-ID: OOM-909 Signed-off-by: Mike Elliott --- .../so/charts/mariadb/templates/deployment.yaml | 4 +-- .../so/charts/mariadb/templates/service.yaml | 6 ++-- kubernetes/so/charts/mariadb/values.yaml | 8 ++--- .../config/mso/standalone-full-ha-mso.xml | 6 ++-- kubernetes/so/templates/deployment.yaml | 10 +++---- kubernetes/so/templates/service.yaml | 34 +++++++++++----------- kubernetes/so/values.yaml | 15 ++++++---- 7 files changed, 42 insertions(+), 41 deletions(-) diff --git a/kubernetes/so/charts/mariadb/templates/deployment.yaml b/kubernetes/so/charts/mariadb/templates/deployment.yaml index 5267cc0409..3e263ce097 100644 --- a/kubernetes/so/charts/mariadb/templates/deployment.yaml +++ b/kubernetes/so/charts/mariadb/templates/deployment.yaml @@ -32,8 +32,8 @@ spec: spec: hostname: mariadb containers: - - name: {{ .Chart.Name }} - image: {{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }} + - name: {{ include "common.name" . }} + image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} ports: - containerPort: {{ .Values.service.internalPort }} diff --git a/kubernetes/so/charts/mariadb/templates/service.yaml b/kubernetes/so/charts/mariadb/templates/service.yaml index 11b3b48bd9..eeebdcbae2 100644 --- a/kubernetes/so/charts/mariadb/templates/service.yaml +++ b/kubernetes/so/charts/mariadb/templates/service.yaml @@ -15,7 +15,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "common.fullname" . }} + name: {{ include "common.servicename" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} @@ -27,12 +27,12 @@ spec: ports: {{if eq .Values.service.type "NodePort" -}} - port: {{ .Values.service.internalPort }} - nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.externalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default "302" }}{{ .Values.service.nodePort }} {{- else -}} - port: {{ .Values.service.externalPort }} targetPort: {{ .Values.service.internalPort }} {{- end}} - name: {{ .Values.service.name }} + name: {{ .Values.service.portName }} selector: app: {{ include "common.name" . }} release: {{ .Release.Name }} \ No newline at end of file diff --git a/kubernetes/so/charts/mariadb/values.yaml b/kubernetes/so/charts/mariadb/values.yaml index e957206811..1a62071442 100644 --- a/kubernetes/so/charts/mariadb/values.yaml +++ b/kubernetes/so/charts/mariadb/values.yaml @@ -30,10 +30,6 @@ pullPolicy: Always config: mariadbRootPassword: password -# override chart name (mariadb) to share a common namespace -# suffix with parent chart (so) -nsSuffix: so - # default number of instances replicaCount: 1 @@ -79,9 +75,9 @@ persistence: service: type: NodePort - name: mariadb - externalPort: 52 + portName: mariadb internalPort: 3306 + nodePort: 52 ingress: enabled: false diff --git a/kubernetes/so/resources/config/mso/standalone-full-ha-mso.xml b/kubernetes/so/resources/config/mso/standalone-full-ha-mso.xml index 7693736021..d3ff84fc26 100644 --- a/kubernetes/so/resources/config/mso/standalone-full-ha-mso.xml +++ b/kubernetes/so/resources/config/mso/standalone-full-ha-mso.xml @@ -147,7 +147,7 @@ - jdbc:mariadb://{{ .Release.Name }}-mariadb:3306/mso_requests?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 + jdbc:mariadb://{{ .Values.mariadb.nameOverride }}:3306/mso_requests?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 mariadb TRANSACTION_READ_COMMITTED @@ -177,7 +177,7 @@ - jdbc:mariadb://{{ .Release.Name }}-mariadb:3306/mso_catalog?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 + jdbc:mariadb://{{ .Values.mariadb.nameOverride }}:3306/mso_catalog?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 mariadb TRANSACTION_READ_COMMITTED @@ -207,7 +207,7 @@ - jdbc:mariadb://{{ .Release.Name }}-mariadb:3306/camundabpmn?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 + jdbc:mariadb://{{ .Values.mariadb.nameOverride }}:3306/camundabpmn?autoReconnect=true&connectTimeout=60000&socketTimeout=60000 mariadb set autocommit=1 TRANSACTION_READ_COMMITTED diff --git a/kubernetes/so/templates/deployment.yaml b/kubernetes/so/templates/deployment.yaml index 67630d2619..bc01727bd3 100644 --- a/kubernetes/so/templates/deployment.yaml +++ b/kubernetes/so/templates/deployment.yaml @@ -35,7 +35,7 @@ spec: - /root/ready.py args: - --container-name - - mariadb + - {{ .Values.mariadb.nameOverride }} env: - name: NAMESPACE valueFrom: @@ -49,7 +49,7 @@ spec: - name: {{ .Chart.Name }} command: - /tmp/start-jboss-server.sh - image: "{{ .Values.repository | default .Values.global.repository }}/{{ .Values.image }}" + image: "{{ include "common.repository" . }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} ports: - containerPort: {{ .Values.service.internalPort }} @@ -58,14 +58,14 @@ spec: - containerPort: {{ .Values.service.internalPort4 }} - containerPort: {{ .Values.service.internalPort5 }} # disable liveness probe when breakpoints set in debugger - # so K8s doesn't restart unresponsive container - {{- if eq .Values.liveness.enabled true }} + # 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 -}} + {{ end }} readinessProbe: tcpSocket: port: {{ .Values.service.internalPort }} diff --git a/kubernetes/so/templates/service.yaml b/kubernetes/so/templates/service.yaml index 63e41acc46..ac9d179628 100644 --- a/kubernetes/so/templates/service.yaml +++ b/kubernetes/so/templates/service.yaml @@ -15,7 +15,7 @@ apiVersion: v1 kind: Service metadata: - name: so + name: {{ include "common.servicename" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} @@ -25,7 +25,7 @@ metadata: annotations: msb.onap.org/service-info: '[ { - "serviceName": "so", + "serviceName": "{{ include "common.servicename" . }}", "version": "v1", "url": "/ecomp/mso/infra", "protocol": "REST" @@ -47,36 +47,36 @@ spec: ports: {{if eq .Values.service.type "NodePort" -}} - port: {{ .Values.service.internalPort }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort }} - name: {{ .Values.service.name }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.portName }} - port: {{ .Values.service.internalPort2 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort2 }} - name: {{ .Values.service.name }}2 + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} + name: {{ .Values.service.portName }}2 - port: {{ .Values.service.internalPort3 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort3 }} - name: {{ .Values.service.name }}3 + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort3 }} + name: {{ .Values.service.portName }}3 - port: {{ .Values.service.internalPort4 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort4 }} - name: {{ .Values.service.name }}4 + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort4 }} + name: {{ .Values.service.portName }}4 - port: {{ .Values.service.internalPort5 }} - nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort5 }} - name: {{ .Values.service.name }}5 + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort5 }} + name: {{ .Values.service.portName }}5 {{- else -}} - port: {{ .Values.service.externalPort }} targetPort: {{ .Values.service.internalPort }} - name: {{ .Values.service.name }} + name: {{ .Values.service.portName }} - port: {{ .Values.service.externalPort2 }} targetPort: {{ .Values.service.internalPort2 }} - name: {{ .Values.service.name }}2 + name: {{ .Values.service.portName }}2 - port: {{ .Values.service.externalPort3 }} targetPort: {{ .Values.service.internalPort3 }} - name: {{ .Values.service.name }}3 + name: {{ .Values.service.portName }}3 - port: {{ .Values.service.externalPort4 }} targetPort: {{ .Values.service.internalPort4 }} - name: {{ .Values.service.name }}4 + name: {{ .Values.service.portName }}4 - port: {{ .Values.service.externalPort5 }} targetPort: {{ .Values.service.internalPort5 }} - name: {{ .Values.service.name }}5 + name: {{ .Values.service.portName }}5 {{- end}} selector: app: {{ include "common.name" . }} diff --git a/kubernetes/so/values.yaml b/kubernetes/so/values.yaml index 705f3880e7..c92fe2a8f6 100644 --- a/kubernetes/so/values.yaml +++ b/kubernetes/so/values.yaml @@ -62,6 +62,10 @@ config: serviceName: sdc-be port: 8443 +# subchart configuration +mariadb: + nameOverride: so-db + # default number of instances replicaCount: 1 @@ -84,16 +88,17 @@ readiness: service: type: NodePort name: so - externalPort: 23 + portName: so internalPort: 8080 - externalPort2: 25 + nodePort: 23 internalPort2: 3904 - externalPort3: 24 + nodePort2: 25 internalPort3: 3905 - externalPort4: 22 + nodePort3: 24 internalPort4: 9990 - externalPort5: 50 + nodePort4: 22 internalPort5: 8787 + nodePort5: 50 ingress: enabled: false -- cgit 1.2.3-korg