From 234de4e261f573455c52352e911ab7904ec100d7 Mon Sep 17 00:00:00 2001 From: Kevin Schumacher Date: Wed, 23 Aug 2017 17:34:25 -0400 Subject: [PATCH] [incubator/check-mk] #1785 namespace defined templates with chart name --- incubator/check-mk/Chart.yaml | 2 +- incubator/check-mk/templates/NOTES.txt | 8 ++++---- incubator/check-mk/templates/_helpers.tpl | 4 ++-- incubator/check-mk/templates/deployment.yaml | 6 +++--- incubator/check-mk/templates/ingress.yaml | 6 +++--- incubator/check-mk/templates/service.yaml | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/incubator/check-mk/Chart.yaml b/incubator/check-mk/Chart.yaml index d8490897bf79..7c912cb5da59 100755 --- a/incubator/check-mk/Chart.yaml +++ b/incubator/check-mk/Chart.yaml @@ -14,4 +14,4 @@ name: check-mk sources: - https://github.com/kubernetes/charts - http://git.mathias-kettner.de/git/ -version: 0.1.0 +version: 0.2.0 diff --git a/incubator/check-mk/templates/NOTES.txt b/incubator/check-mk/templates/NOTES.txt index 18915704d360..77cf3dcef2c5 100755 --- a/incubator/check-mk/templates/NOTES.txt +++ b/incubator/check-mk/templates/NOTES.txt @@ -2,16 +2,16 @@ {{- if .Values.ingress.hostname }} http://{{- .Values.ingress.hostname }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "check-mk.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT/mva/check_mk {{- 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 {{ template "fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get svc -w {{ template "check-mk.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "check-mk.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.externalPort }}/mva/check_mk {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "check-mk.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:5000 to use your application" kubectl port-forward $POD_NAME 5000:{{ .Values.service.externalPort }}/mva/check_mk {{- end }} diff --git a/incubator/check-mk/templates/_helpers.tpl b/incubator/check-mk/templates/_helpers.tpl index f0d83d2edba6..568cd79c45ca 100755 --- a/incubator/check-mk/templates/_helpers.tpl +++ b/incubator/check-mk/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "name" -}} +{{- define "check-mk.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -10,7 +10,7 @@ Expand the name of the chart. Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "fullname" -}} +{{- define "check-mk.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/incubator/check-mk/templates/deployment.yaml b/incubator/check-mk/templates/deployment.yaml index d15e0f349d01..a4d8b73003ed 100755 --- a/incubator/check-mk/templates/deployment.yaml +++ b/incubator/check-mk/templates/deployment.yaml @@ -1,9 +1,9 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ template "fullname" . }} + name: {{ template "check-mk.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "check-mk.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} @@ -12,7 +12,7 @@ spec: template: metadata: labels: - app: {{ template "name" . }} + app: {{ template "check-mk.name" . }} release: {{ .Release.Name }} spec: containers: diff --git a/incubator/check-mk/templates/ingress.yaml b/incubator/check-mk/templates/ingress.yaml index b09eb9075adb..6df0f6cd27c5 100755 --- a/incubator/check-mk/templates/ingress.yaml +++ b/incubator/check-mk/templates/ingress.yaml @@ -1,12 +1,12 @@ {{- if .Values.ingress.enabled -}} -{{- $serviceName := include "fullname" . -}} +{{- $serviceName := include "check-mk.fullname" . -}} {{- $servicePort := .Values.service.externalPort -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: {{ template "fullname" . }} + name: {{ template "check-mk.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "check-mk.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} diff --git a/incubator/check-mk/templates/service.yaml b/incubator/check-mk/templates/service.yaml index f311d10a0d22..eb315d06aa94 100755 --- a/incubator/check-mk/templates/service.yaml +++ b/incubator/check-mk/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ template "check-mk.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "check-mk.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} @@ -15,5 +15,5 @@ spec: protocol: TCP name: {{ .Values.service.name }} selector: - app: {{ template "name" . }} + app: {{ template "check-mk.name" . }} release: {{ .Release.Name }}