Skip to content

Commit 701178b

Browse files
authored
Add clsuterName to support clusters with non-default names (#236)
Signed-off-by: xirehat <xirehat@gmail.com>
1 parent a03c6f5 commit 701178b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Diff for: charts/opencost/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ keywords:
99
- finops
1010
- monitoring
1111
- opencost
12-
version: 1.43.1
12+
version: 1.43.2
1313
maintainers:
1414
- name: mattray
1515
url: https://mattray.dev

Diff for: charts/opencost/templates/_helpers.tpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ Create the name of the controller service account to use
101101
{{- else -}}
102102
{{- $host := tpl .Values.opencost.prometheus.internal.serviceName . }}
103103
{{- $ns := tpl .Values.opencost.prometheus.internal.namespaceName . }}
104+
{{- $clusterName := .Values.clusterName }}
104105
{{- $port := .Values.opencost.prometheus.internal.port | int }}
105-
{{- printf "http://%s.%s.svc.cluster.local:%d" $host $ns $port -}}
106+
{{- printf "http://%s.%s.svc.%s:%d" $host $ns $clusterName $port -}}
106107
{{- end -}}
107108
{{- end -}}
108109

@@ -115,8 +116,9 @@ Check that either thanos external or internal is defined
115116
{{- else -}}
116117
{{- $host := .Values.opencost.prometheus.thanos.internal.serviceName }}
117118
{{- $ns := .Values.opencost.prometheus.thanos.internal.namespaceName }}
119+
{{- $clusterName := .Values.clusterName }}
118120
{{- $port := .Values.opencost.prometheus.thanos.internal.port | int }}
119-
{{- printf "http://%s.%s.svc.cluster.local:%d" $host $ns $port -}}
121+
{{- printf "http://%s.%s.svc.%s:%d" $host $ns $clusterName $port -}}
120122
{{- end -}}
121123
{{- end -}}
122124

@@ -188,4 +190,4 @@ apiVersion: networking.k8s.io/v1beta1
188190
{{- else}}
189191
{{- .Values.opencost.ui.image.registry -}}/{{- .Values.opencost.ui.image.repository -}}:{{- include "opencostUi.imageTag" . -}}
190192
{{- end -}}
191-
{{- end -}}
193+
{{- end -}}

Diff for: charts/opencost/values.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ nameOverride: ""
44
fullnameOverride: ""
55
# -- Override the deployment namespace
66
namespaceOverride: ""
7+
# -- Override the default name of cluster - Can be found in /etc/kubernetes/admin.conf: clusters -> cluster -> name
8+
clusterName: "cluster.local"
79

810
loglevel: info
911

0 commit comments

Comments
 (0)