Skip to content

Conversation

@elmiko
Copy link
Contributor

@elmiko elmiko commented Jan 13, 2022

This change updates the AlibabaResourceReference struct to follow a
discriminated union pattern. It now contains a Type field which will
indicate whether the resource reference is an ID, a name, or a list of tags. The
ID and Tags fields have been converted to pointers in following with
that pattern, and some constant values have been added for the various
types.

Additionally, it also converts the previous ResourceGroupID field into
ResourceGroup. This change is being made to convert that field from a
string into the AlibabaResourceReference type so that we can support
multiple types of lookup for the resource group. There are some cases,
notably during installation, where the ID may not be known, and in these
cases the Tags will be used to find the resource group. This change to
the structure gives us a method to detect this option when receiving the
API object in the machine api actuator.

This change makes the VpcID, SecurityGroups, VSwitch, and
ResourceGroups fields required byu removing the +optional and
omitempty annotations. This change is being made to reflect the best
practices when deploying OpenShift on Alibaba Cloud.

When deploying on OpenShift, only the VPC mode is allowed. This means
that the user must specify a VPC ID or the instance creation will fail.
When creating instances in VPC mode, the user must specify a vSwitch or
the operation will fail.

This change updates the AlibabaResourceReference struct to follow a
discriminated union pattern. It now contains a `type` field which will
indicate whether the resource reference is an ID or a list of tags. The
`ID` and `Tags` fields have been converted to pointers in following with
that pattern, and some constant values have been added for the various
types.
This change converts the previous ResourceGroupID field into
ResourceGroup. This change is being made to convert that field from a
string into the AlibabaResourceReference type so that we can support
multiple types of lookup for the resource group. There are some cases,
notably during installation, where the ID may not be known, and in these
cases the Tags will be used to find the resource group. This change to
the structure gives us a method to detect this option when receiving the
API object in the machine api actuator.
@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 moved to the POST state. 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 NEW, 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 AlibabaResourceReference

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 requested a review from jianli-wei January 13, 2022 17:00
@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

/hold until we have a patch ready for the alibaba mapi actuator

@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 13, 2022
@openshift-ci openshift-ci bot requested review from JoelSpeed and mandre January 13, 2022 17:00
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 13, 2022

@elmiko: This pull request references Bugzilla bug 2037209, which is valid.

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 AlibabaResourceReference

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.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

i suppose we don't necessarily need the hold, but i just want to make sure we don't break the alibaba actuator.

@JoelSpeed
Copy link
Contributor

This matches my expectations based on our conversation earlier
/lgtm

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

deads2k commented Jan 13, 2022

I'd like the comments on the usage of the resource reference clarified and then this change lgtm.

This change updates the usages of the AlibabaResourceReference type to
include detailed descriptions of what happens when a tag search can
return multiple results.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

@deads2k updated to include more information about the cases when multiple results could be returned from a tag-based search. i also added a note to the resource struct itself, but it felt a little clunky. let me know what you think.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

this change is required by openshift/cluster-api-provider-alibaba#26

@elmiko
Copy link
Contributor Author

elmiko commented Jan 13, 2022

removing the hold as we have a patch ready to go
/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 13, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

/hold while we discuss some implementation details

@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 14, 2022
@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

it sounds like adding the name field will help with the resource group issue we are tracking
/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 14, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 14, 2022

@elmiko: This pull request references Bugzilla bug 2037209, which is valid.

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 AlibabaResourceReference

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.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

I have a question and I'm curious what happens on zero matches for these.

if there are zero matches for security group or vswitch, that will produce an error when creating the Machine. @JoelSpeed and i are still working through what should happen if there are zero resource groups found. i had thought it should also cause an error, but Joel is pointing out that perhaps some alibaba api queries are acceptable without a resource group. if that is the case, then a zero result on a resource group search wouldn't, by itself, indicate a failure.

@JoelSpeed
Copy link
Contributor

