Skip to content

Bug 2037209: refactor for AlibabaResourceReference changes#26

Merged
openshift-merge-robot merged 2 commits intoopenshift:mainfrom
elmiko:refactor-resource-types
Jan 24, 2022
Merged

Bug 2037209: refactor for AlibabaResourceReference changes#26
openshift-merge-robot merged 2 commits intoopenshift:mainfrom
elmiko:refactor-resource-types

Conversation

@elmiko
Copy link
Contributor

@elmiko elmiko commented Jan 13, 2022

This change updates the logic around security group IDs, vswitch IDs,
and resource group IDs to match the union changes in the resource
reference API. AlibabaResourceReferences now contain a Type variable
which indicates whether it is an ID or a list of Tags.

The behavior has not been changed for security groups, vswitches, and
resource groups. This change is being added to help allow for scenarios
where the ResourceGroupID is not known and must be searched. Now that
the AlibabaResourceReference contains a discriminating union of ID and
Tags, we can properly address scenarios with limited information.

@openshift-ci openshift-ci bot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jan 13, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 13, 2022

@elmiko: This pull request references Bugzilla bug 2037209, which is valid. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @jianli-wei

Details

In response to this:

Bug 2037209: refactor for AlibabaResourceReference changes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

this is most likely going to fail until we merge the API changes in openshift/api#1096

// An error will be returned if no group id can be found, or if multiple groups are
// found from the search tags.
func getResourceGroupId(machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig) (string, error) {
switch machineProviderConfig.ResourceGroup.Type {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when resource group is nil? Is this allowed? IIRC someone said resource group was an optional field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like we fail if the resource group is nil currently, the way the code is structured i'm not sure how it's supposed to find the security groups without the group id. but maybe that's ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i asked around a little bit, and we should not allow creation of resources in the default group. the user should always specify the resource group.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a comment about most customers using the default group, are we sure this is correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, i worded that poorly. we definitely should allow creation in the default group, but we should force the user to always specify the resource group so that there are no surprises when creating new machines.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that resource group will never be nil in a provider config https://github.com/openshift/api/blob/master/machine/v1/types_alibabaprovider.go#L140 it's not a pointer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, we agreed that the user should always provide this information, even in the case where they want to use the default resource group. this will help ensure that the user isn't creating resources in the wrong group by accident.

@elmiko elmiko force-pushed the refactor-resource-types branch 2 times, most recently from 3f585d6 to b7f49e3 Compare January 14, 2022 20:12
@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

updated to match the API changes and to reflect our requirements

@jianli-wei
Copy link

@elmiko
Copy link
Contributor Author

elmiko commented Jan 17, 2022

@jianli-wei it looks like it is still unable to build this, until we get the api change in place.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

/hold this will need to revendor the api before we can merge it

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 21, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

here is the installer patch that should work this as well, openshift/installer#5562

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 21, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

i have added a second commit to vendor from my branch of the api, this is only for testing and should be replaced before we merge.

This change updates the logic around security group IDs, vswitch IDs,
and resource group IDs to match the union changes in the resource
reference API. AlibabaResourceReferences now contain a `Type` variable
which indicates whether it is an ID or a list of Tags.

The behavior has not been changed for security groups, vswitches, and
resource groups. This change is being added to help allow for scenarios
where the ResourceGroupID is not known and must be searched. Now that
the AlibabaResourceReference contains a discriminating union of ID and
Tags, we can properly address scenarios with limited information.
@elmiko elmiko force-pushed the refactor-resource-types branch from b0f5174 to bf65da9 Compare January 21, 2022 21:22
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 21, 2022
@elmiko elmiko force-pushed the refactor-resource-types branch from bf65da9 to 1bf50a9 Compare January 21, 2022 21:37
This is required to support the resource reference changes.
@elmiko elmiko force-pushed the refactor-resource-types branch from 1bf50a9 to d773426 Compare January 24, 2022 14:43
@elmiko
Copy link
Contributor Author

elmiko commented Jan 24, 2022

now that the API changes have merged, i have revendored this repository. we need one final round of manual testing before releasing the hold here.

Copy link

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

// An error will be returned if no group id can be found, or if multiple groups are
// found from the search tags.
func getResourceGroupId(machineProviderConfig *machinev1.AlibabaCloudMachineProviderConfig) (string, error) {
switch machineProviderConfig.ResourceGroup.Type {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that resource group will never be nil in a provider config https://github.com/openshift/api/blob/master/machine/v1/types_alibabaprovider.go#L140 it's not a pointer

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 24, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demichev, elmiko

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [alexander-demichev,elmiko]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 24, 2022

@elmiko: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@kwoodson
Copy link
Contributor

Test with this code today:

        resourceGroup:
          id: rg-xxxxxx
          type: ID

and

test-rx6ff-worker-us-east-1a-vdr6m   Ready    worker   14m   v1.23.0+06791f6
test-rx6ff-worker-us-east-1b-8l777   Ready    worker   14m   v1.23.0+06791f6
test-rx6ff-worker-us-east-1b-plcst   Ready    worker   16m   v1.23.0+06791f6
openshift-machine-api   test-rx6ff-worker-us-east-1a-vdr6m   Running   ecs.g6.large    us-east-1   us-east-1a   33m
openshift-machine-api   test-rx6ff-worker-us-east-1b-8l777   Running   ecs.g6.large    us-east-1   us-east-1b   33m
openshift-machine-api   test-rx6ff-worker-us-east-1b-plcst   Running   ecs.g6.large    us-east-1   us-east-1b   33m

/lgtm

@elmiko
Copy link
Contributor Author

elmiko commented Jan 24, 2022

removing the hold here as we have a good test signal. thanks @kwoodson !
/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 24, 2022
@openshift-merge-robot openshift-merge-robot merged commit 00f93af into openshift:main Jan 24, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 24, 2022

@elmiko: Some pull requests linked via external trackers have merged:

The following pull requests linked via external trackers have not merged:

These pull request must merge or be unlinked from the Bugzilla bug in order for it to move to the next state. Once unlinked, request a bug refresh with /bugzilla refresh.

Bugzilla bug 2037209 has not been moved to the MODIFIED state.

Details

In response to this:

Bug 2037209: refactor for AlibabaResourceReference changes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments