Skip to content

Commit 94fec8e

Browse files
Merge pull request #8057 from miyamotoh/empty-cis-for-private-clusters
OCPBUGS-29765: Fills CIS or DNS CRN in Metadata, never both
2 parents 2e7e078 + aa0264f commit 94fec8e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pkg/asset/installconfig/installconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (a *InstallConfig) finish(filename string) error {
151151
a.IBMCloud = icibmcloud.NewMetadata(a.Config)
152152
}
153153
if a.Config.PowerVS != nil {
154-
a.PowerVS = icpowervs.NewMetadata(a.Config.BaseDomain)
154+
a.PowerVS = icpowervs.NewMetadata(a.Config)
155155
}
156156
if a.Config.VSphere != nil {
157157
a.VSphere = icvsphere.NewMetadata()

pkg/asset/installconfig/powervs/metadata.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ type MetadataAPI interface {
2525
// do not need to be user-supplied (e.g. because it can be retrieved
2626
// from external APIs).
2727
type Metadata struct {
28-
BaseDomain string
28+
BaseDomain string
29+
PublishStrategy types.PublishingStrategy
2930

3031
accountID string
3132
apiKey string
@@ -37,8 +38,8 @@ type Metadata struct {
3738
}
3839

3940
// NewMetadata initializes a new Metadata object.
40-
func NewMetadata(baseDomain string) *Metadata {
41-
return &Metadata{BaseDomain: baseDomain}
41+
func NewMetadata(config *types.InstallConfig) *Metadata {
42+
return &Metadata{BaseDomain: config.BaseDomain, PublishStrategy: config.Publish}
4243
}
4344

4445
// AccountID returns the IBM Cloud account ID associated with the authentication
@@ -104,7 +105,7 @@ func (m *Metadata) CISInstanceCRN(ctx context.Context) (string, error) {
104105
m.client = client
105106
}
106107

107-
if m.cisInstanceCRN == "" {
108+
if m.PublishStrategy == types.ExternalPublishingStrategy && m.cisInstanceCRN == "" {
108109
m.cisInstanceCRN, err = m.client.GetInstanceCRNByName(ctx, m.BaseDomain, types.ExternalPublishingStrategy)
109110
if err != nil {
110111
return "", err
@@ -134,7 +135,7 @@ func (m *Metadata) DNSInstanceCRN(ctx context.Context) (string, error) {
134135
m.client = client
135136
}
136137

137-
if m.dnsInstanceCRN == "" {
138+
if m.PublishStrategy == types.InternalPublishingStrategy && m.dnsInstanceCRN == "" {
138139
m.dnsInstanceCRN, err = m.client.GetInstanceCRNByName(ctx, m.BaseDomain, types.InternalPublishingStrategy)
139140
if err != nil {
140141
return "", err

0 commit comments

Comments
 (0)