I believe for resource groups, if there are no matches, we would send no resource group ID within the request, in which case, the Alibaba API puts the resource in the default resource group, which may or may not be acceptable.

I think if a user specifies tags/name to match a resource group, and we can't find it, that should be an error. I would only allow this fallback to the default resource group when no resource group configuration is given explicitly

@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

I think if a user specifies tags/name to match a resource group, and we can't find it, that should be an error. I would only allow this fallback to the default resource group when no resource group configuration is given explicitly

this would be in a situation where the user has omitted the ResourceGroup field completely?

that makes me wonder if we should make it a pointer?

@JoelSpeed
Copy link
Contributor

this would be in a situation where the user has omitted the ResourceGroup field completely?
that makes me wonder if we should make it a pointer?

Correct. We should make sure that it is in fact optional, and if it is, make the field a pointer IMO

@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

i'm putting a hold here just to make sure we don't merge before we figure out this resource group issue
/hold

@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 14, 2022
This change makes the `VpcID`, `SecurityGroups`, `VSwitch`, and
`ResourceGroups` fields required byu removing the `+optional` and
`omitempty` annotations. This change is being made to reflect the best
practices when deploying OpenShift on Alibaba Cloud.

When deploying on OpenShift, only the VPC mode is allowed. This means
that the user must specify a VPC ID or the instance creation will fail.
When creating instances in VPC mode, the user must specify a vSwitch or
the operation will fail.
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 14, 2022

@elmiko: This pull request references Bugzilla bug 2037209, which is valid.

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 AlibabaResourceReference

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.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 14, 2022

i think we've resolved all the issue around these fields. i have updated the description, and my last change is essentially the following:

This change makes the VpcID, SecurityGroups, VSwitch, and
ResourceGroups fields required byu removing the +optional and
omitempty annotations. This change is being made to reflect the best
practices when deploying OpenShift on Alibaba Cloud.

When deploying on OpenShift, only the VPC mode is allowed. This means
that the user must specify a VPC ID or the instance creation will fail.
When creating instances in VPC mode, the user must specify a vSwitch or
the operation will fail.

i would like to get @JoelSpeed to review this again and i think we should consult Alibaba as well
/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 14, 2022
// A reference holds either the resource group ID, the resource name, or the required tags to search.
// When more than one resource group are returned for a search, an error will be produced and the Machine will not be created.
// Resource Groups do not support searching by tags.
ResourceGroup AlibabaResourceReference `json:"resourceGroup"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on some of the conversations I've seen on slack, I think this should be optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this still true?

the latest conversations seem to indicate that we can require this field, even for the default resource group.

@jianli-wei
Copy link

@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

@jianli-wei i think those errors are unrelated to this pr.

although, it's possible that an image is not being generated because it can't compile the alibaba actuator without this pr in place.

sorry, i see you are having it build with both PRs in place. it seems like maybe there is a misconfiguration, but i'm not sure why.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

@jianli-wei it looks like you might have launched a cluster from the ci-bot with those 2 PRs ?

assuming that is the case, i think we need to update the installer as well before this will fully work. i am creating a PR to make sure that the installer is updated with these api changes.

As alibaba provider spec has been added to the machine v1, we need a
deepcopy so that we can utilize it in the installer. This change also
adds the deepcopy file for machine v1.
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 21, 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.

@elmiko
Copy link
Contributor Author

elmiko commented Jan 21, 2022

this is also needed by openshift/installer#5562

@JoelSpeed
Copy link
Contributor

/lgtm
/hold

I believe this is ready to go now, @elmiko feel free to hold cancel if you're not aware of any further changes required here

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels 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: deads2k, elmiko, JoelSpeed

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:

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

@elmiko
Copy link
Contributor Author

elmiko commented Jan 24, 2022

thanks @JoelSpeed and @deads2k , i am removing the hold as we have the follow up patches ready to go.
/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 d747270 into openshift:master 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 AlibabaResourceReference

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.

5 participants