Skip to content

Commit

Permalink
fix: make name and sa name override work (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
spoukke authored and Thibaut-Padok committed May 2, 2023
1 parent e71a85b commit 9b2deca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/controllers/terraformlayer/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ func (r *Reconciler) getPod(layer *configv1alpha1.TerraformLayer, repository *co
defaultSpec.Containers[0].VolumeMounts = append(defaultSpec.Containers[0].VolumeMounts, overrideSpec.VolumeMounts...)
defaultSpec.Containers[0].Resources = overrideSpec.Resources
defaultSpec.Containers[0].EnvFrom = append(defaultSpec.Containers[0].EnvFrom, overrideSpec.EnvFrom...)
defaultSpec.Containers[0].Image = overrideSpec.Image
defaultSpec.ServiceAccountName = overrideSpec.ServiceAccountName
defaultSpec.ImagePullSecrets = append(defaultSpec.ImagePullSecrets, overrideSpec.ImagePullSecrets...)

if len(overrideSpec.ServiceAccountName) > 0 {
defaultSpec.ServiceAccountName = overrideSpec.ServiceAccountName
}
if len(overrideSpec.Image) > 0 {
defaultSpec.Containers[0].Image = overrideSpec.Image
}

pod := corev1.Pod{
Spec: defaultSpec,
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 9b2deca

Please sign in to comment.