Skip to content

Commit

Permalink
rpaasvalidation: add support to build pod with initContainers
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Jun 25, 2024
1 parent 4bf965d commit 69dbd2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions controllers/validation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ func newValidationPod(validationMergedWithFlavors *v1alpha1.RpaasValidation, val
},
},
Spec: corev1.PodSpec{
InitContainers: validationMergedWithFlavors.Spec.PodTemplate.InitContainers,
Containers: []corev1.Container{
{
Name: "validation",
Expand Down
22 changes: 22 additions & 0 deletions controllers/validation_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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",
Expand Down

0 comments on commit 69dbd2e

Please sign in to comment.