CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

{{- if .Values.diagnosticMode.enabled }}
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:

  command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
  args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}

Get the list of pods by executing:

  kubectl get pods --namespace {{ template "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}

Access the pod you want to debug by executing

  kubectl exec --namespace {{ template "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash

In order to replicate the container startup scripts execute this command:

    kube-state-metrics --port=8080 --telemetry-port=8081

{{- else }}

Watch the kube-state-metrics Deployment status using the command:

    kubectl get deploy -w --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }}

kube-state-metrics can be accessed via port "{{ .Values.service.ports.http }}" on the following DNS name from within your cluster:

    {{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.cluster.local

To access kube-state-metrics from outside the cluster execute the following commands:

{{- if contains "LoadBalancer" .Values.service.type }}

    NOTE: It may take a few minutes for the LoadBalancer IP to be available.
    Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'

{{- $port:=.Values.service.ports.http | toString }}

    export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
    echo "URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.ports.http }}{{ end }}/"

{{- else if contains "ClusterIP"  .Values.service.type }}

    echo "URL: http://127.0.0.1:9100/"
    kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} 9100:{{ .Values.service.ports.http }}

{{- else if contains "NodePort" .Values.service.type }}

    export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
    export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
    echo "URL: http://$NODE_IP:$NODE_PORT/"

{{- end }}
{{- end }}

{{- include "kube-state-metrics.checkRollingTags" . }}
