Skip to content

Commit

Permalink
Fixing helpers.tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Montesinos authored and Carlos Montesinos committed Sep 5, 2023
1 parent 4556628 commit 19e1008
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 381 deletions.
517 changes: 248 additions & 269 deletions docs/index.yaml

Large diffs are not rendered by default.

Binary file modified docs/queue-consumer-service-1.0.0.tgz
Binary file not shown.
Binary file removed docs/queue-consumer-service-1.0.1.tgz
Binary file not shown.
Binary file removed docs/queue-service-consumer-1.0.4.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion queue-consumer-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.1
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
8 changes: 4 additions & 4 deletions queue-consumer-service/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "queue-service-consumer.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "queue-consumer-service.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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "queue-service-consumer.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "queue-service-consumer.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "queue-consumer-service.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "queue-consumer-service.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "queue-service-consumer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "queue-consumer-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
20 changes: 10 additions & 10 deletions queue-consumer-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "queue-service-consumer.name" -}}
{{- define "queue-consumer-service.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "queue-service-consumer.fullname" -}}
{{- define "queue-consumer-service.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "queue-service-consumer.chart" -}}
{{- define "queue-consumer-service.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "queue-service-consumer.labels" -}}
helm.sh/chart: {{ include "queue-service-consumer.chart" . }}
{{ include "queue-service-consumer.selectorLabels" . }}
{{- define "queue-consumer-service.labels" -}}
helm.sh/chart: {{ include "queue-consumer-service.chart" . }}
{{ include "queue-consumer-service.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "queue-service-consumer.selectorLabels" -}}
app.kubernetes.io/name: {{ include "queue-service-consumer.name" . }}
{{- define "queue-consumer-service.selectorLabels" -}}
app.kubernetes.io/name: {{ include "queue-consumer-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "queue-service-consumer.serviceAccountName" -}}
{{- define "queue-consumer-service.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "queue-service-consumer.fullname" .) .Values.serviceAccount.name }}
{{- default (include "queue-consumer-service.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
15 changes: 4 additions & 11 deletions queue-consumer-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@ metadata:
name: {{ include "queue-consumer-service.fullname" . }}
labels:
{{- include "queue-consumer-service.labels" . | nindent 4 }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if .Values.updateStrategy }}
strategy:
{{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
Expand All @@ -32,9 +24,9 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ .Values.serviceAccount.name }}
{{- end }}
serviceAccountName: {{ include "queue-consumer-service.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down Expand Up @@ -216,3 +208,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

12 changes: 5 additions & 7 deletions queue-consumer-service/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{{- if .Values.service.targetPort }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "queue-service.fullname" . }}
name: {{ include "queue-consumer-service.fullname" . }}
labels:
{{- include "queue-service.labels" . | nindent 4 }}
{{- include "queue-consumer-service.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
targetPort: http
protocol: TCP
name: {{ include "queue-service.fullname" . }}
name: http
selector:
{{- include "queue-service.selectorLabels" . | nindent 4 }}
{{- end }}
{{- include "queue-consumer-service.selectorLabels" . | nindent 4 }}
10 changes: 2 additions & 8 deletions queue-consumer-service/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range $key, $secret := .Values.imagePullSecrets }}
- name: {{ $secret.name }}
{{- end }}
{{- end }}
kind: ServiceAccount
metadata:
name: {{ include "queue-service.serviceAccountName" . }}
name: {{ include "queue-consumer-service.serviceAccountName" . }}
labels:
{{- include "queue-service.labels" . | nindent 4 }}
{{- include "queue-consumer-service.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
6 changes: 3 additions & 3 deletions queue-consumer-service/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "queue-service-consumer.fullname" . }}-test-connection"
name: "{{ include "queue-consumer-service.fullname" . }}-test-connection"
labels:
{{- include "queue-service-consumer.labels" . | nindent 4 }}
{{- include "queue-consumer-service.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "queue-service-consumer.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "queue-consumer-service.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
68 changes: 0 additions & 68 deletions queue-service-consumer/values.yaml

This file was deleted.

0 comments on commit 19e1008

Please sign in to comment.