-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from irfanhakim-as/template-update
Update template chart notes with accessible service address
- Loading branch information
Showing
1 changed file
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
{{- $ingress := .Values.ingress.enabled }} | ||
{{- $domain := .Values.chartName.domain | toString }} | ||
ChartName is now installed and configured for {{ .Release.Name | toString }}. | ||
{{- $port := .Values.service.port | default "80" | toString }} | ||
{{- $type := .Values.service.type | default "ClusterIP" | toString }} | ||
{{- $serviceName := printf "%s-chartName-svc" .Release.Name | toString }} | ||
{{- $serviceAddress := "" }} | ||
ChartName has been installed and configured for {{ .Release.Name | toString }} 🎉 | ||
|
||
Visit the following service to get started: | ||
{{- if $ingress }} | ||
{{- $serviceAddress = printf "https://%s" $domain | toString }} | ||
{{- else if or (eq $type "ClusterIP") (eq $type "LoadBalancer") (eq $type "NodePort") }} | ||
|
||
ChartName: {{ if $ingress }}https://{{ $domain }}{{- else }}Please refer to the {{ .Release.Name }}-chartName-svc service for the right address{{- end }} | ||
Please run the following command(s) to obtain the right address to the service: | ||
|
||
For more information on how to use and configure ChartName, please refer to the official documentation. | ||
```sh | ||
{{- if eq $type "ClusterIP" }} | ||
{{- $forwardPort := "8080" | toString }} | ||
{{- $serviceAddress = printf "http://127.0.0.1:%s" $forwardPort | toString }} | ||
export POD_NAME=$(kubectl get pod --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chartName.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}") | ||
kubectl port-forward --namespace {{ .Release.Namespace }} ${POD_NAME} {{ $forwardPort }}:${CONTAINER_PORT} | ||
{{- else if eq $type "LoadBalancer" }} | ||
{{- $serviceAddress = printf "$(echo http://${SERVICE_IP}:%s)" $port | toString }} | ||
export SERVICE_IP=$(kubectl get service --namespace {{ .Release.Namespace }} {{ $serviceName }} --template "{{"{{- range (index .status.loadBalancer.ingress 0) }}{{ . }}{{- end }}"}}") | ||
{{- else if eq $type "NodePort" }} | ||
{{- $serviceAddress = "$(echo http://${NODE_IP}:${NODE_PORT})" | toString }} | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
export NODE_PORT=$(kubectl get service --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" {{ $serviceName }}) | ||
{{- end }} | ||
``` | ||
|
||
{{- end }} | ||
|
||
{{- if $serviceAddress }} | ||
|
||
Visit the following service at the provided address: | ||
|
||
- ChartName: {{ $serviceAddress }} | ||
|
||
{{- else }} | ||
|
||
⚠️ This chart may have no accessible services available | ||
|
||
{{- end }} | ||
|
||
For more information on how to use and configure ChartName, please refer to the official documentation. |