Skip to content

Commit 0385863

Browse files
committed
aro: Remove CCO creds from installer
Removing CCO creds from the installer. Keeping a commit to revert to in case there's trouble on ARO front.
1 parent 6ae1173 commit 0385863

File tree

3 files changed

+0
-73
lines changed

3 files changed

+0
-73
lines changed

pkg/asset/installconfig/azure/client.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
azstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
1818
"github.com/Azure/go-autorest/autorest/to"
1919
"k8s.io/apimachinery/pkg/util/sets"
20-
"k8s.io/utils/ptr"
2120
)
2221

2322
//go:generate mockgen -source=./client.go -destination=mock/azureclient_generated.go -package=mock
@@ -44,12 +43,8 @@ type API interface {
4443
GetAvailabilityZones(ctx context.Context, region string, instanceType string) ([]string, error)
4544
GetLocationInfo(ctx context.Context, region string, instanceType string) (*azenc.ResourceSkuLocationInfo, error)
4645
CheckIfExistsStorageAccount(ctx context.Context, resourceGroup, storageAccountName, region string) error
47-
CheckIfARO(ctx context.Context, groupName string) (bool, error)
4846
}
4947

50-
var aro *bool
51-
var aroTag = "installer-aro"
52-
5348
// Client makes calls to the Azure API.
5449
type Client struct {
5550
ssn *Session
@@ -248,30 +243,6 @@ func (c *Client) GetGroup(ctx context.Context, groupName string) (*azres.Group,
248243
return &res, nil
249244
}
250245

251-
// CheckIfARO checks the existing resource group provided for specific tag
252-
// to see if the value set is to ARO. If set, the installer will ignore multiple
253-
// checks/validations and perform ARO specific tasks.
254-
func (c *Client) CheckIfARO(ctx context.Context, groupName string) (bool, error) {
255-
if aro != nil {
256-
return *aro, nil
257-
}
258-
if groupName == "" {
259-
return false, nil
260-
}
261-
group, err := c.GetGroup(ctx, groupName)
262-
if err != nil {
263-
return false, err
264-
}
265-
rgTags := group.Tags
266-
aro = ptr.To(false)
267-
if value, ok := rgTags[aroTag]; ok {
268-
if value != nil && *value == "owned" {
269-
aro = ptr.To(true)
270-
}
271-
}
272-
return *aro, nil
273-
}
274-
275246
// ListResourceIDsByGroup returns a list of resource IDs for resource group groupName.
276247
func (c *Client) ListResourceIDsByGroup(ctx context.Context, groupName string) ([]string, error) {
277248
client := azres.NewClientWithBaseURI(c.ssn.Environment.ResourceManagerEndpoint, c.ssn.Credentials.SubscriptionID)

pkg/asset/installconfig/azure/validation_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,6 @@ func TestAzureInstallConfigValidation(t *testing.T) {
635635

636636
azureClient.EXPECT().CheckIfExistsStorageAccount(gomock.Any(), validBootDiagnosticsResourceGroup, validBootDiagnosticsStorageAccount, validRegion).Return(nil)
637637

638-
// ARO specific code
639-
azureClient.EXPECT().CheckIfARO(gomock.Any(), gomock.Not("valid-resource-group-with-resources-aro")).Return(false, nil).AnyTimes()
640-
azureClient.EXPECT().CheckIfARO(gomock.Any(), "valid-resource-group-with-resources-aro").Return(true, nil).AnyTimes()
641-
642638
for _, tc := range cases {
643639
t.Run(tc.name, func(t *testing.T) {
644640
editedInstallConfig := validInstallConfig()

pkg/asset/manifests/openshift.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -279,46 +279,6 @@ func (o *Openshift) Generate(ctx context.Context, dependencies asset.Parents) er
279279
}
280280
assetData["99_baremetal-provisioning-config.yaml"] = applyTemplateData(baremetalConfig.Files()[0].Data, bmTemplateData)
281281
}
282-
if platform == azuretypes.Name {
283-
var aro bool
284-
client, err := installConfig.Azure.Client()
285-
if err == nil {
286-
isAro, err := client.CheckIfARO(context.TODO(), installConfig.Config.Azure.ResourceGroupName)
287-
if err == nil {
288-
aro = isAro
289-
}
290-
}
291-
if aro && installConfig.Config.CredentialsMode != types.ManualCredentialsMode {
292-
// config is used to created compatible secret to trigger azure cloud
293-
// controller config merge behaviour
294-
// https://github.com/openshift/origin/blob/90c050f5afb4c52ace82b15e126efe98fa798d88/vendor/k8s.io/legacy-cloud-providers/azure/azure_config.go#L83
295-
session, err := installConfig.Azure.Session()
296-
if err != nil {
297-
return err
298-
}
299-
config := struct {
300-
AADClientID string `json:"aadClientId" yaml:"aadClientId"`
301-
AADClientSecret string `json:"aadClientSecret" yaml:"aadClientSecret"`
302-
}{
303-
AADClientID: session.Credentials.ClientID,
304-
AADClientSecret: session.Credentials.ClientSecret,
305-
}
306-
307-
b, err := yaml.Marshal(config)
308-
if err != nil {
309-
return err
310-
}
311-
312-
azureCloudProviderSecret := &openshift.AzureCloudProviderSecret{}
313-
dependencies.Get(azureCloudProviderSecret)
314-
for _, f := range azureCloudProviderSecret.Files() {
315-
name := strings.TrimSuffix(filepath.Base(f.Filename), ".template")
316-
assetData[name] = applyTemplateData(f.Data, map[string]string{
317-
"CloudConfig": string(b),
318-
})
319-
}
320-
}
321-
}
322282

323283
o.FileList = []*asset.File{}
324284
for name, data := range assetData {

0 commit comments

Comments
 (0)