Skip to content

Commit 93a0a45

Browse files
feat(ksm): ksmurl from global (#439)
* feat(ksm): ksmurl from global * feat(ksm): argus version bump * feat(ksm): revert lmc for version * feat(ksm): argus version bump
1 parent ae4ae26 commit 93a0a45

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

charts/argus/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ maintainers:
66
77
name: LogicMonitor
88
name: argus
9-
version: 11.1.0-rc03
9+
version: 11.1.0-rc04
1010
home: https://logicmonitor.github.io/helm-charts-qa
1111
appVersion: v15.1.0-rc03
1212
dependencies:

charts/argus/templates/_argus_config.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ proxy:
7676
proxy:
7777
url: {{ .Values.global.proxy.url }}
7878
{{- end }}
79-
ksmUrl: {{ include "ksm-url" . }}
79+
ksmUrl: {{ include "ksm-url" . | quote }}
8080
{{- end -}}

charts/argus/templates/_helpers.tpl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,28 @@ Collector Pod security context
119119

120120
{{- define "ksm-url" -}}
121121
{{- $url := "" }}
122-
{{- $ksm := index .Values "kube-state-metrics" }}
122+
{{- $ksm := index .Values.global "kube-state-metrics" }}
123123
{{- if not (empty .Values.ksmUrl) }}
124124
{{- $url = .Values.ksmUrl }}
125125
{{- else if $ksm.enabled }}
126-
{{- $port := "" }}
127-
{{- range $p := .Release.Service.spec.ports }}
126+
{{- $port := 8080 }}
127+
{{- $url = printf "http://%s-kube-state-metrics.%s.svc.cluster.local:%d/metrics" .Release.Name .Release.Namespace $port }}
128+
{{- else }}
129+
{{- $nsservices := (lookup "v1" "Service" .Release.Namespace "") | default dict }}
130+
{{- $nsfilteredServices := dict "items" (list) }}
131+
{{- range $service := $nsservices.items }}
132+
{{- if eq (index $service.metadata.labels "app.kubernetes.io/name" | default "") "kube-state-metrics" }}
133+
{{- $_ := set $nsfilteredServices "items" (append $nsfilteredServices.items $service) }}
134+
{{- $port := "" }}
135+
{{- range $p := $service.spec.ports }}
128136
{{- if or (eq $p.name "http") (eq $p.name "http-metrics") }}
129137
{{- $port = $p.port }}
130138
{{- end }}
131139
{{- end }}
132-
{{- $url = printf "http://%s-kube-state-metrics.%s.svc.cluster.local:%d/metrics" .Release.metadata.name .Release.Namespace $port }}
133-
{{- else }}
140+
{{- $url = printf "http://%s.%s.svc.cluster.local:%d/metrics" $service.metadata.name $service.metadata.namespace $port }}
141+
{{- end }}
142+
{{- end }}
143+
{{- if (empty $url)}}
134144
{{- $services := (lookup "v1" "Service" "" "") | default dict }}
135145
{{- $filteredServices := dict "items" (list) }}
136146
{{- range $service := $services.items }}
@@ -146,6 +156,7 @@ Collector Pod security context
146156
{{- end }}
147157
{{- end }}
148158
{{- end }}
159+
{{- end }}
149160
{{- $url }}
150161
{{- end }}
151162

charts/argus/values.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,14 @@
23352335
"default": "",
23362336
"description" : "The Logicmonitor account domain"
23372337
},
2338+
"kube-state-metrics": {
2339+
"$id": "#/properties/global/properties/kube-state-metrics",
2340+
"type": "object",
2341+
"title": "Kube state metrics config",
2342+
"description": "Kube state metrics.",
2343+
"additionalItems": true,
2344+
"additionalProperties": true
2345+
},
23382346
"imagePullSecrets": {
23392347
"description": "ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. For example, in the case of docker, only DockerConfig type secrets are honored. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod",
23402348
"examples": [

0 commit comments

Comments
 (0)