diff options
author | vaibhav_16dec <vaibhav.chopra@amdocs.com> | 2018-03-19 05:45:47 +0000 |
---|---|---|
committer | Mike Elliott <mike.elliott@amdocs.com> | 2018-03-21 14:20:44 -0400 |
commit | f67e418cca95ef2c07e61bf65ea0334ac5ca9b1c (patch) | |
tree | 2d49e7177b4c23c91685ce15d366323f70405822 /kubernetes/clamp/templates | |
parent | a68cf4f3da292a9b41b6570067470bb456ca41c6 (diff) |
Add Helm Chart Standardization for Clamp
Issue-ID: OOM-735
Change-Id: Id5789742b4c930dcb2bebebbaa2cf82182949ee3
Signed-off-by: vaibhav_16dec <vaibhav.chopra@amdocs.com>
Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
Diffstat (limited to 'kubernetes/clamp/templates')
-rw-r--r-- | kubernetes/clamp/templates/NOTES.txt | 19 | ||||
-rw-r--r-- | kubernetes/clamp/templates/all-services.yaml | 43 | ||||
-rw-r--r-- | kubernetes/clamp/templates/clamp-deployment.yaml | 52 | ||||
-rw-r--r-- | kubernetes/clamp/templates/clamp-mariadb-configmap.yaml | 33 | ||||
-rw-r--r-- | kubernetes/clamp/templates/clamp-mariadb-deployment.yaml | 62 | ||||
-rw-r--r-- | kubernetes/clamp/templates/clamp-pv-pvc.yaml | 32 | ||||
-rw-r--r-- | kubernetes/clamp/templates/configmap.yaml | 12 | ||||
-rw-r--r-- | kubernetes/clamp/templates/deployment.yaml | 71 | ||||
-rw-r--r-- | kubernetes/clamp/templates/service.yaml | 25 |
9 files changed, 127 insertions, 222 deletions
diff --git a/kubernetes/clamp/templates/NOTES.txt b/kubernetes/clamp/templates/NOTES.txt new file mode 100644 index 0000000000..91d8ed42f1 --- /dev/null +++ b/kubernetes/clamp/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }}) + 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.name" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ template "so.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} +{{- end }} diff --git a/kubernetes/clamp/templates/all-services.yaml b/kubernetes/clamp/templates/all-services.yaml deleted file mode 100644 index c9f4f5ed5f..0000000000 --- a/kubernetes/clamp/templates/all-services.yaml +++ /dev/null @@ -1,43 +0,0 @@ -#{{ if not .Values.disableClampClampMariadb }} -apiVersion: v1 -kind: Service -metadata: - name: clamp-mariadb - namespace: "{{ .Values.nsPrefix }}" - labels: - app: clamp-mariadb -spec: - ports: - - name: clamp-mariadb - port: 3306 - selector: - app: clamp-mariadb - clusterIP: None -#{{ end }} -#{{ if not .Values.disableClampClamp }} ---- -apiVersion: v1 -kind: Service -metadata: - name: clamp - namespace: "{{ .Values.nsPrefix }}" - annotations: - msb.onap.org/service-info: '[ - { - "serviceName": "clamp", - "version": "v1", - "url": "/restservices/clds/v1", - "protocol": "REST", - "port": "8080", - "visualRange":"1" - } - ]' -spec: - ports: - - name: clamp - port: 8080 - nodePort: {{ .Values.nodePortPrefix }}95 - selector: - app: clamp - type: NodePort -#{{ end }}
\ No newline at end of file diff --git a/kubernetes/clamp/templates/clamp-deployment.yaml b/kubernetes/clamp/templates/clamp-deployment.yaml deleted file mode 100644 index 2c2e13f994..0000000000 --- a/kubernetes/clamp/templates/clamp-deployment.yaml +++ /dev/null @@ -1,52 +0,0 @@ -#{{ if not .Values.disableClampClamp }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: clamp - name: clamp - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.clampReplicas }} - selector: - matchLabels: - app: clamp - template: - metadata: - labels: - app: clamp - name: clamp - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - clamp-mariadb - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: clamp-readiness - containers: - - env: - - name: SPRING_APPLICATION_JSON - value: '{ - "spring.datasource.camunda.url": "jdbc:mariadb:sequential://clamp-mariadb.{{ .Values.nsPrefix }}:3306/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647", - "spring.datasource.cldsdb.url": "jdbc:mariadb:sequential://clamp-mariadb.{{ .Values.nsPrefix }}:3306/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647" - }' - image: {{ .Values.image.clampImage }}:{{ .Values.image.clampVersion }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: clamp - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - imagePullSecrets: - - name: {{ .Values.nsPrefix }}-docker-registry-key -#{{ end }} diff --git a/kubernetes/clamp/templates/clamp-mariadb-configmap.yaml b/kubernetes/clamp/templates/clamp-mariadb-configmap.yaml deleted file mode 100644 index 9a5fd8f284..0000000000 --- a/kubernetes/clamp/templates/clamp-mariadb-configmap.yaml +++ /dev/null @@ -1,33 +0,0 @@ -#{{ if not .Values.disableClampClampMariadb }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: clamp-entrypoint-initdb-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: clamp-entrypoint-drop-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/drop/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: clamp-entrypoint-bulkload-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/*").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: clamp-mariadb-conf-configmap - namespace: {{ .Values.nsPrefix }} -data: -{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/conf1/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/clamp/templates/clamp-mariadb-deployment.yaml b/kubernetes/clamp/templates/clamp-mariadb-deployment.yaml deleted file mode 100644 index a12489ef63..0000000000 --- a/kubernetes/clamp/templates/clamp-mariadb-deployment.yaml +++ /dev/null @@ -1,62 +0,0 @@ -#{{ if not .Values.disableClampClampMariadb }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: clamp-mariadb - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.clampMariaDbReplicas }} - selector: - matchLabels: - app: clamp-mariadb - template: - metadata: - labels: - app: clamp-mariadb - name: clamp-mariadb - spec: - hostname: clamp-mariadb - containers: - - args: - image: {{ .Values.image.mariadbImage }}:{{ .Values.image.mariadbVersion }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: "clamp-mariadb" - env: - - name: MYSQL_ROOT_PASSWORD - value: {{ .Values.mysqlPassword }} - volumeMounts: - - mountPath: /docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh - name: docker-entrypoint-initdb - subPath: load-sql-files-tests-automation.sh - - mountPath: /docker-entrypoint-initdb.d/drop/ - name: docker-entrypoint-clds-drop - - mountPath: /docker-entrypoint-initdb.d/bulkload/ - name: docker-entrypoint-bulkload - - mountPath: /etc/mysql/conf.d/conf1/ - name: clamp-mariadb-conf - - mountPath: /var/lib/mysql - name: clamp-mariadb-data - readinessProbe: - tcpSocket: - port: 3306 - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: docker-entrypoint-initdb - configMap: - name: clamp-entrypoint-initdb-configmap - - name: docker-entrypoint-clds-drop - configMap: - name: clamp-entrypoint-drop-configmap - - name: docker-entrypoint-bulkload - configMap: - name: clamp-entrypoint-bulkload-configmap - - name: clamp-mariadb-conf - configMap: - name: clamp-mariadb-conf-configmap - - name: clamp-mariadb-data - persistentVolumeClaim: - claimName: clamp-db - imagePullSecrets: - - name: {{ .Values.nsPrefix }}-docker-registry-key -#{{ end }} diff --git a/kubernetes/clamp/templates/clamp-pv-pvc.yaml b/kubernetes/clamp/templates/clamp-pv-pvc.yaml deleted file mode 100644 index c542de6026..0000000000 --- a/kubernetes/clamp/templates/clamp-pv-pvc.yaml +++ /dev/null @@ -1,32 +0,0 @@ -#{{ if not .Values.disableClampClampMariadb }} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: "{{ .Values.nsPrefix }}-clamp" - namespace: "{{ .Values.nsPrefix }}" - labels: - name: "{{ .Values.nsPrefix }}-clamp" -spec: - capacity: - storage: 2Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/clamp/mariadb/data ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: clamp-db - namespace: "{{ .Values.nsPrefix }}" -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 2Gi - selector: - matchLabels: - name: "{{ .Values.nsPrefix }}-clamp" -#{{ end }} diff --git a/kubernetes/clamp/templates/configmap.yaml b/kubernetes/clamp/templates/configmap.yaml new file mode 100644 index 0000000000..1de3b2f652 --- /dev/null +++ b/kubernetes/clamp/templates/configmap.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +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 }} +data: + spring_application_json: {{ .Values.config.springApplicationJson | quote }} diff --git a/kubernetes/clamp/templates/deployment.yaml b/kubernetes/clamp/templates/deployment.yaml new file mode 100644 index 0000000000..d701e25d3a --- /dev/null +++ b/kubernetes/clamp/templates/deployment.yaml @@ -0,0 +1,71 @@ +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.mariadb.nameOverride }} + env: + - name: NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + name: {{ include "common.name" . }}-readiness + containers: + - name: {{ include "common.name" . }} + image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + 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: SPRING_APPLICATION_JSON + valueFrom: + configMapKeyRef: + name: {{ template "common.fullname" . }} + key: spring_application_json + 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 }} + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/clamp/templates/service.yaml b/kubernetes/clamp/templates/service.yaml new file mode 100644 index 0000000000..91485a1eec --- /dev/null +++ b/kubernetes/clamp/templates/service.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.name }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} |