Access to the DNS Server and Dashboard by running these commands:
{{- if .Values.admin.ingress.enabled }}
  http://{{ .Values.admin.ingress.hostname }}.{{ .Values.powerdns.domain }}{{ .Values.admin.ingress.path }}
{{- end }}
{{- if eq .Values.service.dns.tcp.type "NodePort" }}
  export NODE_PORT=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "powerdns.fullname" . }})-service-dns-tcp
  export NODE_IP=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get nodes -o jsonpath="{.items[0].status.addresses[0].address}")
  echo Point your DNS client to $NODE_IP:$NODE_PORT
{{- end }}
{{- if eq .Values.admin.service.type "NodePort" }}
  export NODE_PORT=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "powerdns.fullname" . }})-service-admin
  export NODE_IP=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get nodes -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
  echo Dashboard access at http://$SERVICE_IP2:{{ .Values.admin.service.port }}
{{- end }}

{{- if eq .Values.service.dns.tcp.type "LoadBalancer" }}
     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
           You can watch the status of by running 'kubectl {{ if .Release.Namespace }} -n {{.Release.Namespace}} {{ end }} get svc -w {{ template "powerdns.fullname" . }}'
  export SERVICE_IP1=$(kubectl {{ if .Release.Namespace }} -n {{.Release.Namespace}} {{ end }} get svc {{ template "powerdns.fullname" . }}-service-dns-tcp -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  export SERVICE_IP2=$(kubectl {{ if .Release.Namespace }} -n {{.Release.Namespace}} {{ end }} get svc {{ template "powerdns.fullname" . }}-service-admin -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  echo Point your DNS client to $SERVICE_IP1:{{ .Values.service.dns.tcp.port }}
  echo Dashboard access at http://$SERVICE_IP2:{{ .Values.admin.service.port }}
{{- end }}

{{- if contains "ClusterIP" .Values.service.dns.tcp.type }}
  export POD_NAME=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get pods -l "app={{ template "powerdns.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
  echo "Point your DNS client to 127.0.0.1:53"
  kubectl port-forward $POD_NAME 53:53
{{- end }}
{{- if contains "ClusterIP" .Values.admin.service.type }}
  export POD_NAME=$(kubectl {{- if .Release.Namespace }} -n {{.Release.Namespace}} {{ end -}} get pods -l "app={{ template "powerdns.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use the dashboard"
  kubectl port-forward $POD_NAME 8080:80
{{- end }}
