From 69dbd2e1c4ff67786b0f56cb45a91c81e1e2caaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Tue, 25 Jun 2024 14:52:47 -0300 Subject: [PATCH] rpaasvalidation: add support to build pod with initContainers --- controllers/validation_controller.go | 1 + controllers/validation_controller_test.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/controllers/validation_controller.go b/controllers/validation_controller.go index f2061d16..8d8d931c 100644 --- a/controllers/validation_controller.go +++ b/controllers/validation_controller.go @@ -380,6 +380,7 @@ func newValidationPod(validationMergedWithFlavors *v1alpha1.RpaasValidation, val }, }, Spec: corev1.PodSpec{ + InitContainers: validationMergedWithFlavors.Spec.PodTemplate.InitContainers, Containers: []corev1.Container{ { Name: "validation", diff --git a/controllers/validation_controller_test.go b/controllers/validation_controller_test.go index 40484c10..fa9c8578 100644 --- a/controllers/validation_controller_test.go +++ b/controllers/validation_controller_test.go @@ -479,6 +479,19 @@ func TestValidationControllerReconcicleManyFlavors(t *testing.T) { Name: "banana", Namespace: "default", }, + Spec: v1alpha1.RpaasFlavorSpec{ + InstanceTemplate: &v1alpha1.RpaasInstanceSpec{ + PodTemplate: nginxv1alpha1.NginxPodTemplateSpec{ + InitContainers: []corev1.Container{ + { + Name: "do-something", + Image: "busybox", + Args: []string{"cp /tmp/blah /etc/blah"}, + }, + }, + }, + }, + }, }, &v1alpha1.RpaasFlavor{ @@ -498,6 +511,15 @@ func TestValidationControllerReconcicleManyFlavors(t *testing.T) { require.NoError(t, err) assert.Equal(t, corev1.PodSpec{ + InitContainers: []corev1.Container{ + { + Name: "do-something", + Image: "busybox", + Args: []string{ + "cp /tmp/blah /etc/blah", + }, + }, + }, Volumes: []corev1.Volume{ { Name: "nginx-config",