Skip to content

Commit b5b83ec

Browse files
committed
Set image pull policy, pull secret and security context on LTPA Job
Signed-off-by: Leo Christy Jesuraj <[email protected]>
1 parent 47d89ef commit b5b83ec

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

utils/utils.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,11 @@ func CustomizeLTPAJob(job *v1.Job, la *wlv1.WebSphereLibertyApplication, ltpaSec
666666
job.Spec.Template.ObjectMeta.Name = "liberty"
667667
job.Spec.Template.Spec.Containers = []corev1.Container{
668668
{
669-
Name: job.Spec.Template.ObjectMeta.Name,
670-
Image: la.GetApplicationImage(),
671-
Command: []string{"/bin/bash", "-c"},
669+
Name: job.Spec.Template.ObjectMeta.Name,
670+
Image: la.GetApplicationImage(),
671+
ImagePullPolicy: *la.GetPullPolicy(),
672+
SecurityContext: rcoutils.GetSecurityContext(la),
673+
Command: []string{"/bin/bash", "-c"},
672674
// Usage: /bin/create_ltpa_keys.sh <namespace> <ltpa-secret-name> <securityUtility-encoding>
673675
Args: []string{ltpaKeysMountPath + "/bin/create_ltpa_keys.sh " + la.GetNamespace() + " " + ltpaSecretName + " " + ltpaKeysFileName + " " + encodingType},
674676
VolumeMounts: []corev1.VolumeMount{
@@ -679,6 +681,11 @@ func CustomizeLTPAJob(job *v1.Job, la *wlv1.WebSphereLibertyApplication, ltpaSec
679681
},
680682
},
681683
}
684+
if la.GetPullSecret() != nil && *la.GetPullSecret() != "" {
685+
job.Spec.Template.Spec.ImagePullSecrets = append(job.Spec.Template.Spec.ImagePullSecrets, corev1.LocalObjectReference{
686+
Name: *la.GetPullSecret(),
687+
})
688+
}
682689
job.Spec.Template.Spec.ServiceAccountName = serviceAccountName
683690
job.Spec.Template.Spec.RestartPolicy = corev1.RestartPolicyOnFailure
684691
var number int32

0 commit comments

Comments
 (0)