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 | |
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')
25 files changed, 522 insertions, 207 deletions
diff --git a/kubernetes/clamp/Chart.yaml b/kubernetes/clamp/Chart.yaml index a162ca7dd0..2f68750919 100644 --- a/kubernetes/clamp/Chart.yaml +++ b/kubernetes/clamp/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 -description: A Helm chart for Kubernetes +description: ONAP Clamp name: clamp -version: 1.1.0 +version: 2.0.0 diff --git a/kubernetes/clamp/charts/mariadb/Chart.yaml b/kubernetes/clamp/charts/mariadb/Chart.yaml new file mode 100644 index 0000000000..da9cab3175 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: MariaDB Service +name: mariadb +version: 2.0.0 diff --git a/kubernetes/clamp/charts/mariadb/NOTES.txt b/kubernetes/clamp/charts/mariadb/NOTES.txt new file mode 100644 index 0000000000..91d8ed42f1 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/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/resources/config/mariadb/conf.d/conf1/my.cnf b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/conf.d/conf1/my.cnf index 0be1bd7aa3..0be1bd7aa3 100644 --- a/kubernetes/clamp/resources/config/mariadb/conf.d/conf1/my.cnf +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/conf.d/conf1/my.cnf diff --git a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql index 3312daf56f..3312daf56f 100644 --- a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-create-db-objects.sql diff --git a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql index 112cb2b55e..112cb2b55e 100644 --- a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/clds-stored-procedures.sql diff --git a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql index 478eaf0e09..478eaf0e09 100644 --- a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/drop/clds-drop-db-objects.sql diff --git a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh index 4924922c91..4924922c91 100644 --- a/kubernetes/clamp/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh +++ b/kubernetes/clamp/charts/mariadb/resources/config/mariadb/docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh diff --git a/kubernetes/clamp/templates/clamp-mariadb-configmap.yaml b/kubernetes/clamp/charts/mariadb/templates/configmap.yaml index 9a5fd8f284..8b58aedcb0 100644 --- a/kubernetes/clamp/templates/clamp-mariadb-configmap.yaml +++ b/kubernetes/clamp/charts/mariadb/templates/configmap.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: clamp-entrypoint-initdb-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/*").AsConfig . | indent 2 }} --- @@ -11,7 +11,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: clamp-entrypoint-drop-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/drop/*").AsConfig . | indent 2 }} --- @@ -19,7 +19,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: clamp-entrypoint-bulkload-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/mariadb/docker-entrypoint-initdb.d/bulkload/*").AsConfig . | indent 2 }} --- @@ -27,7 +27,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: clamp-mariadb-conf-configmap - namespace: {{ .Values.nsPrefix }} + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/mariadb/conf.d/conf1/*").AsConfig . | indent 2 }} #{{ end }} diff --git a/kubernetes/clamp/charts/mariadb/templates/deployment.yaml b/kubernetes/clamp/charts/mariadb/templates/deployment.yaml new file mode 100644 index 0000000000..1e17b9b139 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/templates/deployment.yaml @@ -0,0 +1,94 @@ +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: + 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: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + volumeMounts: + - mountPath: /docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh + name: docker-entrypoint-initdb + subPath: load-sql-files-tests-automation.sh + - mountPath: /etc/localtime + name: localtime + readOnly: true + - 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 + 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: + {{- if .Values.persistence.enabled }} + - name: clamp-mariadb-data + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + - 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: localtime + hostPath: + path: /etc/localtime + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/clamp/charts/mariadb/templates/pv.yaml b/kubernetes/clamp/charts/mariadb/templates/pv.yaml new file mode 100644 index 0000000000..31230a9ed7 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/templates/pv.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolume +apiVersion: v1 +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 }}" + name: {{ include "common.fullname" . }} +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} +{{- end -}} diff --git a/kubernetes/clamp/charts/mariadb/templates/pvc.yaml b/kubernetes/clamp/charts/mariadb/templates/pvc.yaml new file mode 100644 index 0000000000..b0cd3bf238 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/templates/pvc.yaml @@ -0,0 +1,32 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + selector: + matchLabels: + name: {{ include "common.fullname" . }} + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} diff --git a/kubernetes/clamp/charts/mariadb/templates/secrets.yaml b/kubernetes/clamp/charts/mariadb/templates/secrets.yaml new file mode 100644 index 0000000000..4734d1f242 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +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 }} +type: Opaque +data: + db-root-password: {{ .Values.config.mysqlPassword | b64enc | quote }} diff --git a/kubernetes/clamp/charts/mariadb/templates/service.yaml b/kubernetes/clamp/charts/mariadb/templates/service.yaml new file mode 100644 index 0000000000..94ec4694a3 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/templates/service.yaml @@ -0,0 +1,24 @@ +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 "302" }}{{ .Values.service.nodePort }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + {{- end}} + name: {{ .Values.service.name }} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }}
\ No newline at end of file diff --git a/kubernetes/clamp/charts/mariadb/values.yaml b/kubernetes/clamp/charts/mariadb/values.yaml new file mode 100644 index 0000000000..c525fec597 --- /dev/null +++ b/kubernetes/clamp/charts/mariadb/values.yaml @@ -0,0 +1,91 @@ +################################################################# +# Global configuration defaults. +################################################################# +global: # global defaults + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + + persistence: {} + +# application image +repository: nexus3.onap.org:10001 +image: mariadb:10.1.11 +pullPolicy: Always + +################################################################# +# Application configuration defaults. +################################################################# +config: + mysqlPassword: strong_pitchou + +# 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 + +## Persist data to a persitent volume +persistence: + enabled: true + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + volumeReclaimPolicy: Retain + + ## database data Persistent Volume Storage Class + ## If defined, storageClassName: <storageClass> + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteMany + size: 2Gi + mountPath: /dockerdata-nfs + mountSubPath: clamp/mariadb/data + +service: + type: ClusterIP + name: mariadb + internalPort: 3306 + externalPort: 3306 + + +ingress: + enabled: false + + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi diff --git a/kubernetes/clamp/requirements.yaml b/kubernetes/clamp/requirements.yaml new file mode 100644 index 0000000000..56029ab047 --- /dev/null +++ b/kubernetes/clamp/requirements.yaml @@ -0,0 +1,7 @@ +dependencies: + - name: common + version: ~2.0.0 + # local reference to common chart, as it is + # a part of this chart's package and will not + # be published independently to a repo (at this point) + repository: '@local'
\ No newline at end of file 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-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 }} diff --git a/kubernetes/clamp/values.yaml b/kubernetes/clamp/values.yaml index 103472afd9..e077531015 100644 --- a/kubernetes/clamp/values.yaml +++ b/kubernetes/clamp/values.yaml @@ -1,13 +1,85 @@ -nsPrefix: onap +################################################################# +# Global configuration defaults. +################################################################# +global: # global defaults + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +subChartsOnly: + enabled: true + +# application image +repository: nexus3.onap.org:10001 +image: onap/clamp pullPolicy: Always -nodePortPrefix: 302 -mysqlPassword: strong_pitchou -dataRootDir: /dockerdata-nfs -clampReplicas: 1 -clampMariaDbReplicas: 1 -image: - readiness: oomk8s/readiness-check:1.1.0 - clampImage: nexus3.onap.org:10001/onap/clamp - clampVersion: v1.1.0 - mariadbImage: nexus3.onap.org:10001/mariadb - mariadbVersion: 10.1.11 + +# flag to enable debugging - application support required +debugEnabled: false + +################################################################# +# Application configuration defaults. +################################################################# +config: + mysqlPassword: strong_pitchou + dataRootDir: /dockerdata-nfs + springApplicationJson: '{ + "spring.datasource.camunda.url": "jdbc:mariadb:sequential://clamp-mariadb.{{include "common.namespace" .}}:3306/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647", + "spring.datasource.cldsdb.url": "jdbc:mariadb:sequential://clamp-mariadb.{{include "common.namespace" .}}:3306/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647" + }' + +# subchart configuration +mariadb: + nameOverride: clampdb + + +# 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: clamp + internalPort: 8080 + nodePort: 95 + +ingress: + enabled: false + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +#resources: +# limits: +# cpu: 2 +# memory: 4Gi +# requests: +# cpu: 2 +# memory: 4Gi |