From 1c1590b470667adae7c11598df268121c600bc97 Mon Sep 17 00:00:00 2001 From: Kevin Schumacher Date: Sun, 17 Sep 2017 16:23:48 -0400 Subject: [PATCH] [stable/rocketchat] #1785 namespace defined templates with chart name --- stable/rocketchat/Chart.yaml | 5 +++-- stable/rocketchat/templates/NOTES.txt | 8 ++++---- stable/rocketchat/templates/_helpers.tpl | 6 +++--- stable/rocketchat/templates/deployment.yaml | 16 ++++++++-------- stable/rocketchat/templates/ingress.yaml | 8 ++++---- stable/rocketchat/templates/pvc.yaml | 4 ++-- stable/rocketchat/templates/secrets.yaml | 4 ++-- stable/rocketchat/templates/svc.yaml | 6 +++--- 8 files changed, 29 insertions(+), 28 deletions(-) diff --git a/stable/rocketchat/Chart.yaml b/stable/rocketchat/Chart.yaml index 38f457b2efd2..72e900005ed3 100644 --- a/stable/rocketchat/Chart.yaml +++ b/stable/rocketchat/Chart.yaml @@ -1,6 +1,7 @@ name: rocketchat -version: 0.0.3 -description: Prepare to take off with the ultimate chat platform, experience the next level of team communications +version: 0.1.0 +description: Prepare to take off with the ultimate chat platform, experience the next + level of team communications keywords: - chat - communication diff --git a/stable/rocketchat/templates/NOTES.txt b/stable/rocketchat/templates/NOTES.txt index c81cb5701010..22927a69c855 100644 --- a/stable/rocketchat/templates/NOTES.txt +++ b/stable/rocketchat/templates/NOTES.txt @@ -1,18 +1,18 @@ Rocket.Chat can be accessed via port 80 on the following DNS name from within your cluster: -- http://{{ template "fullname" . }}.{{ .Release.Namespace }} +- http://{{ template "rocketchat.fullname" . }}.{{ .Release.Namespace }} You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8888 -- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8888:3000 +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rocketchat.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8888:3000 You can also connect to the container running Rocket.Chat. To open a shell session in the pod run the following: -- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{.items[0].metadata.name}') /bin/sh +- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rocketchat.name" . }},release={{ .Release.Name }}" -o jsonpath='{.items[0].metadata.name}') /bin/sh To trail the logs for the Rocket.Chat pod run the following: -- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "rocketchat.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') {{- if .Values.ingress.enabled }} diff --git a/stable/rocketchat/templates/_helpers.tpl b/stable/rocketchat/templates/_helpers.tpl index 7610d1e4beb5..4547c27da996 100644 --- a/stable/rocketchat/templates/_helpers.tpl +++ b/stable/rocketchat/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "name" -}} +{{- define "rocketchat.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 "rocketchat.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -19,6 +19,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this 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 "mongodb.fullname" -}} +{{- define "rocketchat.mongodb.fullname" -}} {{- printf "%s-%s" .Release.Name "mongodb" | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/stable/rocketchat/templates/deployment.yaml b/stable/rocketchat/templates/deployment.yaml index 8aecbf9d8fd4..771bde5f4715 100644 --- a/stable/rocketchat/templates/deployment.yaml +++ b/stable/rocketchat/templates/deployment.yaml @@ -1,9 +1,9 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -12,11 +12,11 @@ spec: template: metadata: labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} release: "{{ .Release.Name }}" spec: containers: - - name: {{ template "fullname" . }} + - name: {{ template "rocketchat.fullname" . }} image: "{{ .Values.image }}" imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} env: @@ -30,10 +30,10 @@ spec: {{ if .Values.mongodb.mongodbUsername }} valueFrom: secretKeyRef: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} key: mongo-uri {{ else }} - value: mongodb://{{ template "mongodb.fullname" . }}:27017/rocketchat + value: mongodb://{{ template "rocketchat.mongodb.fullname" . }}:27017/rocketchat {{ end }} {{ if .Values.host }} - name: ROOT_URL @@ -42,7 +42,7 @@ spec: - name: MAIL_URL valueFrom: secretKeyRef: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} key: mail-url {{- range $key, $value := .Values.config }} - name: {{ $key }} @@ -66,7 +66,7 @@ spec: - name: rocket-data {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ template "fullname" . }} + claimName: {{ template "rocketchat.fullname" . }} {{- else }} emptyDir: {} {{- end }} diff --git a/stable/rocketchat/templates/ingress.yaml b/stable/rocketchat/templates/ingress.yaml index 8248b2f15acc..a4ca05d357b0 100644 --- a/stable/rocketchat/templates/ingress.yaml +++ b/stable/rocketchat/templates/ingress.yaml @@ -2,9 +2,9 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -18,7 +18,7 @@ spec: tls: - hosts: - {{ .Values.host }} - secretName: {{ template "fullname" . }}-tls + secretName: {{ template "rocketchat.fullname" . }}-tls {{- end }} rules: - host: {{ .Values.host }} @@ -26,6 +26,6 @@ spec: paths: - path: / backend: - serviceName: {{ template "fullname" . }} + serviceName: {{ template "rocketchat.fullname" . }} servicePort: 3000 {{- end -}} diff --git a/stable/rocketchat/templates/pvc.yaml b/stable/rocketchat/templates/pvc.yaml index b62ad8db9b07..1eb87e73fe10 100644 --- a/stable/rocketchat/templates/pvc.yaml +++ b/stable/rocketchat/templates/pvc.yaml @@ -2,9 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/rocketchat/templates/secrets.yaml b/stable/rocketchat/templates/secrets.yaml index 39b5b0a6c295..673a1fe9534c 100644 --- a/stable/rocketchat/templates/secrets.yaml +++ b/stable/rocketchat/templates/secrets.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/rocketchat/templates/svc.yaml b/stable/rocketchat/templates/svc.yaml index adafe2550015..287b75ad5d50 100644 --- a/stable/rocketchat/templates/svc.yaml +++ b/stable/rocketchat/templates/svc.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ template "rocketchat.fullname" . }} labels: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -13,5 +13,5 @@ spec: port: 3000 targetPort: http selector: - app: {{ template "name" . }} + app: {{ template "rocketchat.name" . }} release: "{{ .Release.Name }}"