@@ -1160,17 +1160,29 @@ func (r *ReconcileWebSphereLiberty) getContainerImageMetadata(reqLogger logr.Log
11601160 wlappSecrets := []corev1.Secret {}
11611161 var pullSecret * corev1.Secret
11621162 if wlapp .GetPullSecret () != nil {
1163- pullSecret = & corev1.Secret {}
1164- if err := r .GetClient ().Get (context .TODO (), types.NamespacedName {Name : * wlapp .GetPullSecret (), Namespace : wlapp .GetNamespace ()}, pullSecret ); err != nil {
1165- if kerrors .IsNotFound (err ) {
1166- reqLogger .Info ("The instance pull secret specified does not exist" )
1167- pullSecret = nil
1168- } else {
1169- reqLogger .Error (err , "Failed to get the instance pull secret" )
1170- return "" , nil , fmt .Errorf ("Failed to get the instance pull secret: %v" , err )
1163+ pullSecretString := strings .TrimSpace (* wlapp .GetPullSecret ())
1164+ pullSecretNames := []string {}
1165+ if strings .Contains (pullSecretString , "," ) {
1166+ pullSecretNames = strings .Split (pullSecretString , "," )
1167+ } else {
1168+ pullSecretNames = append (pullSecretNames , pullSecretString )
1169+ }
1170+ for _ , pullSecretName := range pullSecretNames {
1171+ pullSecretName = strings .TrimSpace (pullSecretName )
1172+ pullSecret = & corev1.Secret {}
1173+ if err := r .GetClient ().Get (context .TODO (), types.NamespacedName {Name : pullSecretName , Namespace : wlapp .GetNamespace ()}, pullSecret ); err != nil {
1174+ if kerrors .IsNotFound (err ) {
1175+ reqLogger .Info (fmt .Sprintf ("The instance pull secret %s does not exist" , pullSecretName ))
1176+ pullSecret = nil
1177+ } else {
1178+ reqLogger .Error (err , fmt .Sprintf ("Failed to get the instance pull secret %s" , pullSecretName ))
1179+ return "" , nil , fmt .Errorf ("Failed to get the instance pull secret %s: %v" , pullSecretName , err )
1180+ }
1181+ }
1182+ if pullSecret != nil {
1183+ wlappSecrets = append (wlappSecrets , * pullSecret )
11711184 }
11721185 }
1173- wlappSecrets = append (wlappSecrets , * pullSecret )
11741186 }
11751187 return libertyimage .NewNamespaceCredentialsContext (reqLogger , wlappSecrets , wlapp .GetNamespace ()).GetContainerImageMetadata (context .TODO (), imageRef , pullSecret , false )
11761188}
0 commit comments