Skip to content

Commit 830720f

Browse files
committed
adds blanket variable to add containers into daemonset or deployment
1 parent af8ca53 commit 830720f

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

charts/nginx-gateway-fabric/templates/deployment.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ spec:
165165
{{- with .Values.nginxGateway.extraVolumeMounts -}}
166166
{{ toYaml . | nindent 8 }}
167167
{{- end }}
168-
{{- if .Values.nginxGateway.extraContainers }}
169-
{{- toYaml .Values.nginxGateway.extraContainers | nindent 6 }}
170-
{{- end }}
171168
{{- if .Values.nginxGateway.topologySpreadConstraints }}
172169
topologySpreadConstraints:
173170
{{- toYaml .Values.nginxGateway.topologySpreadConstraints | nindent 8 }}

charts/nginx-gateway-fabric/templates/nginxproxy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ spec:
2626
{{- if .Values.nginx.debug }}
2727
debug: {{ .Values.nginx.debug }}
2828
{{- end }}
29+
{{- if .Values.nginxGateway.extraContainers }}
30+
{{- toYaml .Values.nginxGateway.extraContainers | nindent 6 }}
31+
{{- end }}
2932
{{- end }}
3033
{{- if eq .Values.nginx.kind "daemonSet" }}
3134
daemonSet:
@@ -42,6 +45,9 @@ spec:
4245
{{- if .Values.nginx.debug }}
4346
debug: {{ .Values.nginx.debug }}
4447
{{- end }}
48+
{{- if .Values.nginxGateway.extraContainers }}
49+
{{- toYaml .Values.nginxGateway.extraContainers | nindent 6 }}
50+
{{- end }}
4551
{{- end }}
4652
{{- if .Values.nginx.service }}
4753
service:

internal/controller/provisioner/objects_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ func TestBuildNginxResourceObjects_DaemonSet(t *testing.T) {
673673
},
674674
ExtraContainers: []corev1.Container{
675675
{
676-
Image: "hello-wordl:linux",
676+
Image: "hello-world:linux",
677677
ImagePullPolicy: corev1.PullAlways,
678678
Resources: corev1.ResourceRequirements{
679679
Limits: corev1.ResourceList{
@@ -682,7 +682,7 @@ func TestBuildNginxResourceObjects_DaemonSet(t *testing.T) {
682682
},
683683
},
684684
{
685-
Image: "hello-wordl:nanoserver-ltsc2025",
685+
Image: "hello-world:nanoserver-ltsc2025",
686686
ImagePullPolicy: corev1.PullAlways,
687687
Resources: corev1.ResourceRequirements{
688688
Limits: corev1.ResourceList{
@@ -721,8 +721,19 @@ func TestBuildNginxResourceObjects_DaemonSet(t *testing.T) {
721721
g.Expect(container.ImagePullPolicy).To(Equal(corev1.PullAlways))
722722
g.Expect(container.Resources.Limits).To(HaveKey(corev1.ResourceCPU))
723723
g.Expect(container.Resources.Limits[corev1.ResourceCPU].Format).To(Equal(resource.Format("100m")))
724-
}
725724

725+
extraContainerOne := template.Spec.Containers[1]
726+
g.Expect(extraContainerOne.Image).To(Equal("hello-world:linux"))
727+
g.Expect(extraContainerOne.ImagePullPolicy).To(Equal(corev1.PullAlways))
728+
g.Expect(extraContainerOne.Resources.Limits).To(HaveKey(corev1.ResourceCPU))
729+
g.Expect(extraContainerOne.Resources.Limits[corev1.ResourceCPU].Format).To(Equal(resource.Format("100m")))
730+
731+
extraContainerTwo := template.Spec.Containers[2]
732+
g.Expect(extraContainerTwo.Image).To(Equal("hello-world:nanoserver-ltsc2025"))
733+
g.Expect(extraContainerTwo.ImagePullPolicy).To(Equal(corev1.PullAlways))
734+
g.Expect(extraContainerTwo.Resources.Limits).To(HaveKey(corev1.ResourceCPU))
735+
g.Expect(extraContainerTwo.Resources.Limits[corev1.ResourceCPU].Format).To(Equal(resource.Format("100m")))
736+
}
726737
func TestBuildNginxResourceObjects_OpenShift(t *testing.T) {
727738
t.Parallel()
728739
g := NewWithT(t)

0 commit comments

Comments
 (0)