Skip to content

Commit 494cf1a

Browse files
naveenpaul1tangledbytes
authored andcommitted
IAM | Missing IAM port during upgrade
Signed-off-by: Naveen Paul <napaul@redhat.com> (cherry picked from commit 0555d13)
1 parent dca14b5 commit 494cf1a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

pkg/system/phase4_configuring.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,34 @@ func (r *Reconciler) SetDesiredDeploymentEndpoint() error {
476476

477477
r.DeploymentEndpoint.Spec.Template.Annotations["noobaa.io/configmap-hash"] = r.CoreAppConfig.Annotations["noobaa.io/configmap-hash"]
478478

479+
r.addIamContainerPortIfNotExists(c)
480+
479481
return r.setDesiredEndpointMounts(podSpec, c)
480482
}
481483
}
482484
return nil
483485
}
484486

487+
// addIamContainerPortIfNotExists adds a container port to the container's ports list
488+
// only if a port with the same name doesn't already exist
489+
func (r *Reconciler) addIamContainerPortIfNotExists(container *corev1.Container) {
490+
iamPorts := corev1.ContainerPort{
491+
Name: "iam-https",
492+
ContainerPort: 13443,
493+
Protocol: corev1.ProtocolTCP,
494+
}
495+
// Check if the port already exists
496+
for _, existingPort := range container.Ports {
497+
if existingPort.Name == iamPorts.Name {
498+
// Port already exists, don't add it
499+
return
500+
}
501+
}
502+
503+
// Port doesn't exist, add it
504+
container.Ports = append(container.Ports, iamPorts)
505+
}
506+
485507
func (r *Reconciler) setDesiredRootMasterKeyMounts(podSpec *corev1.PodSpec, container *corev1.Container) {
486508
// Don't map secret map volume if the string secret is used
487509
if len(r.SecretRootMasterKey) > 0 {

0 commit comments

Comments
 (0)