Skip to content

Commit 4ae7799

Browse files
committed
pkg/types: create PublicAPI helper function
With the introduction of Mixed publishing strategies, it has become more complex to determine if the API load balancer should be public. This creates a helper function to reduce complexity throughout the codebase.
1 parent 28e30ea commit 4ae7799

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/types/installconfig.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,3 +591,16 @@ func ClusterAPIFeatureGateEnabled(platform string, fgs featuregates.FeatureGate)
591591
return false
592592
}
593593
}
594+
595+
// PublicAPI indicates whether the API load balancer should be public
596+
// by inspecting the cluster and operator publishing strategies.
597+
func (c *InstallConfig) PublicAPI() bool {
598+
if c.Publish == ExternalPublishingStrategy {
599+
return true
600+
}
601+
602+
if op := c.OperatorPublishingStrategy; op != nil && strings.EqualFold(op.APIServer, "External") {
603+
return true
604+
}
605+
return false
606+
}

0 commit comments

Comments
 (0)