From e825feeadf1aae047371ebc5c6113be1f7ec464e Mon Sep 17 00:00:00 2001 From: Dominic Lunanuova Date: Thu, 12 Apr 2018 14:40:34 +0000 Subject: Integration w common/postgres Patchset 1: first cut at integration with common/postgres Patchset 2: Mandeep Khinda - refactored charts to standardize Wired in shared postgres chart Patchset 6: Introduced simple dmaap/Makefile to force helm dep up in the deeper charts directory. Includes slight modification to parent make clean target Patchset 8: merge conflict again Change-Id: If59f08638bac8761ae5452b60f172c99fcf4ec86 Signed-off-by: Dominic Lunanuova Issue-ID: DMAAP-117 Signed-off-by: Dominic Lunanuova --- .../dmaap/charts/dmaap-bus-controller/.helmignore | 21 ++++ .../dmaap/charts/dmaap-bus-controller/Chart.yaml | 18 ++++ .../dmaap/charts/dmaap-bus-controller/README.md | 11 ++ .../charts/dmaap-bus-controller/requirements.yaml | 21 ++++ .../resources/config/buscontroller.env | 14 +++ .../dmaap-bus-controller/templates/NOTES.txt | 19 ++++ .../dmaap-bus-controller/templates/configmap.yaml | 21 ++++ .../dmaap-bus-controller/templates/deployment.yaml | 94 +++++++++++++++++ .../dmaap-bus-controller/templates/service.yaml | 47 +++++++++ .../dmaap/charts/dmaap-bus-controller/values.yaml | 113 +++++++++++++++++++++ 10 files changed, 379 insertions(+) create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/.helmignore create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/Chart.yaml create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/README.md create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/requirements.yaml create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/resources/config/buscontroller.env create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/templates/NOTES.txt create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/templates/configmap.yaml create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/templates/deployment.yaml create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/templates/service.yaml create mode 100644 kubernetes/dmaap/charts/dmaap-bus-controller/values.yaml (limited to 'kubernetes/dmaap/charts/dmaap-bus-controller') diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/.helmignore b/kubernetes/dmaap/charts/dmaap-bus-controller/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/.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/dmaap/charts/dmaap-bus-controller/Chart.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/Chart.yaml new file mode 100644 index 0000000000..430b7d13c3 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/Chart.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +description: a Helm chart to deploy ONAP DMaaP Bus Controller (aka dmaap-prov) in Kubernetes +name: dmaap-bus-controller +version: 2.0.0 diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/README.md b/kubernetes/dmaap/charts/dmaap-bus-controller/README.md new file mode 100644 index 0000000000..c696a2c361 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/README.md @@ -0,0 +1,11 @@ +# Helm Chart for ONAP DMaaP Applications + +ONAP includes the following Kubernetes services available in ONAP Beijing Release (more expected in future): + +1) message-router - a message bus for applications +2) dmaap-prov - an API to provision DMaaP resources + +# Service Dependencies + +message-router depends on AAF +dmaap-prov depends on AAF and Postgresql. diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/requirements.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/requirements.yaml new file mode 100644 index 0000000000..b67ac02eca --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/requirements.yaml @@ -0,0 +1,21 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' + - name: postgres + version: ~2.0.0 + repository: '@local' diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/resources/config/buscontroller.env b/kubernetes/dmaap/charts/dmaap-bus-controller/resources/config/buscontroller.env new file mode 100644 index 0000000000..6b15db9ced --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/resources/config/buscontroller.env @@ -0,0 +1,14 @@ +DMAAPBC_WAIT_TO_EXIT=Y +DMAAPBC_PG_ENABLED=true +# Need to connect to PG primary service, designated by service.name2 +DMAAPBC_PGHOST={{ .Values.postgres.service.name2 }} +DMAAPBC_PGDBNAME={{ .Values.postgres.config.pgDatabase }} +DMAAPBC_PGCRED={{ .Values.postgres.config.pgUserPassword }} +DMAAPBC_PGUSER={{ .Values.postgres.config.pgUserName }} +DMAAPBC_MR_CNAME={{ .Values.dmaapMessageRouterService }} +DMAAPBC_AAF_URL={{ .Values.aafURL }} +DMAAPBC_TOPICMGR_USER={{ .Values.topicMgrUser }} +DMAAPBC_TOPICMGR_PWD={{ .Values.topicMgrPwd }} +DMAAPBC_ADMIN_USER={{ .Values.adminUser }} +DMAAPBC_ADMIN_PWD={{ .Values.adminPwd }} + diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/templates/NOTES.txt b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/NOTES.txt new file mode 100644 index 0000000000..fbab5a3758 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/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" . }}-prov) + 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.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.fullname" . }} -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 "common.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/dmaap/charts/dmaap-bus-controller/templates/configmap.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/configmap.yaml new file mode 100644 index 0000000000..1ed749593f --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-config + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/templates/deployment.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/deployment.yaml new file mode 100644 index 0000000000..2c38792c87 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/deployment.yaml @@ -0,0 +1,94 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +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.postgres.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.buscontrollerImage }}:{{ .Values.image.buscontrollerVersion }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + - containerPort: {{ .Values.service.internalPort2 }} + {{if eq .Values.liveness.enabled true }} + livenessProbe: + httpGet: + port: {{ .Values.service.internalPort }} + path: /webapi/info + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + readinessProbe: + httpGet: + port: {{ .Values.service.internalPort }} + path: /webapi/info + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + {{ end -}} + volumeMounts: + - mountPath: /etc/localtime + name: localtime + readOnly: true + - name: {{ include "common.name" . }}-config + mountPath: /opt/app/config/conf + subPath: buscontroller.env + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 10 }} + {{- end -}} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 10 }} + {{- end }} + volumes: + - name: localtime + hostPath: + path: /etc/localtime + - name: {{ include "common.name" . }}-config + configMap: + name: {{ include "common.fullname" . }}-config + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/templates/service.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/service.yaml new file mode 100644 index 0000000000..2660052ffb --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/templates/service.yaml @@ -0,0 +1,47 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }} + 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.externalPort }} + targetPort: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.name }} + - port: {{ .Values.service.externalPort2 }} + targetPort: {{ .Values.service.internalPort2 }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort2 }} + name: {{ .Values.service.name }}2 + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + - port: {{ .Values.service.externalPort2 }} + targetPort: {{ .Values.service.internalPort2 }} + name: {{ .Values.service.name }}2 + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/kubernetes/dmaap/charts/dmaap-bus-controller/values.yaml b/kubernetes/dmaap/charts/dmaap-bus-controller/values.yaml new file mode 100644 index 0000000000..3acb490e57 --- /dev/null +++ b/kubernetes/dmaap/charts/dmaap-bus-controller/values.yaml @@ -0,0 +1,113 @@ +# Copyright © 2018 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ== + readinessRepository: oomk8s + readinessImage: readiness-check:1.1.1 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +#nsPrefix: onap +pullPolicy: Always + +# application images +repository: nexus3.onap.org:10001 + +image: + buscontrollerImage: onap/dmaap/buscontroller + buscontrollerVersion: 1.0.8 + + +# application configuration +dmaapMessageRouterService: dmaap +aafURL: https://onap-aaf:8905/proxy/ +topicMgrUser: m23456@dmaapbc.onap.org +topicMgrPwd: onapdemo +adminUser: m12345@dmaapbc.onap.org +adminPwd: onapdemo + +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: false + +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + + +service: + type: ClusterIP + name: dmaap-bc + externalPort: 8080 + internalPort: 8080 + externalPort2: 8443 + internalPort2: 8443 + + +# application configuration override for postgres +postgres: + nameOverride: dbcl-db + service: + name: dbcl-postgres + name2: dbcl-pg-primary + name3: dbcl-pg-replica + container: + name: + primary: dbcl-pg-primary + replica: dbcl-pg-replica + config: + pgUserName: dmaap_admin + pgDatabase: dmaap + pgPrimaryPassword: onapdemodb + pgUserPassword: onapdemodb + pgRootPassword: onapdemodb + + +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 -- cgit 1.2.3-korg