Skip to content

Commit c0f0af4

Browse files
Merge pull request #9124 from rna-afk/remove_aro_build_flag
CORS-3855: Remove ARO build flag from installer
2 parents 68f5288 + 0385863 commit c0f0af4

File tree

8 files changed

+10
-76
lines changed

8 files changed

+10
-76
lines changed

pkg/asset/installconfig/azure/validation.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -713,18 +713,15 @@ func validateResourceGroup(client API, fieldPath *field.Path, platform *aztypes.
713713
allErrs = append(allErrs, field.Invalid(fieldPath.Child("resourceGroupName"), platform.ResourceGroupName, fmt.Sprintf("resource group has conflicting tags %s", strings.Join(conflictingTagKeys, ", "))))
714714
}
715715

716-
// ARO provisions Azure resources before resolving the asset graph.
717-
if !platform.IsARO() {
718-
ids, err := client.ListResourceIDsByGroup(context.TODO(), platform.ResourceGroupName)
719-
if err != nil {
720-
return append(allErrs, field.InternalError(fieldPath.Child("resourceGroupName"), fmt.Errorf("failed to list resources in the resource group: %w", err)))
721-
}
722-
if l := len(ids); l > 0 {
723-
if len(ids) > 2 {
724-
ids = ids[:2]
725-
}
726-
allErrs = append(allErrs, field.Invalid(fieldPath.Child("resourceGroupName"), platform.ResourceGroupName, fmt.Sprintf("resource group must be empty but it has %d resources like %s ...", l, strings.Join(ids, ", "))))
716+
ids, err := client.ListResourceIDsByGroup(context.TODO(), platform.ResourceGroupName)
717+
if err != nil {
718+
return append(allErrs, field.InternalError(fieldPath.Child("resourceGroupName"), fmt.Errorf("failed to list resources in the resource group: %w", err)))
719+
}
720+
if l := len(ids); l > 0 {
721+
if len(ids) > 2 {
722+
ids = ids[:2]
727723
}
724+
allErrs = append(allErrs, field.Invalid(fieldPath.Child("resourceGroupName"), platform.ResourceGroupName, fmt.Sprintf("resource group must be empty but it has %d resources like %s ...", l, strings.Join(ids, ", "))))
728725
}
729726
return allErrs
730727
}

pkg/asset/installconfig/azure/validation_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,7 @@ func Test_validateResourceGroup(t *testing.T) {
698698
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-conf-tags": resource group has conflicting tags kubernetes.io_cluster.test-cluster-12345\E$`,
699699
}, {
700700
groupName: "valid-resource-group-with-resources",
701-
// ARO provisions Azure resources before resolving the asset graph,
702-
// so there will always be resources in its resource group.
703-
wantSkip: (&azure.Platform{}).IsARO(),
704-
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-with-resources": resource group must be empty but it has 3 resources like id1, id2 ...\E$`,
701+
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-with-resources": resource group must be empty but it has 3 resources like id1, id2 ...\E$`,
705702
}}
706703

707704
mockCtrl := gomock.NewController(t)

