Skip to content

Commit

Permalink
[stable/sensu] helm#1785 namespace defined templates with chart name (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinschumacher authored and Dhilip committed Oct 4, 2017
1 parent 683d86a commit 170db8f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion stable/sensu/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: sensu
version: 0.1.3
version: 0.2.0
description: Sensu monitoring framework backed by the Redis transport
keywords:
- sensu
Expand Down
8 changes: 4 additions & 4 deletions stable/sensu/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Getting Started:

1. Get the Sensu API URL to visit by running these commands in the same shell:
{{- if contains "NodePort" .Values.serviceType }}
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 "sensu.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT

{{- else if contains "LoadBalancer" .Values.serviceType }}
**** 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 "sensu.fullname" . }}' ****
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "sensu.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.httpPort }}/login
{{- else if contains "ClusterIP" .Values.serviceType }}
echo 'API endpoints docs at https://sensuapp.org/docs/0.24/api/health-and-info-api.html'
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "sensu.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:4567/info
kubectl port-forward $POD_NAME 4567:4567
{{- end }}
6 changes: 3 additions & 3 deletions stable/sensu/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- define "sensu.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
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 "redis.fullname" -}}
{{- define "sensu.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
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 "sensu.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
12 changes: 6 additions & 6 deletions stable/sensu/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
name: {{ template "sensu.fullname" . }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
Expand All @@ -11,7 +11,7 @@ spec:
template:
metadata:
labels:
app: {{ template "fullname" . }}
app: {{ template "sensu.fullname" . }}
release: {{ .Release.Name | quote }}
spec:
containers:
Expand All @@ -28,11 +28,11 @@ spec:
- name: API_PORT
value: '4567'
- name: REDIS_HOST
value: {{ template "redis.fullname" . }}
value: {{ template "sensu.redis.fullname" . }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.fullname" . }}
name: {{ template "sensu.redis.fullname" . }}
key: redis-password
- name: REDIS_DB
value: {{ .Values.REDIS_DB | quote }}
Expand All @@ -51,11 +51,11 @@ spec:
{{ toYaml .Values.api.resources | indent 10 }}
env:
- name: REDIS_HOST
value: {{ template "redis.fullname" . }}
value: {{ template "sensu.redis.fullname" . }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redis.fullname" . }}
name: {{ template "sensu.redis.fullname" . }}
key: redis-password
- name: REDIS_DB
value: {{ .Values.REDIS_DB | quote }}
Expand Down
4 changes: 2 additions & 2 deletions stable/sensu/templates/svc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
name: {{ template "sensu.fullname" . }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
Expand All @@ -17,4 +17,4 @@ spec:
- port: {{ .Values.httpPort }}
targetPort: 4567
selector:
app: {{ template "fullname" . }}
app: {{ template "sensu.fullname" . }}

0 comments on commit 170db8f

Please sign in to comment.