Skip to content

Commit

Permalink
Merge pull request #92 from irfanhakim-as/update-tpl
Browse files Browse the repository at this point in the history
Update template notes
  • Loading branch information
irfanhakim-as authored Jul 17, 2024
2 parents d904d4e + c0e12ab commit b6fb09d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions template/chartName/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
ChartName has been installed and configured for {{ .Release.Name | toString }} 🎉

{{- if $ingress }}
{{- $serviceAddress = printf "https://%s" $domain | toString }}
{{- $serviceAddress = printf "https://%s" $domain | toString }}
{{- else if or (eq $type "ClusterIP") (eq $type "LoadBalancer") (eq $type "NodePort") }}

Please run the following command(s) to obtain the right address to the service:

```sh
{{- if eq $type "ClusterIP" }}
{{- $forwardPort := "8080" | toString }}
{{- $serviceAddress = printf "http://127.0.0.1:%s" $forwardPort | toString }}
{{- $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 }}
{{- $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 }}
{{- $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 }} {{ $serviceName }} -o jsonpath="{.spec.ports[0].nodePort}")
{{- end }}
```

{{- end }}

{{- if $serviceAddress }}
Visit the following service(s) at the provided address:

Visit the following service at the provided address:
{{- if $serviceAddress }}

- ChartName: {{ $serviceAddress }}

Expand Down

0 comments on commit b6fb09d

Please sign in to comment.