-
Notifications
You must be signed in to change notification settings - Fork 191
Refactor dynamic validator #1615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please rebase pull request. |
It is a simplified constructor for dynamic validator used in the ARO operator.
6d2dffc to
b4730a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I like the separation of the dynamic validator. One quick question about the constructor: subscriptionID is not necessary it seems.
and the necessary clients for the ServicePrincipalValidtor to perform the check in the operator.
Edit: subscriptionID is necessary to create clients from functions in dynamic constructor 👍🏽
Edit 2: The clientset is nil, because the ValidateServicePrincipal doesn't use any of them, so the subscriptionID is not necessary in this constructor.
| }, nil | ||
| } | ||
|
|
||
| func NewServicePrincipalValidator(log *logrus.Entry, azEnv *azureclient.AROEnvironment, subscriptionID string, authorizerType AuthorizerType) (ServicePrincipalValidator, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| func NewServicePrincipalValidator(log *logrus.Entry, azEnv *azureclient.AROEnvironment, subscriptionID string, authorizerType AuthorizerType) (ServicePrincipalValidator, error) { | |
| func NewServicePrincipalValidator(log *logrus.Entry, azEnv *azureclient.AROEnvironment, authorizerType AuthorizerType) (ServicePrincipalValidator, error) { |
We are not using the subscriptionID anywhere in this function. I don't think this is necessary for the constructor.
Is this missing the clients necessary to do the ValidateServicePrincipal check that it had when it was a full dynamic validator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, disregard.
Edit: See below comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, @troy0820, I think you were right. subscriptionID is not used anywhere. It is passed into the function and then it dies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nilsanderselde The subscriptionID is passed into this constructor to fulfill the functions that create the rest of the dynamic type, it's just not explicitly set because this happens with functions below on the dynamic struct fields.
Edit: I don't believe that it uses these clients, so the subscriptionID isn't necessary.
providers: features.NewProvidersClient(azEnv, subscriptionID, authorizer),
spComputeUsage: compute.NewUsageClient(azEnv, subscriptionID, authorizer),
spNetworkUsage: network.NewUsageClient(azEnv, subscriptionID, authorizer),
permissions: authorization.NewPermissionsClient(azEnv, subscriptionID, authorizer),
virtualNetworks: newVirtualNetworksCache(network.NewVirtualNetworksClient(azEnv, subscriptionID, authorizer)),
diskEncryptionSets: compute.NewDiskEncryptionSetsClient(azEnv, subscriptionID, authorizer),
It doesn't need to be explicitly set because the subscriptionID is necessary for the above functions in the creation of this type.
The subscriptionID is necessary to build the clients to perform the check. 👍🏽
troy0820
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/azp run e2e |
|
Azure Pipelines successfully started running 1 pipeline(s). |
nilsanderselde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Param subscriptionID is not used anywhere.
Needs clarification with @nilsanderselde's question.
|
PR accidentaly got merged too early. I'm addressing feedback in #1619 |
#1595 needs to be merged first.
Adds a simplified constructor for dynamic validator used in the ARO operator.