pkg/asset/installconfig/installconfig.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,6 @@ func (a *InstallConfig) finish(ctx context.Context, filename string) error {
180180
// that have already been checked by validation.ValidateInstallConfig().
181181
func (a *InstallConfig) platformValidation(ctx context.Context) error {
182182
if a.Config.Platform.Azure != nil {
183-
if a.Config.Platform.Azure.IsARO() {
184-
// ARO performs platform validation in the Resource Provider before
185-
// the Installer is called
186-
return nil
187-
}
188183
client, err := a.Azure.Client()
189184
if err != nil {
190185
return err

pkg/asset/manifests/cloudproviderconfig.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ func (cpc *CloudProviderConfig) Generate(ctx context.Context, dependencies asset
152152
VirtualNetworkName: vnet,
153153
SubnetName: subnet,
154154
ResourceManagerEndpoint: installConfig.Config.Azure.ARMEndpoint,
155-
ARO: installConfig.Config.Azure.IsARO(),
156155
}.JSON()
157156
if err != nil {
158157
return errors.Wrap(err, "could not create cloud provider config")

pkg/asset/manifests/openshift.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -280,37 +280,6 @@ func (o *Openshift) Generate(ctx context.Context, dependencies asset.Parents) er
280280
assetData["99_baremetal-provisioning-config.yaml"] = applyTemplateData(baremetalConfig.Files()[0].Data, bmTemplateData)
281281
}
282282

283-
if platform == azuretypes.Name && installConfig.Config.Azure.IsARO() && installConfig.Config.CredentialsMode != types.ManualCredentialsMode {
284-
// config is used to created compatible secret to trigger azure cloud
285-
// controller config merge behaviour
286-
// https://github.com/openshift/origin/blob/90c050f5afb4c52ace82b15e126efe98fa798d88/vendor/k8s.io/legacy-cloud-providers/azure/azure_config.go#L83
287-
session, err := installConfig.Azure.Session()
288-
if err != nil {
289-
return err
290-
}
291-
config := struct {
292-
AADClientID string `json:"aadClientId" yaml:"aadClientId"`
293-
AADClientSecret string `json:"aadClientSecret" yaml:"aadClientSecret"`
294-
}{
295-
AADClientID: session.Credentials.ClientID,
296-
AADClientSecret: session.Credentials.ClientSecret,
297-
}
298-
299-
b, err := yaml.Marshal(config)
300-
if err != nil {
301-
return err
302-
}
303-
304-
azureCloudProviderSecret := &openshift.AzureCloudProviderSecret{}
305-
dependencies.Get(azureCloudProviderSecret)
306-
for _, f := range azureCloudProviderSecret.Files() {
307-
name := strings.TrimSuffix(filepath.Base(f.Filename), ".template")
308-
assetData[name] = applyTemplateData(f.Data, map[string]string{
309-
"CloudConfig": string(b),
310-
})
311-
}
312-
}
313-
314283
o.FileList = []*asset.File{}
315284
for name, data := range assetData {
316285
if len(data) == 0 {

pkg/types/azure/platform.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,6 @@ func (p *Platform) NetworkSecurityGroupName(infraID string) string {
193193
return fmt.Sprintf("%s-nsg", infraID)
194194
}
195195

196-
// IsARO returns true if ARO-only modifications are enabled
197-
func (p *Platform) IsARO() bool {
198-
return aro
199-
}
200-
201196
// GetStorageAccountName takes an infraID and generates a
202197
// storage account name, which can't be more than 24 characters.
203198
func GetStorageAccountName(infraID string) string {

pkg/types/azure/validation/platform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func ValidatePlatform(p *azure.Platform, publish types.PublishingStrategy, fldPa
6161
if p.Region == "" {
6262
allErrs = append(allErrs, field.Required(fldPath.Child("region"), "region should be set to one of the supported Azure regions"))
6363
}
64-
if !p.IsARO() && publish != types.InternalPublishingStrategy {
64+
if publish != types.InternalPublishingStrategy {
6565
if p.BaseDomainResourceGroupName == "" {
6666
allErrs = append(allErrs, field.Required(fldPath.Child("baseDomainResourceGroupName"), "baseDomainResourceGroupName is the resource group name where the azure dns zone is deployed"))
6767
}

pkg/types/azure/validation/platform_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,13 @@ func TestValidatePlatform(t *testing.T) {
5858
},
5959
{
6060
name: "invalid baseDomainResourceGroupName",
61-
wantSkip: func(p *azure.Platform) bool {
62-
// This test case doesn't apply to ARO
63-
// so we want to skip it when run tests for ARO build
64-
return p.IsARO()
65-
},
6661
platform: func() *azure.Platform {
6762
p := validPlatform()
6863
p.BaseDomainResourceGroupName = ""
6964
return p
7065
}(),
7166
expected: `^test-path\.baseDomainResourceGroupName: Required value: baseDomainResourceGroupName is the resource group name where the azure dns zone is deployed$`,
7267
},
73-
{
74-
name: "do not require baseDomainResourceGroupName on ARO",
75-
wantSkip: func(p *azure.Platform) bool {
76-
// This is a ARO-specific test case
77-
// so want to skip when running non-ARO builds
78-
return !p.IsARO()
79-
},
80-
platform: func() *azure.Platform {
81-
p := validPlatform()
82-
p.BaseDomainResourceGroupName = ""
83-
return p
84-
}(),
85-
},
8668
{
8769
name: "minimal",
8870
platform: validPlatform(),

0 commit comments

Comments
 (0)