diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/app-values.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/app-values.yaml index 5f8216c0a7..629b8482d5 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/app-values.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/app-values.yaml @@ -527,4 +527,6 @@ hostAliases: [] # - "bar.remote" verticalPodScaling: - enabled: false \ No newline at end of file + enabled: false + +MetricsScraper: Prometheus \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/_helpers.tpl b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/_helpers.tpl index 10de322e2a..98f7ac04e0 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/_helpers.tpl +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/_helpers.tpl @@ -164,4 +164,44 @@ Create chart name and version as used by the chart label. {{- $LabelsContain = true -}} {{- end }} {{- $LabelsContain -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{- define "vmserviceScrapeEnabled" -}} + {{- $SMenabled := false -}} + {{- range .Values.ContainerPort }} + {{- if .vmservicescrape }} + {{- if and .vmservicescrape.enabled }} + {{- $SMenabled = true -}} + {{- end }} + {{- end }} + {{- end }} + {{- $SMenabled -}} +{{- end -}} + + +{{- define "podMonitorEnabled" -}} + {{- $SMenabled := false -}} + {{- if .Values.podmonitor.enabled }} + {{- $SMenabled = true -}} + {{- end }} + {{- $SMenabled -}} +{{- end -}} + + +{{- define "scrapeType" -}} + {{- $ServiceMonitorEnabled := include "serviceMonitorEnabled" . -}} + {{- $VmServiceScrapeEnabled := include "vmserviceScrapeEnabled" . -}} + {{- $val1 := "vmservicescrape"}} + {{- $val2 := "servicemonitor"}} + {{- $val3 := "" }} + {{- if and (eq $VmServiceScrapeEnabled "true") (eq $ServiceMonitorEnabled "true")}} + {{- $val1 }} + {{- else if eq $ServiceMonitorEnabled "true" }} + {{- $val2 }} + {{- else if eq $VmServiceScrapeEnabled "true" }} + {{- $val1 }} + {{- else }} + {{- $val3 }} + {{- end }} + +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/metrics-service-monitor.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/app-metrics.yaml similarity index 84% rename from scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/metrics-service-monitor.yaml rename to scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/app-metrics.yaml index fa5321d303..5c8d17f98d 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/metrics-service-monitor.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/app-metrics.yaml @@ -1,6 +1,11 @@ {{- if $.Values.appMetrics -}} +{{- if eq .Values.MetricsScraper "Victoria" }} +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMServiceScrape +{{- else if eq .Values.MetricsScraper "Prometheus" }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor +{{- end }} metadata: name: {{ template ".Chart.Name .fullname" $ }} labels: diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/deployment.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/deployment.yaml index 811ff84df5..8cae02d3c0 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/deployment.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/deployment.yaml @@ -259,9 +259,9 @@ spec: {{- end }} env: - name: CONFIG_HASH - value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} + value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} - name: SECRET_HASH - value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} + value: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} - name: DEVTRON_APP_NAME value: {{ template ".Chart.Name .name" $ }} - name: POD_NAME @@ -571,8 +571,20 @@ spec: {{ toYaml .volumeMounts | indent 12 -}} {{- end}} {{- else}} +{{- $cCopy := deepCopy . }} +{{- if hasKey $cCopy "ports" }} +{{- $newPorts := list }} +{{- range $port := $cCopy.ports }} + {{- $newPorts = append $newPorts (dict + "name" (get $port "name") + "containerPort" (get $port "containerPort") + "protocol" (get $port "protocol") + ) }} +{{- end }} +{{- $_ := set $cCopy "ports" $newPorts }} +{{- end }} - -{{ toYaml . | indent 10 }} +{{ toYaml $cCopy | indent 10 }} {{- end}} {{- end}} {{- end}} @@ -874,9 +886,9 @@ spec: {{- end }} env: - name: CONFIG_HASH - value: {{ include (print $.Chart.Name "/templates/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} + value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.ConfigHash) }}{{ .Values.devtronInternal.containerSpecs.ConfigHash }}{{ end }} - name: SECRET_HASH - value: {{ include (print $.Chart.Name "/templates/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} + value: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}{{ if and (.Values.devtronInternal) (.Values.devtronInternal.containerSpecs.SecretHash) }}{{ .Values.devtronInternal.containerSpecs.SecretHash }}{{ end }} - name: DEVTRON_APP_NAME value: {{ template ".Chart.Name .name" $ }} - name: POD_NAME @@ -1186,8 +1198,20 @@ spec: {{ toYaml .volumeMounts | indent 12 -}} {{- end}} {{- else}} +{{- $cCopy := deepCopy . }} +{{- if hasKey $cCopy "ports" }} +{{- $newPorts := list }} +{{- range $port := $cCopy.ports }} + {{- $newPorts = append $newPorts (dict + "name" (get $port "name") + "containerPort" (get $port "containerPort") + "protocol" (get $port "protocol") + ) }} +{{- end }} +{{- $_ := set $cCopy "ports" $newPorts }} +{{- end }} - -{{ toYaml . | indent 10 }} +{{ toYaml $cCopy | indent 10 }} {{- end}} {{- end}} {{- end}} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/flagger.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/flagger.yaml index 766098fb61..a0fb8b4032 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/flagger.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/flagger.yaml @@ -71,6 +71,9 @@ metadata: {{ toYaml .annotations | indent 4 }} {{- end }} spec: +{{- if .provider }} + provider: {{ .provider }} +{{- end }} targetRef: apiVersion: apps/v1 kind: Deployment @@ -146,13 +149,31 @@ spec: maxWeight: {{ .analysis.maxWeight }} stepWeight: {{ .analysis.stepWeight }} metrics: +{{- if $.Values.flaggerCanary.analysis.metrics }} +{{- range $.Values.flaggerCanary.analysis.metrics }} + - name: {{ .name }} + threshold: {{ .successRate }} + interval: {{.interval }} +{{- end }} +{{- end }} - name: request-success-rate threshold: {{ .thresholds.successRate }} interval: 1m - name: request-duration threshold: {{ .thresholds.latency }} - interval: 1m + interval: 1m webhooks: +{{- if $.Values.flaggerCanary.analysis.webhooks }} +{{- range $.Values.flaggerCanary.analysis.webhooks }} + - name: {{ .name }} + url: {{ .url }} + timeout: {{ .timeout }} + metadata: + {{- range $key, $val := .metadata }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} +{{- end }} {{- if .loadtest.enabled }} - name: load-test url: {{ .loadtest.url }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-authorizationpolicy.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-authorizationpolicy.yaml index 8340555ff3..df063920a7 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-authorizationpolicy.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-authorizationpolicy.yaml @@ -1,6 +1,10 @@ {{- with .Values.istio }} {{- if and .enable .authorizationPolicy.enabled }} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: security.istio.io/v1 +{{- else -}} apiVersion: security.istio.io/v1beta1 +{{- end }} kind: AuthorizationPolicy metadata: {{- if .authorizationPolicy.name }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-destinationrule.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-destinationrule.yaml index 4d06deb0b8..bc665e6ec0 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-destinationrule.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-destinationrule.yaml @@ -1,6 +1,10 @@ {{- with .Values.istio }} {{- if and .enable .destinationRule.enabled }} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.istio.io/v1 +{{ else }} apiVersion: networking.istio.io/v1beta1 +{{- end }} kind: DestinationRule metadata: {{- if .destinationRule.name }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-gateway.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-gateway.yaml index b145d6c569..e4c6750af6 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-gateway.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-gateway.yaml @@ -1,5 +1,9 @@ {{- if and .Values.istio.enable .Values.istio.gateway.enabled -}} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.istio.io/v1 +{{ else }} apiVersion: networking.istio.io/v1beta1 +{{- end }} kind: Gateway metadata: {{- if .Values.istio.gateway.name }} @@ -24,6 +28,9 @@ metadata: {{ toYaml $.Values.istio.gateway.annotations | indent 4 }} {{- end }} spec: +{{- if .Values.istio.gateway.gatewayExtraSpec }} +{{ toYaml $.Values.istio.gateway.gatewayExtraSpec | indent 2}} +{{- end }} {{ with $.Values.istio.gateway }} selector: {{- if .selector }} @@ -68,4 +75,4 @@ spec: {{ end }} {{ end }} {{ end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-peerauthentication.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-peerauthentication.yaml index dedd971c6d..5e143c8530 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-peerauthentication.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-peerauthentication.yaml @@ -1,6 +1,10 @@ {{- with .Values.istio }} {{- if and .enable .peerAuthentication.enabled }} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: security.istio.io/v1 +{{- else -}} apiVersion: security.istio.io/v1beta1 +{{- end }} kind: PeerAuthentication metadata: {{- if .peerAuthentication.name }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-requestauthentication.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-requestauthentication.yaml index 49bb89552d..d8082bd34d 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-requestauthentication.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-requestauthentication.yaml @@ -1,10 +1,14 @@ {{- with .Values.istio }} {{- if and .enable .requestAuthentication.enabled }} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: security.istio.io/v1 +{{- else -}} apiVersion: security.istio.io/v1beta1 +{{- end }} kind: RequestAuthentication metadata: {{- if .requestAuthentication.name }} - name: {{.requestAuthentication.name }} + name: {{ .requestAuthentication.name }} {{- else }} name: {{ template ".Chart.Name .fullname" $ }} {{- end }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-virtualservice.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-virtualservice.yaml index 32a3380228..bc0ff136ba 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-virtualservice.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/istio-virtualservice.yaml @@ -1,6 +1,10 @@ {{- with .Values.istio }} {{- if and .enable .virtualService.enabled }} +{{ if semverCompare ">=1.22-0" $.Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.istio.io/v1 +{{ else }} apiVersion: networking.istio.io/v1beta1 +{{- end }} kind: VirtualService metadata: {{- if .virtualService.name }} @@ -25,6 +29,9 @@ metadata: {{ toYaml .virtualService.annotations | indent 4 }} {{- end }} spec: +{{- if .virtualService.virtualServiceExtraSpec }} +{{ toYaml .virtualService.virtualServiceExtraSpec | indent 2}} +{{- end }} {{- if or .gateway.enabled .virtualService.gateways }} gateways: {{- if .gateway.enabled }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/podmonitor.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/podmonitor.yaml new file mode 100644 index 0000000000..2f22219191 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/podmonitor.yaml @@ -0,0 +1,32 @@ +{{ $podMonitorEnabled := include "podMonitorEnabled" . }} +{{- if eq "true" $podMonitorEnabled -}} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + {{- if .Values.podmonitor.name }} + name: {{ .Values.podmonitor.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-pm + {{- end }} +spec: + jobLabel: {{ .Values.podmonitor.jobLabel }} + namespaceSelector: + matchNames: + - devtron-demo +{{- if .Values.podmonitor.podMetricsEndpoints }} + podMetricsEndpoints: + {{- toYaml .Values.podmonitor.podMetricsEndpoints | nindent 4}} +{{- end }} + podTargetLabels: + - appId + - envId + - devtron_app_hash + selector: + matchLabels: + {{- if .Values.podmonitor.matchLabels }} + {{- toYaml .Values.pod.matchLabels | nindent 6 }} + {{- else }} + app: {{ template ".Chart.Name .name" $ }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/service-scraper.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/service-scraper.yaml new file mode 100644 index 0000000000..1b50719db4 --- /dev/null +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/service-scraper.yaml @@ -0,0 +1,131 @@ +{{ $scrapetype := include "scrapeType" . }} +{{ $scraper := get (dict "servicemonitor" .Values.servicemonitor "vmservicescrape" .Values.vmservicescrape) $scrapetype }} +{{- if ($scrapetype) }} +{{- if and ($scrapetype) (eq .Values.MetricsScraper "Victoria") -}} +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMServiceScrape +{{- else }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +{{- end }} +metadata: + {{- if $scraper.name }} + name: {{ $scraper.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-vm + {{- end }} + labels: + kind: {{ $scrapetype }} + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.vmservicescrape.additionalLabels }} +{{ toYaml .Values.vmservicescrape.additionalLabels | indent 4 }} + {{- end }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: + endpoints: + {{- range .Values.ContainerPort }} + {{ $scraper := get (dict "servicemonitor" .servicemonitor "vmservicescrape" .vmservicescrape) $scrapetype }} + {{- if $scraper }} + {{- if $scraper.enabled}} + {{- if $scraper.targetPort }} + - targetPort: {{ $scraper.targetPort }} + {{- else if .servicePort }} + - port: {{ .name }} + {{- end }} + {{- if $scraper.path }} + path: {{ $scraper.path}} + {{- end }} + {{- if $scraper.scheme }} + scheme: {{ $scraper.scheme}} + {{- end }} + {{- if $scraper.interval }} + interval: {{ $scraper.interval}} + {{- end }} + {{- if $scraper.scrapeTimeout }} + scrapeTimeout: {{ $scraper.scrapeTimeout | quote }} + {{- end }} + {{- if $scraper.basicAuth }} + basicAuth: + {{- toYaml $scraper.basicAuth | nindent 8 }} + {{- end }} + {{- if $scraper.insecureTLS }} + tlsConfig: + insecureSkipVerify: true + {{- else if $scraper.tlsConfig }} + tlsConfig: + {{- toYaml $scraper.tlsConfig | nindent 8 }} + {{- end }} + {{- if $scraper.metricRelabelings}} + metricRelabelings: +{{toYaml $scraper.metricRelabelings | indent 8 }} + {{- end }} +{{- if $scraper.relabelings }} + relabelings: +{{ toYaml $scraper.relabelings | indent 8 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- range .Values.containers }} + {{- range .ports }} + {{ $scraper := get (dict "servicemonitor" .servicemonitor "vmservicescrape" .vmservicescrape) $scrapetype }} + {{- if $scraper }} + {{- if $scraper.enabled}} + {{- if $scraper.targetPort }} + - targetPort: {{ $scraper.targetPort }} + {{- else if .servicePort }} + - port: {{ .name }} + {{- end }} + {{- if $scraper.path }} + path: {{ $scraper.path}} + {{- end }} + {{- if $scraper.scheme }} + scheme: {{ $scraper.scheme}} + {{- end }} + {{- if $scraper.interval }} + interval: {{ $scraper.interval}} + {{- end }} + {{- if $scraper.scrapeTimeout }} + scrapeTimeout: {{ $scraper.scrapeTimeout}} + {{- end }} + {{- if $scraper.basicAuth }} + basicAuth: + {{- toYaml $scraper.basicAuth | nindent 8 }} + {{- end }} + {{- if $scraper.insecureTLS }} + tlsConfig: + insecureSkipVerify: true + {{- else if $scraper.tlsConfig }} + tlsConfig: + {{- toYaml $scraper.tlsConfig | nindent 8 }} + {{- end }} + {{- if $scraper.metricRelabelings}} + metricRelabelings: +{{toYaml $scraper.metricRelabelings | indent 8 }} + {{- end }} +{{- if $scraper.relabelings }} + relabelings: +{{ toYaml $scraper.relabelings | indent 8 }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if $scraper.namespaceSelector }} + namespaceSelector: + matchNames: + {{- toYaml $scraper.namespaceSelector | nindent 6 }} + {{- end }} + selector: + matchLabels: + {{- if .Values.servicemonitor.matchLabels }} + {{- toYaml $scraper.matchLabels | nindent 6 }} + {{- end }} + app: {{ template ".Chart.Name .name" $ }} +{{- end }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/servicemonitor.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/servicemonitor.yaml deleted file mode 100644 index 9b920388d2..0000000000 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/servicemonitor.yaml +++ /dev/null @@ -1,117 +0,0 @@ -{{ $serviceMonitorEnabled := include "serviceMonitorEnabled" . }} -{{- if eq "true" $serviceMonitorEnabled -}} ---- -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - {{- if .Values.servicemonitor.name }} - name: {{ .Values.servicemonitor.name }} - {{- else }} - name: {{ template ".Chart.Name .fullname" . }}-sm - {{- end }} - labels: - kind: Prometheus - app: {{ template ".Chart.Name .name" . }} - appId: {{ $.Values.app | quote }} - envId: {{ $.Values.env | quote }} - chart: {{ template ".Chart.Name .chart" . }} - release: {{ .Values.prometheus.release }} - {{- if .Values.servicemonitor.additionalLabels }} -{{ toYaml .Values.servicemonitor.additionalLabels | indent 4 }} - {{- end }} - {{- if .Values.appLabels }} -{{ toYaml .Values.appLabels | indent 4 }} - {{- end }} -spec: - endpoints: - {{- range .Values.ContainerPort }} - {{- if .servicemonitor }} - {{- if .servicemonitor.enabled}} - {{- if .servicemonitor.targetPort }} - - targetPort: {{ .servicemonitor.targetPort }} - {{- else if .servicePort }} - - port: {{ .name }} - {{- end }} - {{- if .servicemonitor.path }} - path: {{ .servicemonitor.path}} - {{- end }} - {{- if .servicemonitor.scheme }} - scheme: {{ .servicemonitor.scheme}} - {{- end }} - {{- if .servicemonitor.interval }} - interval: {{ .servicemonitor.interval}} - {{- end }} - {{- if .servicemonitor.scrapeTimeout }} - scrapeTimeout: {{ .servicemonitor.scrapeTimeout | quote }} - {{- end }} - {{- if .servicemonitor.basicAuth }} - basicAuth: - {{- toYaml .servicemonitor.basicAuth | nindent 8 }} - {{- end }} - {{- if .servicemonitor.insecureTLS }} - tlsConfig: - insecureSkipVerify: true - {{- else if .servicemonitor.tlsConfig }} - tlsConfig: - {{- toYaml .servicemonitor.tlsConfig | nindent 8 }} - {{- end }} - {{- if .servicemonitor.metricRelabelings}} - metricRelabelings: -{{toYaml .servicemonitor.metricRelabelings | indent 8 }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- range .Values.containers }} - {{- range .ports }} - {{- if .servicemonitor }} - {{- if .servicemonitor.enabled}} - {{- if .servicemonitor.targetPort }} - - targetPort: {{ .servicemonitor.targetPort }} - {{- else if .servicePort }} - - port: {{ .name }} - {{- end }} - {{- if .servicemonitor.path }} - path: {{ .servicemonitor.path}} - {{- end }} - {{- if .servicemonitor.scheme }} - scheme: {{ .servicemonitor.scheme}} - {{- end }} - {{- if .servicemonitor.interval }} - interval: {{ .servicemonitor.interval}} - {{- end }} - {{- if .servicemonitor.scrapeTimeout }} - scrapeTimeout: {{ .servicemonitor.scrapeTimeout}} - {{- end }} - {{- if .servicemonitor.basicAuth }} - basicAuth: - {{- toYaml .servicemonitor.basicAuth | nindent 8 }} - {{- end }} - {{- if .servicemonitor.insecureTLS }} - tlsConfig: - insecureSkipVerify: true - {{- else if .servicemonitor.tlsConfig }} - tlsConfig: - {{- toYaml .servicemonitor.tlsConfig | nindent 8 }} - {{- end }} - {{- if .servicemonitor.metricRelabelings}} - metricRelabelings: -{{toYaml .servicemonitor.metricRelabelings | indent 8 }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - {{- if .Values.servicemonitor.namespaceSelector }} - namespaceSelector: - matchNames: - {{- toYaml .Values.servicemonitor.namespaceSelector | nindent 6 }} - {{- end }} - selector: - matchLabels: - {{- if .Values.servicemonitor.matchLabels }} - {{- toYaml .Values.servicemonitor.matchLabels | nindent 6 }} - {{- else }} - app: {{ template ".Chart.Name .name" $ }} -{{- end }} -{{- end }} diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/vmrule.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/vmrule.yaml new file mode 100644 index 0000000000..8e3b162f8c --- /dev/null +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/templates/vmrule.yaml @@ -0,0 +1,29 @@ +{{- if .Values.vmrule.enabled -}} +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMRule +metadata: + {{- if .Values.vmrule.name }} + name: {{ .Values.vmrule.name }} + {{- else }} + name: {{ template ".Chart.Name .fullname" . }}-vmr + {{- end }} + namespace: + labels: + kind: Victoria + app: {{ template ".Chart.Name .name" . }} + appId: {{ $.Values.app | quote }} + envId: {{ $.Values.env | quote }} + chart: {{ template ".Chart.Name .chart" . }} + release: {{ .Values.prometheus.release }} + {{- if .Values.vmrule.additionalLabels }} +{{ toYaml .Values.vmrule.additionalLabels | indent 4 }} + {{- end }} + {{- if .Values.appLabels }} +{{ toYaml .Values.appLabels | indent 4 }} + {{- end }} +spec: +{{- if .Values.vmrule.rules }} + groups: +{{ toYaml .Values.vmrule.rules | indent 4}} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/test_values.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/test_values.yaml index 48e62037f6..5008e2c6b3 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/test_values.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/test_values.yaml @@ -79,9 +79,20 @@ ContainerPort: useHTTP2: false supportStreaming: false idleTimeout: 1800s + # vmservicescrape: + # enabled: true + # path: /abcde + # scheme: 'http' + # interval: 30s + # scrapeTimeout: 20s + # metricRelabelings: + # - sourceLabels: [namespace] + # regex: '(.*)' + # replacement: myapp + # targetLabel: target_namespace servicemonitor: enabled: true - path: /abc + path: /abcd scheme: 'http' interval: 30s scrapeTimeout: 20s @@ -91,6 +102,7 @@ ContainerPort: replacement: myapp targetLabel: target_namespace + - name: app1 port: 8090 targetPort: 1234 @@ -204,7 +216,7 @@ istio: # host: service2 flaggerCanary: - enabled: false + enabled: true labels: {} annotations: {} createIstioGateway: @@ -259,6 +271,7 @@ flaggerCanary: # allowHeaders: # - x-some-header # maxAge: 24h + analysis: # schedule interval (default 60s) interval: 5s @@ -270,6 +283,11 @@ flaggerCanary: # canary increment step # percentage (0-100) stepWeight: 5 + metrics: + - name: test + interval: 10s + threshold: 10 + webhooks: [] thresholds: # minimum req success rate (non 5xx responses) # percentage (0-100) @@ -659,6 +677,27 @@ containers: volumeMounts: - mountPath: /usr/local/airflow/logs name: logs-data + ports: + - name: test + port: 8080 + servicePort: 80 + envoyTimeout: 15 + targetPort: 8080 + envoyPort: 8799 + useHTTP2: false + supportStreaming: false + idleTimeout: 1800s + vmservicescrape: + enabled: true + path: /abcde + scheme: 'http' + interval: 30s + scrapeTimeout: 20s + metricRelabelings: + - sourceLabels: [namespace] + regex: '(.*)' + replacement: myapp + targetLabel: target_namespace rawYaml: @@ -779,4 +818,18 @@ secondaryWorkload: MinReplicas: 1 MaxReplicas: 2 TargetCPUUtilizationPercentage: 90 - TargetMemoryUtilizationPercentage: 80 \ No newline at end of file + TargetMemoryUtilizationPercentage: 80 + + +vmservicescrape: + name: test + +vmrule: + name: test-vmr + rules: + - name: kubelet.rules + record: dksjndksnd + - name: kznjdk + record: kdjskjdnks + +MetricsScraper: Victoria \ No newline at end of file diff --git a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/values.yaml b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/values.yaml index d67a0b2560..aebe4a920c 100644 --- a/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/values.yaml +++ b/scripts/devtron-reference-helm-charts/deployment-chart_4-21-0/values.yaml @@ -383,6 +383,8 @@ prometheus: servicemonitor: additionalLabels: {} +vmservicescrape: + additionalLabels: {} prometheusRule: enabled: false @@ -715,4 +717,18 @@ secondaryWorkload: autoscaling: enabled: false containerResource: - enabled: false \ No newline at end of file + enabled: false + + + +vmrule: + enabled: false + name: test-vmr + rules: [] + +podmonitor: + enabled: false + name: "" + jobLabel: test + +MetricsScraper: Prometheus diff --git a/scripts/sql/33603701_deployment-chart-ref_4-21-0.up.sql b/scripts/sql/33603701_deployment-chart-ref_4-21-0.up.sql new file mode 100644 index 0000000000..2c04f71aa8 --- /dev/null +++ b/scripts/sql/33603701_deployment-chart-ref_4-21-0.up.sql @@ -0,0 +1,32 @@ +UPDATE chart_ref SET is_default=false; + +INSERT INTO "public"."chart_ref" ("location", "version", "is_default", "active", "created_on", "created_by", "updated_on", "updated_by", "name", "deployment_strategy_path") +SELECT 'deployment-chart_4-21-0', '4.21.0', 't', 't', 'now()', 1, 'now()', 1, 'Deployment', 'pipeline-values.yaml' +WHERE NOT EXISTS ( + SELECT 1 FROM "public"."chart_ref" WHERE "location" = 'deployment-chart_4-21-0' +); + +-- Next, safely insert the mapping if it doesn't already exist. +INSERT INTO "public"."global_strategy_metadata_chart_ref_mapping" ("global_strategy_metadata_id", "chart_ref_id", "active", "default", "created_on", "created_by", "updated_on", "updated_by") +SELECT + (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'ROLLING'), + (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'deployment-chart_4-21-0'), + true, true, 'now()', 1, 'now()', 1 +WHERE NOT EXISTS ( + SELECT 1 + FROM "public"."global_strategy_metadata_chart_ref_mapping" + WHERE "global_strategy_metadata_id" = (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'ROLLING') + AND "chart_ref_id" = (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'deployment-chart_4-21-0') +); + +INSERT INTO "public"."global_strategy_metadata_chart_ref_mapping" ("global_strategy_metadata_id", "chart_ref_id", "active", "default", "created_on", "created_by", "updated_on", "updated_by") +SELECT + (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'RECREATE'), + (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'deployment-chart_4-21-0'), + true, true, 'now()', 1, 'now()', 1 +WHERE NOT EXISTS ( + SELECT 1 + FROM "public"."global_strategy_metadata_chart_ref_mapping" + WHERE "global_strategy_metadata_id" = (SELECT "id" FROM "public"."global_strategy_metadata" WHERE "name" = 'RECREATE') + AND "chart_ref_id" = (SELECT "id" FROM "public"."chart_ref" WHERE "location" = 'deployment-chart_4-21-0') +); \ No newline at end of file