Skip to content

Commit 2cee377

Browse files
committed
modified the chart 4.21 and added support for the vmservice scrape and vmrule
1 parent bc26d40 commit 2cee377

18 files changed

+437
-17
lines changed

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/app-values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,4 +527,6 @@ hostAliases: []
527527
# - "bar.remote"
528528

529529
verticalPodScaling:
530-
enabled: false
530+
enabled: false
531+
532+
MetricsScraper: Prometheus

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/_helpers.tpl

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,41 @@ Create chart name and version as used by the chart label.
164164
{{- $LabelsContain = true -}}
165165
{{- end }}
166166
{{- $LabelsContain -}}
167-
{{- end -}}
167+
{{- end -}}
168+
169+
{{- define "vmserviceScrapeEnabled" -}}
170+
{{- $SMenabled := false -}}
171+
{{- range .Values.ContainerPort }}
172+
{{- if .vmservicescrape }}
173+
{{- if and .vmservicescrape.enabled }}
174+
{{- $SMenabled = true -}}
175+
{{- end }}
176+
{{- end }}
177+
{{- end }}
178+
{{- $SMenabled -}}
179+
{{- end -}}
180+
181+
182+
{{- define "podMonitorEnabled" -}}
183+
{{- $SMenabled := false -}}
184+
{{- if .Values.podmonitor.enabled }}
185+
{{- $SMenabled = true -}}
186+
{{- end }}
187+
{{- $SMenabled -}}
188+
{{- end -}}
189+
190+
191+
{{- define "scrapeType" -}}
192+
{{- $ServiceMonitorEnabled := include "serviceMonitorEnabled" . -}}
193+
{{- $VmServiceScrapeEnabled := include "vmserviceScrapeEnabled" . -}}
194+
{{- $val1 := "vmservicescrape"}}
195+
{{- $val2 := "servicemonitor"}}
196+
{{- if and (eq $VmServiceScrapeEnabled "true") (eq $ServiceMonitorEnabled "true")}}
197+
{{- $val1 }}
198+
{{- else if eq $ServiceMonitorEnabled "true" }}
199+
{{- $val2 }}
200+
{{- else if eq $VmServiceScrapeEnabled "true" }}
201+
{{- $val1 }}
202+
{{- end }}
203+
204+
{{- end }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{{- if $.Values.appMetrics -}}
2+
{{- if eq .Values.MetricsScraper "Victoria" }}
3+
apiVersion: operator.victoriametrics.com/v1beta1
4+
kind: VMServiceScrape
5+
{{- else if eq .Values.MetricsScraper "Prometheus" }}
6+
apiVersion: monitoring.coreos.com/v1
7+
kind: ServiceMonitor
8+
{{- end }}
9+
metadata:
10+
name: {{ template ".Chart.Name .fullname" $ }}
11+
labels:
12+
app: {{ template ".Chart.Name .name" . }}
13+
appId: {{ $.Values.app | quote }}
14+
envId: {{ $.Values.env | quote }}
15+
chart: {{ template ".Chart.Name .chart" . }}
16+
release: {{ .Values.prometheus.release }}
17+
spec:
18+
jobLabel: {{ template ".Chart.Name .name" $ }}
19+
endpoints:
20+
- port: envoy-admin
21+
interval: 30s
22+
path: /stats/prometheus
23+
relabelings:
24+
- action: replace
25+
sourceLabels:
26+
- __meta_kubernetes_pod_label_pod_template_hash
27+
targetLabel: devtron_app_hash
28+
selector:
29+
matchLabels:
30+
app: {{ template ".Chart.Name .name" $ }}
31+
appId: {{ $.Values.app | quote }}
32+
envId: {{ $.Values.env | quote }}
33+
namespaceSelector:
34+
matchNames:
35+
- {{.Release.Namespace}}
36+
podTargetLabels:
37+
- appId
38+
- envId
39+
- devtron_app_hash
40+
{{- end }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/deployment.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ spec:
259259
{{- end }}
260260
env:
261261
- name: CONFIG_HASH
262-
value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }}
262+
value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }}
263263
- name: SECRET_HASH
264-
value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }}
264+
value: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }}
265265
- name: DEVTRON_APP_NAME
266266
value: {{ template ".Chart.Name .name" $ }}
267267
- name: POD_NAME
@@ -571,8 +571,20 @@ spec:
571571
{{ toYaml .volumeMounts | indent 12 -}}
572572
{{- end}}
573573
{{- else}}
574+
{{- $cCopy := deepCopy . }}
575+
{{- if hasKey $cCopy "ports" }}
576+
{{- $newPorts := list }}
577+
{{- range $port := $cCopy.ports }}
578+
{{- $newPorts = append $newPorts (dict
579+
"name" (get $port "name")
580+
"containerPort" (get $port "containerPort")
581+
"protocol" (get $port "protocol")
582+
) }}
583+
{{- end }}
584+
{{- $_ := set $cCopy "ports" $newPorts }}
585+
{{- end }}
574586
-
575-
{{ toYaml . | indent 10 }}
587+
{{ toYaml $cCopy | indent 10 }}
576588
{{- end}}
577589
{{- end}}
578590
{{- end}}
@@ -874,9 +886,9 @@ spec:
874886
{{- end }}
875887
env:
876888
- name: CONFIG_HASH
877-
value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }}
889+
value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }}
878890
- name: SECRET_HASH
879-
value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }}
891+
value: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }}
880892
- name: DEVTRON_APP_NAME
881893
value: {{ template ".Chart.Name .name" $ }}
882894
- name: POD_NAME
@@ -1186,8 +1198,20 @@ spec:
11861198
{{ toYaml .volumeMounts | indent 12 -}}
11871199
{{- end}}
11881200
{{- else}}
1201+
{{- $cCopy := deepCopy . }}
1202+
{{- if hasKey $cCopy "ports" }}
1203+
{{- $newPorts := list }}
1204+
{{- range $port := $cCopy.ports }}
1205+
{{- $newPorts = append $newPorts (dict
1206+
"name" (get $port "name")
1207+
"containerPort" (get $port "containerPort")
1208+
"protocol" (get $port "protocol")
1209+
) }}
1210+
{{- end }}
1211+
{{- $_ := set $cCopy "ports" $newPorts }}
1212+
{{- end }}
11891213
-
1190-
{{ toYaml . | indent 10 }}
1214+
{{ toYaml $cCopy | indent 10 }}
11911215
{{- end}}
11921216
{{- end}}
11931217
{{- end}}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/flagger.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ metadata:
7171
{{ toYaml .annotations | indent 4 }}
7272
{{- end }}
7373
spec:
74+
{{- if .provider }}
75+
provider: {{ .provider }}
76+
{{- end }}
7477
targetRef:
7578
apiVersion: apps/v1
7679
kind: Deployment
@@ -146,13 +149,31 @@ spec:
146149
maxWeight: {{ .analysis.maxWeight }}
147150
stepWeight: {{ .analysis.stepWeight }}
148151
metrics:
152+
{{- if $.Values.flaggerCanary.analysis.metrics }}
153+
{{- range $.Values.flaggerCanary.analysis.metrics }}
154+
- name: {{ .name }}
155+
threshold: {{ .successRate }}
156+
interval: {{.interval }}
157+
{{- end }}
158+
{{- end }}
149159
- name: request-success-rate
150160
threshold: {{ .thresholds.successRate }}
151161
interval: 1m
152162
- name: request-duration
153163
threshold: {{ .thresholds.latency }}
154-
interval: 1m
164+
interval: 1m
155165
webhooks:
166+
{{- if $.Values.flaggerCanary.analysis.webhooks }}
167+
{{- range $.Values.flaggerCanary.analysis.webhooks }}
168+
- name: {{ .name }}
169+
url: {{ .url }}
170+
timeout: {{ .timeout }}
171+
metadata:
172+
{{- range $key, $val := .metadata }}
173+
{{ $key }}: {{ $val | quote }}
174+
{{- end }}
175+
{{- end }}
176+
{{- end }}
156177
{{- if .loadtest.enabled }}
157178
- name: load-test
158179
url: {{ .loadtest.url }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-authorizationpolicy.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{{- with .Values.istio }}
22
{{- if and .enable .authorizationPolicy.enabled }}
3+
{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}}
4+
apiVersion: security.istio.io/v1
5+
{{- else -}}
36
apiVersion: security.istio.io/v1beta1
7+
{{- end }}
48
kind: AuthorizationPolicy
59
metadata:
610
{{- if .authorizationPolicy.name }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-destinationrule.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{{- with .Values.istio }}
22
{{- if and .enable .destinationRule.enabled }}
3+
{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}}
4+
apiVersion: networking.istio.io/v1
5+
{{ else }}
36
apiVersion: networking.istio.io/v1beta1
7+
{{- end }}
48
kind: DestinationRule
59
metadata:
610
{{- if .destinationRule.name }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-gateway.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{{- if and .Values.istio.enable .Values.istio.gateway.enabled -}}
2+
{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}}
3+
apiVersion: networking.istio.io/v1
4+
{{ else }}
25
apiVersion: networking.istio.io/v1beta1
6+
{{- end }}
37
kind: Gateway
48
metadata:
59
{{- if .Values.istio.gateway.name }}
@@ -24,6 +28,9 @@ metadata:
2428
{{ toYaml $.Values.istio.gateway.annotations | indent 4 }}
2529
{{- end }}
2630
spec:
31+
{{- if .Values.istio.gateway.gatewayExtraSpec }}
32+
{{ toYaml $.Values.istio.gateway.gatewayExtraSpec | indent 2}}
33+
{{- end }}
2734
{{ with $.Values.istio.gateway }}
2835
selector:
2936
{{- if .selector }}
@@ -68,4 +75,4 @@ spec:
6875
{{ end }}
6976
{{ end }}
7077
{{ end }}
71-
{{- end }}
78+
{{- end }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-peerauthentication.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{{- with .Values.istio }}
22
{{- if and .enable .peerAuthentication.enabled }}
3+
{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}}
4+
apiVersion: security.istio.io/v1
5+
{{- else -}}
36
apiVersion: security.istio.io/v1beta1
7+
{{- end }}
48
kind: PeerAuthentication
59
metadata:
610
{{- if .peerAuthentication.name }}

scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-requestauthentication.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{{- with .Values.istio }}
22
{{- if and .enable .requestAuthentication.enabled }}
3+
{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}}
4+
apiVersion: security.istio.io/v1
5+
{{- else -}}
36
apiVersion: security.istio.io/v1beta1
7+
{{- end }}
48
kind: RequestAuthentication
59
metadata:
610
{{- if .requestAuthentication.name }}
7-
name: {{.requestAuthentication.name }}
11+
name: {{ .requestAuthentication.name }}
812
{{- else }}
913
name: {{ template ".Chart.Name .fullname" $ }}
1014
{{- end }}

0 commit comments

Comments
 (0)