Skip to content

Commit 89e60d8

Browse files
committed
added support for secondary-wl v2
1 parent dd9c1a2 commit 89e60d8

File tree

5 files changed

+294
-8
lines changed

5 files changed

+294
-8
lines changed

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ spec:
202202
{{- end}}
203203
{{- end}}
204204
containers:
205-
- name: {{ $.Chart.Name }}
205+
- name: {{ $.Values.containerName | default $.Chart.Name }}
206206
image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}"
207207
imagePullPolicy: {{ $.Values.image.pullPolicy }}
208208
{{- if $.Values.containerSpec.lifecycle.enabled }}
@@ -642,7 +642,7 @@ spec:
642642
apiVersion: apps/v1
643643
kind: Deployment
644644
metadata:
645-
name: {{ include ".Chart.Name .fullname" $ }}-{{ $.Values.secondaryWorkload.postfix | default "sec" }}
645+
name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}
646646
labels:
647647
app: {{ template ".Chart.Name .name" $ }}
648648
chart: {{ template ".Chart.Name .chart" $ }}
@@ -655,15 +655,25 @@ metadata:
655655
{{- if .Values.appLabels }}
656656
{{ toYaml .Values.appLabels | indent 4 }}
657657
{{- end }}
658+
{{- if .Values.secondaryWorkload.deploymentLabels }}
659+
{{ toYaml .Values.secondaryWorkload.deploymentLabels | indent 4 }}
660+
{{- end }}
658661

659-
{{- if .Values.deploymentAnnotations }}
662+
{{- if or .Values.deploymentAnnotations .Values.secondaryWorkload.deploymentAnnotations }}
660663
annotations:
664+
{{- if .Values.deploymentAnnotations }}
661665
{{ toYaml .Values.deploymentAnnotations | indent 4 }}
662666
{{- end }}
667+
{{- if .Values.secondaryWorkload.deploymentAnnotations }}
668+
{{ toYaml .Values.secondaryWorkload.deploymentAnnotations | indent 4 }}
669+
{{- end }}
670+
{{- end }}
663671
spec:
664672
selector:
665673
matchLabels:
666-
{{- if .Values.customMatchLabels }}
674+
{{- if .Values.secondaryWorkload.customMatchLabels }}
675+
{{ toYaml .Values.secondaryWorkload.customMatchLabels | indent 6 }}
676+
{{- else if .Values.customMatchLabels }}
667677
{{ toYaml .Values.customMatchLabels | indent 6 }}
668678
{{- else }}
669679
app: {{ template ".Chart.Name .name" $ }}
@@ -673,11 +683,14 @@ spec:
673683
minReadySeconds: {{ $.Values.MinReadySeconds }}
674684
template:
675685
metadata:
676-
{{- if .Values.podAnnotations }}
686+
{{- if or .Values.podAnnotations .Values.secondaryWorkload.podAnnotations }}
677687
annotations:
678688
{{- range $key, $value := .Values.podAnnotations }}
679689
{{ $key }}: {{ $value | quote }}
680690
{{- end }}
691+
{{- range $key, $value := .Values.secondaryWorkload.podAnnotations }}
692+
{{ $key }}: {{ $value | quote }}
693+
{{- end }}
681694
{{- end }}
682695
labels:
683696
app: {{ template ".Chart.Name .name" $ }}
@@ -692,6 +705,9 @@ spec:
692705
{{- end }}
693706
{{- if .Values.podLabels }}
694707
{{ toYaml .Values.podLabels | indent 8 }}
708+
{{- end }}
709+
{{- if .Values.secondaryWorkload.podLabels }}
710+
{{ toYaml .Values.secondaryWorkload.podLabels | indent 8 }}
695711
{{- end }}
696712
spec:
697713
{{- if $.Values.podExtraSpecs }}
@@ -813,7 +829,7 @@ spec:
813829
{{- end}}
814830
{{- end}}
815831
containers:
816-
- name: {{ $.Chart.Name }}
832+
- name: {{ $.Values.secondaryWorkload.containerName | default $.Chart.Name }}
817833
image: "{{ .Values.server.deployment.image }}:{{ .Values.server.deployment.image_tag }}"
818834
imagePullPolicy: {{ $.Values.image.pullPolicy }}
819835
{{- if $.Values.containerSpec.lifecycle.enabled }}

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,43 @@ spec:
3535
{{ toYaml $.Values.istio.destinationRule.trafficPolicy | indent 4 }}
3636
{{- end }}
3737
{{- end }}
38+
{{- end }}
39+
---
40+
{{- with .Values.istio }}
41+
{{- if and .enable .destinationRule.enabled $.Values.secondaryWorkload.istio.destinationRule.enabled }}
42+
apiVersion: networking.istio.io/v1beta1
43+
kind: DestinationRule
44+
metadata:
45+
{{- if $.Values.secondaryWorkload.istio.destinationRule.name }}
46+
name: {{ $.Values.secondaryWorkload.istio.destinationRule.name }}
47+
{{- else }}
48+
name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-destinationrule
49+
{{- end }}
50+
labels:
51+
app: {{ template ".Chart.Name .name" $ }}
52+
appId: {{ $.Values.app | quote }}
53+
envId: {{ $.Values.env | quote }}
54+
chart: {{ template ".Chart.Name .chart" $ }}
55+
release: {{ $.Release.Name }}
56+
{{- if $.Values.appLabels }}
57+
{{ toYaml $.Values.appLabels | indent 4 }}
58+
{{- end }}
59+
{{- if $.Values.secondaryWorkload.istio.destinationRule.labels }}
60+
{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.labels | indent 4 }}
61+
{{- end }}
62+
{{- if $.Values.secondaryWorkload.istio.destinationRule.annotations }}
63+
annotations:
64+
{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.annotations | indent 4 }}
65+
{{- end }}
66+
spec:
67+
host: "{{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-service.{{ $.Release.Namespace }}.svc.cluster.local"
68+
{{- if $.Values.secondaryWorkload.istio.destinationRule.subsets }}
69+
subsets:
70+
{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.subsets | indent 4 }}
71+
{{- end }}
72+
{{- if $.Values.secondaryWorkload.istio.destinationRule.trafficPolicy }}
73+
trafficPolicy:
74+
{{ toYaml $.Values.secondaryWorkload.istio.destinationRule.trafficPolicy | indent 4 }}
75+
{{- end }}
76+
{{- end }}
3877
{{- end }}

scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/istio-virtualservice.yaml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ kind: VirtualService
55
metadata:
66
{{- if .virtualService.name }}
77
name: {{ .virtualService.name }}
8+
{{- else if $.Values.virtualServiceName }}
9+
name: {{ $.Values.virtualServiceName }}
810
{{- else }}
911
name: {{ template ".Chart.Name .fullname" $ }}-virtualservice
1012
{{- end }}
@@ -34,7 +36,7 @@ spec:
3436
- {{ . | quote }}
3537
{{- end }}
3638
{{- end }}
37-
{{- if or .gateway.enabled .virtualService.hosts }}
39+
{{- if or .gateway.enabled .virtualService.hosts $.Values.virtualServiceHosts }}
3840
hosts:
3941
{{- if .gateway.enabled }}
4042
{{- if .gateway.host }}
@@ -48,6 +50,9 @@ spec:
4850
{{- range .virtualService.hosts }}
4951
- {{ . | quote }}
5052
{{- end }}
53+
{{- range $.Values.virtualServiceHosts }}
54+
- {{ . | quote }}
55+
{{- end }}
5156
{{- else }}
5257
hosts:
5358
- "{{ include ".servicename" $ }}.{{ $.Release.Namespace }}.svc.cluster.local"
@@ -57,4 +62,70 @@ spec:
5762
{{ toYaml $.Values.istio.virtualService.http | indent 4 }}
5863
{{- end }}
5964
{{- end }}
65+
{{- end }}
66+
---
67+
{{- with .Values.istio }}
68+
{{- if and .enable .virtualService.enabled $.Values.secondaryWorkload.istio.virtualService.enabled }}
69+
apiVersion: networking.istio.io/v1beta1
70+
kind: VirtualService
71+
metadata:
72+
{{- if $.Values.secondaryWorkload.istio.virtualService.name }}
73+
name: {{ $.Values.secondaryWorkload.istio.virtualService.name }}
74+
{{- else if $.Values.secondaryWorkload.virtualServiceName }}
75+
name: {{ $.Values.secondaryWorkload.virtualServiceName }}
76+
{{- else }}
77+
name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-virtualservice
78+
{{- end }}
79+
labels:
80+
app: {{ template ".Chart.Name .name" $ }}
81+
appId: {{ $.Values.app | quote }}
82+
envId: {{ $.Values.env | quote }}
83+
chart: {{ template ".Chart.Name .chart" $ }}
84+
release: {{ $.Release.Name }}
85+
{{- if $.Values.appLabels }}
86+
{{ toYaml $.Values.appLabels | indent 4 }}
87+
{{- end }}
88+
{{- if $.Values.secondaryWorkload.istio.virtualService.labels }}
89+
{{ toYaml $.Values.secondaryWorkload.istio.virtualService.labels | indent 4 }}
90+
{{- end }}
91+
{{- if $.Values.secondaryWorkload.istio.virtualService.annotations }}
92+
annotations:
93+
{{ toYaml $.Values.secondaryWorkload.istio.virtualService.annotations | indent 4 }}
94+
{{- end }}
95+
spec:
96+
{{- if or .gateway.enabled $.Values.secondaryWorkload.istio.virtualService.gateways }}
97+
gateways:
98+
{{- if .gateway.enabled }}
99+
- {{ template ".Chart.Name .fullname" $ }}-istio-gateway
100+
{{- end }}
101+
{{- range $.Values.secondaryWorkload.istio.virtualService.gateways }}
102+
- {{ . | quote }}
103+
{{- end }}
104+
{{- end }}
105+
{{- if or .gateway.enabled $.Values.secondaryWorkload.istio.virtualService.hosts $.Values.secondaryWorkload.virtualServiceHosts }}
106+
hosts:
107+
{{- if .gateway.enabled }}
108+
{{- if .gateway.host }}
109+
- {{ .gateway.host | quote }}
110+
{{- else if .gateway.hosts }}
111+
{{- range .gateway.hosts }}
112+
- {{ . | quote }}
113+
{{- end }}
114+
{{- end }}
115+
{{- end }}
116+
{{- range $.Values.secondaryWorkload.istio.virtualService.hosts }}
117+
- {{ . | quote }}
118+
{{- end }}
119+
{{- range $.Values.secondaryWorkload.virtualServiceHosts }}
120+
- {{ . | quote }}
121+
{{- end }}
122+
{{- else }}
123+
hosts:
124+
- "{{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-service.{{ $.Release.Namespace }}.svc.cluster.local"
125+
{{- end }}
126+
{{- if $.Values.secondaryWorkload.istio.virtualService.http }}
127+
http:
128+
{{ toYaml $.Values.secondaryWorkload.istio.virtualService.http | indent 4 }}
129+
{{- end }}
130+
{{- end }}
60131
{{- end }}

scripts/devtron-reference-helm-charts/deployment-chart_4-20-0/templates/keda-autoscaling.yaml

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,86 @@ metadata:
7474
{{- end }}
7575
spec:
7676
{{ toYaml $.Values.kedaAutoscaling.triggerAuthentication.spec | indent 2 }}
77+
7778
{{- end }}
78-
{{- end }}
79+
{{- end }}
80+
---
81+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.enabled }}
82+
apiVersion: keda.sh/v1alpha1
83+
kind: ScaledObject
84+
metadata:
85+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.name }}
86+
name: {{ $.Values.secondaryWorkload.kedaAutoscaling.name }}
87+
{{- else }}
88+
name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}-keda
89+
{{- end }}
90+
labels:
91+
app: {{ template ".Chart.Name .name" $ }}
92+
chart: {{ template ".Chart.Name .chart" $ }}
93+
release: {{ $.Release.Name }}
94+
appId: {{ $.Values.app | quote }}
95+
envId: {{ $.Values.env | quote }}
96+
release: {{ .Release.Name }}
97+
{{- if .Values.appLabels }}
98+
{{ toYaml .Values.appLabels | indent 4 }}
99+
{{- end }}
100+
{{- if .Values.secondaryWorkload.kedaAutoscaling.labels }}
101+
{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.labels | indent 4 }}
102+
{{- end }}
103+
{{- if .Values.secondaryWorkload.kedaAutoscaling.annotations }}
104+
annotations:
105+
{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.annotations | indent 4 }}
106+
{{- end }}
107+
spec:
108+
scaleTargetRef:
109+
apiVersion: apps/v1
110+
kind: Deployment
111+
name: {{ $.Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" $) ($.Values.secondaryWorkload.postfix | default "sec")) }}
112+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.envSourceContainerName }}
113+
envSourceContainerName: {{ $.Values.secondaryWorkload.kedaAutoscaling.envSourceContainerName }}
114+
{{- end }}
115+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.pollingInterval }}
116+
pollingInterval: {{ $.Values.secondaryWorkload.kedaAutoscaling.pollingInterval }}
117+
{{- end }}
118+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.cooldownPeriod }}
119+
cooldownPeriod: {{ $.Values.secondaryWorkload.kedaAutoscaling.cooldownPeriod }}
120+
{{- end }}
121+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.idleReplicaCount }}
122+
idleReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.idleReplicaCount }}
123+
{{- end }}
124+
minReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.minReplicaCount }}
125+
maxReplicaCount: {{ $.Values.secondaryWorkload.kedaAutoscaling.maxReplicaCount }}
126+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.fallback }}
127+
fallback:
128+
{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.fallback | indent 4 }}
129+
{{- end }}
130+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.advanced }}
131+
advanced:
132+
{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.advanced | indent 4 }}
133+
{{- end }}
134+
triggers:
135+
{{ toYaml .Values.secondaryWorkload.kedaAutoscaling.triggers | indent 2}}
136+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.authenticationRef }}
137+
authenticationRef:
138+
{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.authenticationRef | indent 6 }}
139+
{{- end }}
140+
---
141+
{{- if $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.enabled }}
142+
apiVersion: keda.sh/v1alpha1
143+
kind: TriggerAuthentication
144+
metadata:
145+
name: {{ $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.name }}
146+
labels:
147+
app: {{ template ".Chart.Name .name" $ }}
148+
chart: {{ template ".Chart.Name .chart" $ }}
149+
release: {{ $.Release.Name }}
150+
appId: {{ $.Values.app | quote }}
151+
envId: {{ $.Values.env | quote }}
152+
{{- if .Values.appLabels }}
153+
{{ toYaml .Values.appLabels | indent 4 }}
154+
{{- end }}
155+
spec:
156+
{{ toYaml $.Values.secondaryWorkload.kedaAutoscaling.triggerAuthentication.spec | indent 2 }}
157+
{{- end }}
158+
{{- end }}
159+
---

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

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,83 @@ spec:
111111
app: {{ template ".Chart.Name .name" . }}
112112
{{- end }}
113113
{{- end }}
114+
{{- end }}
115+
{{- end }}
116+
117+
---
118+
{{- if .Values.secondaryWorkload.service.enabled }}
119+
apiVersion: v1
120+
kind: Service
121+
metadata:
122+
name: {{ .Values.secondaryWorkload.fullnameOverride | default (printf "%s-%s" (include ".Chart.Name .fullname" .) (.Values.secondaryWorkload.postfix | default "sec")) }}-service
123+
labels:
124+
app: {{ template ".Chart.Name .name" . }}
125+
appId: {{ $.Values.app | quote }}
126+
envId: {{ $.Values.env | quote }}
127+
chart: {{ template ".Chart.Name .chart" . }}
128+
release: {{ .Release.Name }}
129+
{{- if .Values.appLabels }}
130+
{{ toYaml .Values.appLabels | indent 4 }}
131+
{{- end }}
132+
{{- if .Values.secondaryWorkload.service.annotations }}
133+
annotations:
134+
{{ toYaml .Values.secondaryWorkload.service.annotations | indent 4 }}
135+
{{- end}}
136+
spec:
137+
type: {{ .Values.secondaryWorkload.service.type | default .Values.service.type | default "ClusterIP" }}
138+
{{- with .Values.secondaryWorkload.service.extraSpec }}
139+
{{- toYaml . | nindent 2 }}
140+
{{- end }}
141+
{{- if (eq (.Values.secondaryWorkload.service.type | default .Values.service.type | default "ClusterIP") "LoadBalancer") }}
142+
{{- if .Values.secondaryWorkload.service.loadBalancerIP }}
143+
loadBalancerIP: {{ .Values.secondaryWorkload.service.loadBalancerIP }}
144+
{{- end }}
145+
{{- if .Values.secondaryWorkload.service.loadBalancerSourceRanges }}
146+
loadBalancerSourceRanges:
147+
{{- range .Values.secondaryWorkload.service.loadBalancerSourceRanges }}
148+
- {{ . }}
149+
{{- end }}
150+
{{- end }}
151+
{{- end }}
152+
ports:
153+
{{- $containerPorts := .Values.secondaryWorkload.ContainerPort | default .Values.ContainerPort }}
154+
{{- range $containerPorts }}
155+
{{- if .servicePort }}
156+
- port: {{ .servicePort }}
157+
{{- else }}
158+
- port: {{ .port }}
159+
{{- end }}
160+
{{- if .targetPort }}
161+
targetPort: {{ .targetPort }}
162+
{{- else if $.Values.appMetrics }}
163+
targetPort: envoy-{{ .name }}
164+
{{- else }}
165+
targetPort: {{ .name }}
166+
{{- end }}
167+
protocol: {{ .protocol | default "TCP" }}
168+
{{- if (and (eq ($.Values.secondaryWorkload.service.type | default $.Values.service.type | default "ClusterIP") "NodePort") .nodePort ) }}
169+
nodePort: {{ .nodePort }}
170+
{{- end }}
171+
name: {{ .name }}
172+
{{- end }}
173+
{{- if $.Values.appMetrics }}
174+
- port: 9901
175+
name: envoy-admin
176+
{{- end }}
177+
selector:
178+
{{- if .Values.secondaryWorkload.customPodLabels }}
179+
{{ toYaml .Values.secondaryWorkload.customPodLabels | indent 4 }}
180+
{{- else if .Values.customPodLabels }}
181+
{{ toYaml .Values.customPodLabels | indent 4 }}
182+
{{- else }}
183+
app: {{ template ".Chart.Name .name" . }}
184+
{{- end }}
185+
workload: secondary
186+
{{- if .Values.secondaryWorkload.service.sessionAffinity.enabled }}
187+
sessionAffinity: ClientIP
188+
{{- end }}
189+
{{- if .Values.secondaryWorkload.service.sessionAffinityConfig }}
190+
sessionAffinityConfig:
191+
{{ toYaml .Values.secondaryWorkload.service.sessionAffinityConfig | indent 4 }}
192+
{{- end }}
114193
{{- end }}

0 commit comments

Comments
 (0)