File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
485507func (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 {
You can’t perform that action at this time.
0 commit comments