@@ -27,6 +27,7 @@ type Metadata struct {
2727 computeSubnets map [string ]Subnet
2828 controlPlaneSubnets map [string ]Subnet
2929 dnsInstance * DNSInstance
30+ publishStrategy types.PublishingStrategy
3031 serviceEndpoints []configv1.IBMCloudServiceEndpoint
3132
3233 mutex sync.Mutex
@@ -46,6 +47,7 @@ func NewMetadata(config *types.InstallConfig) *Metadata {
4647 BaseDomain : config .BaseDomain ,
4748 ComputeSubnetNames : config .Platform .IBMCloud .ComputeSubnets ,
4849 ControlPlaneSubnetNames : config .Platform .IBMCloud .ControlPlaneSubnets ,
50+ publishStrategy : config .Publish ,
4951 Region : config .Platform .IBMCloud .Region ,
5052 serviceEndpoints : config .Platform .IBMCloud .ServiceEndpoints ,
5153 }
@@ -79,7 +81,8 @@ func (m *Metadata) CISInstanceCRN(ctx context.Context) (string, error) {
7981 m .mutex .Lock ()
8082 defer m .mutex .Unlock ()
8183
82- if m .cisInstanceCRN == "" {
84+ // Only attempt to find the CIS instance if using ExternalPublishingStrategy and we have not collected it already
85+ if m .publishStrategy == types .ExternalPublishingStrategy && m .cisInstanceCRN == "" {
8386 client , err := m .Client ()
8487 if err != nil {
8588 return "" , err
@@ -111,8 +114,9 @@ func (m *Metadata) DNSInstance(ctx context.Context) (*DNSInstance, error) {
111114 m .mutex .Lock ()
112115 defer m .mutex .Unlock ()
113116
114- // Prevent multiple attempts to retrieve (set) the dnsInstance if it hasn't been set (multiple threads reach mutex concurrently)
115- if m .dnsInstance == nil {
117+ // Only attempt to find the DNS Services instance if using InternalPublishingStrategy and also
118+ // prevent multiple attempts to retrieve (set) the dnsInstance if it hasn't been set (multiple threads reach mutex concurrently)
119+ if m .publishStrategy == types .InternalPublishingStrategy && m .dnsInstance == nil {
116120 client , err := m .Client ()
117121 if err != nil {
118122 return nil , err
0 commit comments