diff --git a/petclinic-chart/templates/NOTES.txt b/petclinic-chart/templates/NOTES.txt index d6b9591bf..b66c54da2 100644 --- a/petclinic-chart/templates/NOTES.txt +++ b/petclinic-chart/templates/NOTES.txt @@ -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 "petclinic_chart.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "petclinic-chart.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 "petclinic_chart.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "petclinic_chart.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 "petclinic-chart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "petclinic-chart.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 "petclinic_chart.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 "petclinic-chart.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 diff --git a/petclinic-chart/templates/_helpers.tpl b/petclinic-chart/templates/_helpers.tpl index 651a411d7..1784cd08b 100644 --- a/petclinic-chart/templates/_helpers.tpl +++ b/petclinic-chart/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "petclinic_chart.name" -}} +{{- define "petclinic-chart.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -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 "petclinic_chart.fullname" -}} +{{- define "petclinic-chart.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -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 "petclinic_chart.chart" -}} +{{- define "petclinic-chart.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "petclinic_chart.labels" -}} -helm.sh/chart: {{ include "petclinic_chart.chart" . }} -{{ include "petclinic_chart.selectorLabels" . }} +{{- define "petclinic-chart.labels" -}} +helm.sh/chart: {{ include "petclinic-chart.chart" . }} +{{ include "petclinic-chart.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "petclinic_chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "petclinic_chart.name" . }} +{{- define "petclinic-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "petclinic-chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "petclinic_chart.serviceAccountName" -}} +{{- define "petclinic-chart.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "petclinic_chart.fullname" .) .Values.serviceAccount.name }} +{{- default (include "petclinic-chart.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/petclinic-chart/templates/deployment.yaml b/petclinic-chart/templates/deployment.yaml index ca0874e84..c9266af12 100644 --- a/petclinic-chart/templates/deployment.yaml +++ b/petclinic-chart/templates/deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "petclinic_chart.fullname" . }} + name: {{ include "petclinic-chart.fullname" . }} labels: - {{- include "petclinic_chart.labels" . | nindent 4 }} + {{- include "petclinic-chart.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "petclinic_chart.selectorLabels" . | nindent 6 }} + {{- include "petclinic-chart.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -18,7 +18,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "petclinic_chart.selectorLabels" . | nindent 8 }} + {{- include "petclinic-chart.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -33,4 +33,4 @@ spec: ports: - name: http containerPort: 8080 - protocol: TCP + protocol: TCP \ No newline at end of file diff --git a/petclinic-chart/templates/service.yaml b/petclinic-chart/templates/service.yaml index 55762e629..81d3c0fd6 100644 --- a/petclinic-chart/templates/service.yaml +++ b/petclinic-chart/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "petclinic_chart.fullname" . }} + name: {{ include "petclinic-chart.fullname" . }} labels: - {{- include "petclinic_chart.labels" . | nindent 4 }} + {{- include "petclinic-chart.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "petclinic_chart.selectorLabels" . | nindent 4 }} + {{- include "petclinic-chart.selectorLabels" . | nindent 4 }} diff --git a/petclinic-chart/values.yaml b/petclinic-chart/values.yaml index 464bf3117..cb13e6171 100644 --- a/petclinic-chart/values.yaml +++ b/petclinic-chart/values.yaml @@ -1,4 +1,4 @@ -# Default values for petclinic_chart. +# Default values for petclinic-chart. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -14,6 +14,15 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +serviceAccount: + # Specifies whether a service account should be created + create: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + podAnnotations: {} podSecurityContext: {}