diff options
Diffstat (limited to 'kubernetes/vid')
24 files changed, 770 insertions, 320 deletions
diff --git a/kubernetes/vid/.helmignore b/kubernetes/vid/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/vid/.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/vid/Chart.yaml b/kubernetes/vid/Chart.yaml index 9c924bbc81..4df4dae10c 100644 --- a/kubernetes/vid/Chart.yaml +++ b/kubernetes/vid/Chart.yaml @@ -13,6 +13,6 @@ # limitations under the License. apiVersion: v1 -description: A Helm chart for Kubernetes +description: ONAP Virtual Infrastructure Deployment name: vid -version: 0.1.0 +version: 2.0.0 diff --git a/kubernetes/vid/charts/mariadb/.helmignore b/kubernetes/vid/charts/mariadb/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/vid/charts/mariadb/.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/vid/charts/mariadb/Chart.yaml b/kubernetes/vid/charts/mariadb/Chart.yaml new file mode 100644 index 0000000000..1f7de32fdf --- /dev/null +++ b/kubernetes/vid/charts/mariadb/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: VID MariaDB Service +name: mariadb +version: 2.0.0 diff --git a/kubernetes/vid/resources/config/lf_config/vid-my.cnf b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf index 472bf4698e..472bf4698e 100755..100644 --- a/kubernetes/vid/resources/config/lf_config/vid-my.cnf +++ b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf diff --git a/kubernetes/vid/resources/config/lf_config/vid-pre-init.sql b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql index 57b797d03c..57b797d03c 100755..100644 --- a/kubernetes/vid/resources/config/lf_config/vid-pre-init.sql +++ b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql diff --git a/kubernetes/vid/charts/mariadb/templates/NOTES.txt b/kubernetes/vid/charts/mariadb/templates/NOTES.txt new file mode 100644 index 0000000000..75f0a7a6b3 --- /dev/null +++ b/kubernetes/vid/charts/mariadb/templates/NOTES.txt @@ -0,0 +1,11 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} + 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 }} + export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ .Chart.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/vid/templates/vid-lfconfig-configmap.yaml b/kubernetes/vid/charts/mariadb/templates/configmap.yaml index 2809705de9..8a35df3f30 100644 --- a/kubernetes/vid/templates/vid-lfconfig-configmap.yaml +++ b/kubernetes/vid/charts/mariadb/templates/configmap.yaml @@ -12,12 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableVidVidMariadb }} apiVersion: v1 kind: ConfigMap metadata: - name: vid-lfconfig-configmap - namespace: {{ .Values.nsPrefix }} + name: {{ include "common.fullname" . }}-lfconfig + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/lf_config/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/vid/charts/mariadb/templates/deployment.yaml b/kubernetes/vid/charts/mariadb/templates/deployment.yaml new file mode 100644 index 0000000000..cafab0c17e --- /dev/null +++ b/kubernetes/vid/charts/mariadb/templates/deployment.yaml @@ -0,0 +1,109 @@ +# 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: + 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 }} + {{- 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_DATABASE + value: "{{ .Values.config.mysqldb }}" + - name: MYSQL_USER + value: "{{ .Values.config.mysqluser }}" + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-password + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /var/lib/mysql + name: mariadb-data + - mountPath: /docker-entrypoint-initdb.d/vid-pre-init.sql + name: lfconfig + subPath: vid-pre-init.sql + - mountPath: /etc/mysql/my.cnf + name: lfconfig + subPath: my.cnf + 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: mariadb-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + - name: localtime + hostPath: + path: /etc/localtime + - name: lfconfig + configMap: + name: {{ include "common.fullname" . }}-lfconfig + defaultMode: 0755 + items: + - key: vid-my.cnf + path: my.cnf + - key: vid-pre-init.sql + path: vid-pre-init.sql + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/vid/charts/mariadb/templates/pv.yaml b/kubernetes/vid/charts/mariadb/templates/pv.yaml new file mode 100644 index 0000000000..184728f8ad --- /dev/null +++ b/kubernetes/vid/charts/mariadb/templates/pv.yaml @@ -0,0 +1,37 @@ +{{/* +# 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 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/vid/charts/mariadb/templates/pvc.yaml b/kubernetes/vid/charts/mariadb/templates/pvc.yaml new file mode 100644 index 0000000000..e27c3311e9 --- /dev/null +++ b/kubernetes/vid/charts/mariadb/templates/pvc.yaml @@ -0,0 +1,48 @@ +{{/* +# 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 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/vid/charts/mariadb/templates/secrets.yaml b/kubernetes/vid/charts/mariadb/templates/secrets.yaml new file mode 100644 index 0000000000..36096925f5 --- /dev/null +++ b/kubernetes/vid/charts/mariadb/templates/secrets.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: 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.mariadbRootPassword | b64enc | quote }} + db-password: {{ .Values.config.mariadbPassword | b64enc | quote }} diff --git a/kubernetes/vid/templates/all-services.yaml b/kubernetes/vid/charts/mariadb/templates/service.yaml index a946a2ab54..88ed09bb45 100644 --- a/kubernetes/vid/templates/all-services.yaml +++ b/kubernetes/vid/charts/mariadb/templates/service.yaml @@ -12,35 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableVidVidMariadb }} -apiVersion: v1 -kind: Service -metadata: - name: vid-mariadb - namespace: "{{ .Values.nsPrefix }}" -spec: - ports: - - name: vid-mariadb - port: 3306 - selector: - app: vid-mariadb - clusterIP: None -#{{ end }} -#{{ if not .Values.disableVidVidServer }} ---- apiVersion: v1 kind: Service metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} labels: - app: vid-server - name: vid-server - namespace: "{{ .Values.nsPrefix }}" + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} spec: ports: - - name: vid-server - nodePort: {{ .Values.nodePortPrefix }}00 - port: 8080 + - port: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} selector: - app: vid-server - type: NodePort -#{{ end }}
\ No newline at end of file + app: {{ include "common.name" . }} + release: {{ .Release.Name }} diff --git a/kubernetes/vid/charts/mariadb/values.yaml b/kubernetes/vid/charts/mariadb/values.yaml new file mode 100644 index 0000000000..567109c6d4 --- /dev/null +++ b/kubernetes/vid/charts/mariadb/values.yaml @@ -0,0 +1,102 @@ +# 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. + +# Default values for mariadb. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: # global defaults + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + persistence: {} + + +# application image +repository: nexus3.onap.org:10001 +image: library/mariadb:10 +pullPolicy: Always + +# application configuration +config: + mysqldb: vid_openecomp_epsdk + mysqluser: vidadmin + mariadbRootPassword: LF+tp_1WqgSY + mariadbPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + +# 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: vid/mariadb/data + +service: + name: mariadb + internalPort: 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/vid/requirements.yaml b/kubernetes/vid/requirements.yaml new file mode 100644 index 0000000000..f639633537 --- /dev/null +++ b/kubernetes/vid/requirements.yaml @@ -0,0 +1,21 @@ +# 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 + # 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' diff --git a/kubernetes/vid/templates/NOTES.txt b/kubernetes/vid/templates/NOTES.txt new file mode 100644 index 0000000000..6e0b9fc06d --- /dev/null +++ b/kubernetes/vid/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={{ .Chart.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/vid/templates/vid-log-configmap.yaml b/kubernetes/vid/templates/configmap.yaml index 3a72866e0d..f7dbf07645 100644 --- a/kubernetes/vid/templates/vid-log-configmap.yaml +++ b/kubernetes/vid/templates/configmap.yaml @@ -12,20 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -#{{ if not .Values.disableVidVidServer }} apiVersion: v1 kind: ConfigMap metadata: - name: vid-log-configmap - namespace: {{ .Values.nsPrefix }} + name: {{ include "common.fullname" . }}-log-configmap + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/log/vid/*").AsConfig . | indent 2 }} --- apiVersion: v1 kind: ConfigMap metadata: - name: vid-filebeat-configmap - namespace: {{ .Values.nsPrefix }} + name: {{ include "common.fullname" . }}-filebeat-configmap + namespace: {{ include "common.namespace" . }} data: {{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }} -#{{ end }} diff --git a/kubernetes/vid/templates/deployment.yaml b/kubernetes/vid/templates/deployment.yaml new file mode 100644 index 0000000000..89ed734dfb --- /dev/null +++ b/kubernetes/vid/templates/deployment.yaml @@ -0,0 +1,162 @@ +# 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.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 }} + lifecycle: + postStart: + exec: + command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/usr/local/tomcat/webapps/vid/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] + 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: ASDC_CLIENT_REST_HOST + value: sdc-be.{{ include "common.namespace" . }}-sdc + - name: ASDC_CLIENT_REST_AUTH + value: "{{ .Values.config.asdcclientrestauth }}" + - name: ASDC_CLIENT_REST_PORT + value: "{{ .Values.config.asdcclientrestport }}" + - name: VID_AAI_HOST + value: aai-service.{{ include "common.namespace" . }}-aai + - name: VID_AAI_PORT + value: "{{ .Values.config.vidaaiport }}" + - name: VID_ECOMP_SHARED_CONTEXT_REST_URL + value: http://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/context + - name: VID_MSO_SERVER_URL + value: http://mso.{{ include "common.namespace" . }}-mso:"{{ .Values.config.msoport }}" + - name: VID_MSO_PASS + value: "{{ .Values.config.vidmsopass }}" + - name: MSO_DME2_SERVER_URL + value: "{{ .Values.config.msodme2serverurl }}" + - name: MSO_DME2_ENABLED + value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }} + - name: VID_ECOMP_REDIRECT_URL + value: http://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/login.h\tm + - name: VID_ECOMP_REST_URL + value: http://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/auxapi + - name: VID_CONTACT_US_LINK + value: "{{ .Values.config.vidcontactuslink }}" + - name: VID_UEB_URL_LIST + value: dmaap.{{ include "common.namespace" . }}-message-router + - name: VID_MYSQL_HOST + value: "{{ .Values.config.vidmysqlhost }}" + - name: VID_MYSQL_PORT + value: "{{ .Values.config.vidmysqlport }}" + - name: VID_MYSQL_DBNAME + value: "{{ .Values.config.vidmysqldbname }}" + - name: VID_MYSQL_USER + value: "{{ .Values.config.vidmysqluser }}" + - name: VID_MYSQL_PASS + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: vid-password + - name: VID_MYSQL_MAXCONNECTIONS + value: "{{ .Values.config.vidmysqlmaxconnections }}" + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - mountPath: /var/log/onap + name: vid-logs + - mountPath: /tmp/logback.xml + name: vid-logback + subPath: logback.xml + 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 }} + # side car containers + - name: filebeat-onap + image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - mountPath: /usr/share/filebeat/filebeat.yml + name: filebeat-conf + subPath: filebeat.yml + - mountPath: /var/log/onap + name: vid-logs + - mountPath: /usr/share/filebeat/data + name: vid-data-filebeat + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: filebeat-conf + configMap: + name: {{ include "common.fullname" . }}-filebeat-configmap + - name: vid-logs + emptyDir: {} + - name: vid-data-filebeat + emptyDir: {} + - name: vid-logback + configMap: + name: {{ include "common.fullname" . }}-log-configmap + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/vid/templates/secrets.yaml b/kubernetes/vid/templates/secrets.yaml new file mode 100644 index 0000000000..729e0b17c0 --- /dev/null +++ b/kubernetes/vid/templates/secrets.yaml @@ -0,0 +1,27 @@ +# 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: 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: + vid-password: {{ .Values.config.vidmysqlpassword | b64enc | quote }} diff --git a/kubernetes/vid/templates/service.yaml b/kubernetes/vid/templates/service.yaml new file mode 100644 index 0000000000..3969d2184b --- /dev/null +++ b/kubernetes/vid/templates/service.yaml @@ -0,0 +1,39 @@ +# 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 }} +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/vid/templates/vid-mariadb-deployment.yaml b/kubernetes/vid/templates/vid-mariadb-deployment.yaml deleted file mode 100644 index 4eb46c2c02..0000000000 --- a/kubernetes/vid/templates/vid-mariadb-deployment.yaml +++ /dev/null @@ -1,84 +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.disableVidVidMariadb }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: vid-mariadb - name: vid-mariadb - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.vidMariaDbReplicas }} - selector: - matchLabels: - app: vid-mariadb - template: - metadata: - labels: - app: vid-mariadb - name: vid-mariadb - spec: - containers: - - image: {{ .Values.image.mariadb }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: vid-mariadb - env: - - name: MYSQL_DATABASE - value: vid_openecomp_epsdk - - name: MYSQL_USER - value: vidadmin - - name: MYSQL_PASSWORD - value: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U - - name: MYSQL_ROOT_PASSWORD - value: LF+tp_1WqgSY - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /var/lib/mysql - name: vid-mariadb-data - - mountPath: /docker-entrypoint-initdb.d/vid-pre-init.sql - name: vid-lfconfig - subPath: vid-pre-init.sql - - mountPath: /etc/mysql/my.cnf - name: vid-lfconfig - subPath: my.cnf - ports: - - containerPort: 3306 - readinessProbe: - tcpSocket: - port: 3306 - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: vid-mariadb-data - persistentVolumeClaim: - claimName: vid-db - - name: vid-lfconfig - configMap: - name: vid-lfconfig-configmap - defaultMode: 0755 - items: - - key: vid-my.cnf - path: my.cnf - - key: vid-pre-init.sql - path: vid-pre-init.sql - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/vid/templates/vid-pv-pvc.yaml b/kubernetes/vid/templates/vid-pv-pvc.yaml deleted file mode 100644 index 4d8db678e9..0000000000 --- a/kubernetes/vid/templates/vid-pv-pvc.yaml +++ /dev/null @@ -1,48 +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.disableVidVidMariadb }} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: "{{ .Values.nsPrefix }}-vid" - namespace: "{{ .Values.nsPrefix }}" - labels: - name: "{{ .Values.nsPrefix }}-vid" -spec: - capacity: - storage: 2Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/vid/mariadb/data ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: vid-db - namespace: "{{ .Values.nsPrefix }}" -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 2Gi - selector: - matchLabels: - name: "{{ .Values.nsPrefix }}-vid" -#{{ end }} diff --git a/kubernetes/vid/templates/vid-server-deployment.yaml b/kubernetes/vid/templates/vid-server-deployment.yaml deleted file mode 100644 index 7903fb02b1..0000000000 --- a/kubernetes/vid/templates/vid-server-deployment.yaml +++ /dev/null @@ -1,141 +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.disableVidVidServer }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: vid-server - name: vid-server - namespace: "{{ .Values.nsPrefix }}" -spec: - replicas: {{ .Values.vidServerReplicas }} - selector: - matchLabels: - app: vid-server - template: - metadata: - labels: - app: vid-server - name: vid-server - spec: - initContainers: - - command: - - /root/ready.py - args: - - --container-name - - vid-mariadb - env: - - name: NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: {{ .Values.image.readiness }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: vid-server-readiness - containers: - - env: - - name: ASDC_CLIENT_REST_HOST - value: sdc-be.{{ .Values.nsPrefix }} - - name: ASDC_CLIENT_REST_AUTH - value: Basic dmlkOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU= - - name: ASDC_CLIENT_REST_PORT - value: "8080" - - name: VID_AAI_HOST - value: aai-service.{{ .Values.nsPrefix }} - - name: VID_AAI_PORT - value: "8443" - - name: VID_ECOMP_SHARED_CONTEXT_REST_URL - value: http://portalapps.{{ .Values.nsPrefix }}:8989/ONAPPORTAL/context - - name: VID_MSO_SERVER_URL - value: http://mso.{{ .Values.nsPrefix }}:8080 - - name: VID_MSO_PASS - value: OBF:1ih71i271vny1yf41ymf1ylz1yf21vn41hzj1icz - - name: MSO_DME2_SERVER_URL - value: http://localhost:8081 - - name: MSO_DME2_ENABLED - value: "false" - - name: VID_ECOMP_REDIRECT_URL - value: http://portalapps.{{ .Values.nsPrefix }}:8989/ONAPPORTAL/login.htm - - name: VID_ECOMP_REST_URL - value: http://portalapps.{{ .Values.nsPrefix }}:8989/ONAPPORTAL/auxapi - - name: VID_CONTACT_US_LINK - value: https://todo_contact_us_link.com - - name: VID_UEB_URL_LIST - value: dmaap.{{ .Values.nsPrefix }} - - name: VID_MYSQL_HOST - value: vid-mariadb - - name: VID_MYSQL_PORT - value: "3306" - - name: VID_MYSQL_DBNAME - value: vid_openecomp_epsdk - - name: VID_MYSQL_USER - value: vidadmin - - name: VID_MYSQL_PASS - value: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U - - name: VID_MYSQL_MAXCONNECTIONS - value: "5" - image: {{ .Values.image.vid }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: vid-server - lifecycle: - postStart: - exec: - command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/usr/local/tomcat/webapps/vid/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] - ports: - - containerPort: 8080 - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /var/log/onap - name: vid-logs - - mountPath: /tmp/logback.xml - name: vid-logback - subPath: logback.xml - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - subPath: filebeat.yml - - mountPath: /var/log/onap - name: vid-logs - - mountPath: /usr/share/filebeat/data - name: vid-data-filebeat - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: filebeat-conf - configMap: - name: vid-filebeat-configmap - - name: vid-logs - emptyDir: {} - - name: vid-data-filebeat - emptyDir: {} - - name: vid-logback - configMap: - name: vid-log-configmap - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/vid/values.yaml b/kubernetes/vid/values.yaml index f177476e7d..b42bceb093 100644 --- a/kubernetes/vid/values.yaml +++ b/kubernetes/vid/values.yaml @@ -12,17 +12,96 @@ # See the License for the specific language governing permissions and # limitations under the License. -nsPrefix: onap +# Default values for vid. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.1.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +subChartsOnly: + enabled: true + +# application image +repository: nexus3.onap.org:10001 +image: openecomp/vid:v1.1.1 pullPolicy: Always -nodePortPrefix: 302 -dataRootDir: /dockerdata-nfs -vidMariaDbReplicas: 1 -vidServerReplicas: 1 -image: - readiness: oomk8s/readiness-check:1.1.0 - mariadb: nexus3.onap.org:10001/library/mariadb:10 - vid: nexus3.onap.org:10001/openecomp/vid:v1.1.1 - filebeat: docker.elastic.co/beats/filebeat:5.5.0 + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration config: + vidmysqlpassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + asdcclientrestauth: "Basic dmlkOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=" + asdcclientrestport: "8080" + vidaaiport: "8443" + onapport: "8989" + msoport: "8080" + vidmsopass: OBF:1ih71i271vny1yf41ymf1ylz1yf21vn41hzj1icz + msodme2serverurl: http://localhost:8081 + vidcontactuslink: https://todo_contact_us_link.com + vidmysqlhost: vid-mariadb + vidmysqlport: "3306" + vidmysqldbname: vid_openecomp_epsdk + vidmysqluser: vidadmin + vidmysqlmaxconnections: "5" logstashServiceName: log-ls logstashPort: 5044 + + +# subchart configuration +mariadb: + nameOverride: vid-db + +# 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: vid + externalPort: "00" + nodePort: "00" + internalPort: 8080 + +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 |