Skip to content

Commit af39c19

Browse files
feat(ksm): dev-178733 add ksm category (#434)
* feat(ksm): ksm url fetch * feat(ksm): ksm url param added * feat(ksm): version update
1 parent 0c2f211 commit af39c19

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

charts/argus/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ maintainers:
66
77
name: LogicMonitor
88
name: argus
9-
version: 11.0.0-rt01
9+
version: 11.1.0-rc01
1010
home: https://logicmonitor.github.io/helm-charts-qa
11-
appVersion: v15.0.0-rt01
11+
appVersion: v15.1.0-rc01
1212
dependencies:
1313
- name: lmutil
1414
repository: https://logicmonitor.github.io/helm-charts-qa

charts/argus/templates/_argus_config.tpl

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

charts/argus/templates/_helpers.tpl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,38 @@ Collector Pod security context
117117
{{ toYaml .Values.collector.podSecurityContext | nindent 0 }}
118118
{{- end }}
119119

120+
{{- define "ksm-url" -}}
121+
{{- $url := "" }}
122+
{{- $ksm := index .Values "kube-state-metrics" }}
123+
{{- if .Values.ksmUrl }}
124+
{{- $url = .Values.ksmUrl }}
125+
{{- else if $ksm.enabled }}
126+
{{- $port := "" }}
127+
{{- range $p := .Release.Service.spec.ports }}
128+
{{- if or (eq $p.name "http") (eq $p.name "http-metrics") }}
129+
{{- $port = $p.port }}
130+
{{- end }}
131+
{{- end }}
132+
{{- $url = printf "http://%s-kube-state-metrics.%s.svc.cluster.local:%d/metrics" .Release.metadata.name .Release.Namespace $port }}
133+
{{- else }}
134+
{{- $services := (lookup "v1" "Service" "" "") | default dict }}
135+
{{- $filteredServices := dict "items" (list) }}
136+
{{- range $service := $services.items }}
137+
{{- if eq (index $service.metadata.labels "app.kubernetes.io/name" | default "") "kube-state-metrics" }}
138+
{{- $_ := set $filteredServices "items" (append $filteredServices.items $service) }}
139+
{{- $port := "" }}
140+
{{- range $p := $service.spec.ports }}
141+
{{- if or (eq $p.name "http") (eq $p.name "http-metrics") }}
142+
{{- $port = $p.port }}
143+
{{- end }}
144+
{{- end }}
145+
{{- $url = printf "http://%s.%s.svc.cluster.local:%d/metrics" $service.metadata.name $service.metadata.namespace $port }}
146+
{{- end }}
147+
{{- end }}
148+
{{- end }}
149+
{{- $url }}
150+
{{- end }}
151+
120152
{{- define "collector-csp" }}
121153
{{- $addCaps := .Values.collector.securityContext.capabilities.add }}
122154
{{- if and (eq (include "lmutil.get-platform" .) "gke") (not (has "NET_RAW" $addCaps)) }}

charts/argus/values.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,16 @@
461461
},
462462
"$comment": "tf:optional,yamlencode"
463463
},
464+
"ksmUrl": {
465+
"$id": "#/properties/ksmUrl",
466+
"type": "string",
467+
"title": "KSM service URL",
468+
"description": "KSM service URL to be used by devices in the portal",
469+
"default": "",
470+
"examples": [
471+
"http://lmc-kube-state-metrics.logicmonitor.svc.cluster.local:8080/metrics"
472+
]
473+
},
464474
"replicas": {
465475
"$id": "#/properties/replicas",
466476
"type": "integer",

charts/argus/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ resourceContainerID: 1
6464
log:
6565
level: "info"
6666

67+
ksmUrl: ""
68+
6769
collectorsetcontroller:
6870
address: collectorset-controller
6971
port: 50000

0 commit comments

Comments
 (0)