From a6cc26fc0b64b55af0733efd780d40d204bf7e82 Mon Sep 17 00:00:00 2001 From: vaibhav Date: Mon, 9 Apr 2018 07:03:53 +0000 Subject: Helm Chart Standardization Sniro-Emulator(Mock) This task also includes renaming of mock project into sniro-emulator Issue-ID: OOM-741 Change-Id: Ib0352f7ecb10019f940c571de073dc0af7056ee5 Signed-off-by: vaibhav --- kubernetes/mock/Chart.yaml | 18 ----- kubernetes/mock/templates/all-services.yaml | 33 ---------- .../mock/templates/sniroemulator-deployment.yaml | 41 ------------ kubernetes/mock/values.yaml | 20 ------ kubernetes/onap/requirements.yaml | 6 +- kubernetes/onap/resources/environments/dev.yaml | 2 +- .../resources/environments/disable-allcharts.yaml | 2 +- kubernetes/onap/values.yaml | 4 +- kubernetes/sniro-emulator/.helmignore | 21 ++++++ kubernetes/sniro-emulator/Chart.yaml | 18 +++++ kubernetes/sniro-emulator/requirements.yaml | 21 ++++++ kubernetes/sniro-emulator/templates/NOTES.txt | 34 ++++++++++ .../sniro-emulator/templates/deployment.yaml | 62 ++++++++++++++++++ kubernetes/sniro-emulator/templates/service.yaml | 40 ++++++++++++ kubernetes/sniro-emulator/values.yaml | 76 ++++++++++++++++++++++ 15 files changed, 278 insertions(+), 120 deletions(-) delete mode 100644 kubernetes/mock/Chart.yaml delete mode 100644 kubernetes/mock/templates/all-services.yaml delete mode 100644 kubernetes/mock/templates/sniroemulator-deployment.yaml delete mode 100644 kubernetes/mock/values.yaml create mode 100644 kubernetes/sniro-emulator/.helmignore create mode 100644 kubernetes/sniro-emulator/Chart.yaml create mode 100644 kubernetes/sniro-emulator/requirements.yaml create mode 100644 kubernetes/sniro-emulator/templates/NOTES.txt create mode 100644 kubernetes/sniro-emulator/templates/deployment.yaml create mode 100644 kubernetes/sniro-emulator/templates/service.yaml create mode 100644 kubernetes/sniro-emulator/values.yaml (limited to 'kubernetes') diff --git a/kubernetes/mock/Chart.yaml b/kubernetes/mock/Chart.yaml deleted file mode 100644 index e5d38b65f8..0000000000 --- a/kubernetes/mock/Chart.yaml +++ /dev/null @@ -1,18 +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. - -apiVersion: v1 -description: A Helm chart for Kubernetes -name: mock -version: 0.1.0 diff --git a/kubernetes/mock/templates/all-services.yaml b/kubernetes/mock/templates/all-services.yaml deleted file mode 100644 index 4c566eeed2..0000000000 --- a/kubernetes/mock/templates/all-services.yaml +++ /dev/null @@ -1,33 +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.disableMockSniroEmulator }} -apiVersion: v1 -kind: Service -metadata: - name: sniro-emulator - namespace: "{{ .Values.nsPrefix }}" - labels: - app: sniro-emulator -spec: - type: NodePort - ports: - - port: 80 - nodePort: {{ .Values.nodePortPrefix }}88 - targetPort: 9999 - protocol: TCP - name: http - selector: - app: sniro-emulator -#{{ end }} \ No newline at end of file diff --git a/kubernetes/mock/templates/sniroemulator-deployment.yaml b/kubernetes/mock/templates/sniroemulator-deployment.yaml deleted file mode 100644 index cd0da9fd78..0000000000 --- a/kubernetes/mock/templates/sniroemulator-deployment.yaml +++ /dev/null @@ -1,41 +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.disableMockSniroEmulator }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: sniro-emulator - namespace: "{{ .Values.nsPrefix }}" -spec: - selector: - matchLabels: - app: sniro-emulator - replicas: 1 - template: - metadata: - labels: - app: sniro-emulator - name: sniro-emulator - spec: - containers: - - image: "{{ .Values.image.onapmock }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.pullPolicy }} - name: sniro-emulator - ports: - - containerPort: 9999 - args: ["--verbose"] - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/kubernetes/mock/values.yaml b/kubernetes/mock/values.yaml deleted file mode 100644 index 809ad90d3b..0000000000 --- a/kubernetes/mock/values.yaml +++ /dev/null @@ -1,20 +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. - -nsPrefix: onap -pullPolicy: Always -nodePortPrefix: 302 -image: - onapmock: nexus3.onap.org:10001/onap/sniroemulator - tag: latest diff --git a/kubernetes/onap/requirements.yaml b/kubernetes/onap/requirements.yaml index 03ee94db6e..97bcea47b0 100644 --- a/kubernetes/onap/requirements.yaml +++ b/kubernetes/onap/requirements.yaml @@ -60,10 +60,10 @@ dependencies: version: ~2.0.0 repository: '@local' condition: log.enabled - - name: mock - version: ~0.1.0 + - name: sniro-emulator + version: ~2.0.0 repository: '@local' - condition: mock.enabled + condition: sniro-emulator.enabled - name: msb version: ~2.0.0 repository: '@local' diff --git a/kubernetes/onap/resources/environments/dev.yaml b/kubernetes/onap/resources/environments/dev.yaml index 44245edffd..e8d1eb1392 100644 --- a/kubernetes/onap/resources/environments/dev.yaml +++ b/kubernetes/onap/resources/environments/dev.yaml @@ -70,7 +70,7 @@ esr: enabled: false log: enabled: false -mock: +sniro-emulator: enabled: false oof: enabled: false diff --git a/kubernetes/onap/resources/environments/disable-allcharts.yaml b/kubernetes/onap/resources/environments/disable-allcharts.yaml index 819cc7a2ab..0f669beaab 100644 --- a/kubernetes/onap/resources/environments/disable-allcharts.yaml +++ b/kubernetes/onap/resources/environments/disable-allcharts.yaml @@ -45,7 +45,7 @@ esr: enabled: false log: enabled: false -mock: +sniro-emulator: enabled: false msb: enabled: false diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml index cffff73392..d0b06630fd 100644 --- a/kubernetes/onap/values.yaml +++ b/kubernetes/onap/values.yaml @@ -85,9 +85,7 @@ esr: enabled: true log: enabled: true -message-router: - enabled: true -mock: +sniro-emulator: enabled: true oof: enabled: true diff --git a/kubernetes/sniro-emulator/.helmignore b/kubernetes/sniro-emulator/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/kubernetes/sniro-emulator/.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/sniro-emulator/Chart.yaml b/kubernetes/sniro-emulator/Chart.yaml new file mode 100644 index 0000000000..8916167b7e --- /dev/null +++ b/kubernetes/sniro-emulator/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: ONAP Mock Sniro Emulator +name: sniro-emulator +version: 2.0.0 diff --git a/kubernetes/sniro-emulator/requirements.yaml b/kubernetes/sniro-emulator/requirements.yaml new file mode 100644 index 0000000000..f639633537 --- /dev/null +++ b/kubernetes/sniro-emulator/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/sniro-emulator/templates/NOTES.txt b/kubernetes/sniro-emulator/templates/NOTES.txt new file mode 100644 index 0000000000..409d59e470 --- /dev/null +++ b/kubernetes/sniro-emulator/templates/NOTES.txt @@ -0,0 +1,34 @@ +{{/* +# Copyright © 2017 Amdocs, AT&T, 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. +*/}} +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/sniro-emulator/templates/deployment.yaml b/kubernetes/sniro-emulator/templates/deployment.yaml new file mode 100644 index 0000000000..da5266a1ca --- /dev/null +++ b/kubernetes/sniro-emulator/templates/deployment.yaml @@ -0,0 +1,62 @@ +# 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: "{{ include "common.repository" . }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + {{ if .Values.liveness.enabled }} + 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 }} + 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/sniro-emulator/templates/service.yaml b/kubernetes/sniro-emulator/templates/service.yaml new file mode 100644 index 0000000000..73edbd96f3 --- /dev/null +++ b/kubernetes/sniro-emulator/templates/service.yaml @@ -0,0 +1,40 @@ +# 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.servicename" . }} + 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.portName | default "http" }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName | default "http" }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} diff --git a/kubernetes/sniro-emulator/values.yaml b/kubernetes/sniro-emulator/values.yaml new file mode 100644 index 0000000000..389696061b --- /dev/null +++ b/kubernetes/sniro-emulator/values.yaml @@ -0,0 +1,76 @@ +# 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. + +################################################################# +# Global configuration defaults. +################################################################# +global: # global defaults + nodePortPrefix: 302 + +# application image +repository: nexus3.onap.org:10001 +image: onap/sniroemulator +pullPolicy: IfNotPresent + +# flag to enable debugging - application support required +debugEnabled: false + +# 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: sniro-emulator + internalPort: 9999 + externalPort: 80 + nodePort: 88 + portName: httpd + +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