-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Change flag workspace-resource-id to workspace-resource #11241
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
@myronfanqiu Can you take a look at this? |
@troy0820 Hello. If you want to do this, you should support "Name of workspace". Actually I'm glad to see this PR. 😄 BTW, |
@troy0820 @myronfanqiu what do you think abut using only |
@olga-mir @troy0820 Hi. Like @tjprescott said in the #6949 (comment), the main reason behind this guideline is that " The main reason is that something which accepts an ARM resource ID should typically be following the "name or ID" convention in the CLI." |
thanks for clarifying this @myronfanqiu, I can see your point, you can read this comment in both ways. If most people agree on this name then it's fine. @troy0820 did provide help text, so hopefully that helps to resolve confusion. |
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.
nit: would it be better to use MyResourceGroup
or MyRG
style instead of <resourcegroup>
? Other help text strings that include ARM ID don't use <>
(git grep "00000000-0000-0000-0000-000000000000" | grep -v tests
)
@troy0820 Hello. Any progress on this PR? I remembered the GA date is around today. |
@MyronFanQui I can fix the nit that @olga-mir pointed out. I didn't update the PR to support both the name of the workspace. I can do that and have it hopefully land tomorrow. |
@myronfanqiu I've updated the PR to accept the string that is just the workspace-id. If the string is just that, it will create the "/subscription/...." necessary to provide the monitor profile for |
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.
Could we add a single test for this command?
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.
workspace_id=workspace_id
instead of workspace_resource_id=workspace_id
?
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.
If the string passed in to --workspace-id
is, in fact, jus the name of the workspace-id, the variable will still be workspace-id and reference the string to build the workspace-resource-id (/subscriptions/...).
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.
Is it possible for server end?
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.
@JackQuincy mentioned in the other PR that this has to be done client side. AKS does the same validation for their workspace-resource-id on line 2204.
The regex validation was checking the subscription but that is wrong. Changing it to append the name of the workspace resource id to the string to build the monitor profile.
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.
Can you add a test for this command? It's a little bit strange to have a id like '/subscriptions/{}/resourceGroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}'.format(subscription, resource_group_name, workspace_id)
The workspace_id is something like xxxx-xxxx-xxxx-xxxx-xxxx-xxxx which is strange.
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.
@myronfanqiu I'm confused. When you do az resource list
the id of the loganalytics workspace is this string:
/subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.OperationalInsights/workspaces/{workspace-name}
The workspace name
is the just 4-63 characters after /workspaces/
. The logic allows for either the string to be passed in with the workspace name
as the id
or just the workspace name which builds the id because the OpenshiftMonitorProfile needs the whole id to create the managed cluster.
I will indeed create a test for the functionality of the above logic.
The id I believe you are describing is the subscription id that is passed with the id of the loganalytics workspace id. Unless I'm mistaken.
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.
@troy0820 Oh. Since the name of the argument is workspace-id
, I thought this command supported both workspace_resource_id
and workspace_id
. If you are intend to support Name or Resource ID. Usually, the name of the argument should be just workspace
and specify the detail information in the help message. We still need a test for this command. Thanks~
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.
I will add a test for this but will also wait until this PR #11460 is merged and I can rebase. It changes the imports to not obscure the API version from the caller and only use the preview 0930 imports.
Change help and parameters to match "workspace-resource"
660aa93
to
92b4366
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.
Is it a workspace name instead of workspace id?
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.
It is a workspace resource id. The workspace name and id are 2 other fields that exist and won't work here. We are using the example inputs to try to make it clear what kind of id it is.
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 is the workspace resource id as Jack said. We are using the same mechanism that we use to force users to grab this id as we do for VNET peering listed in the example inputs. Trying to mock this means I need a subscription. I can test that the monitor profile is indeed None
when creating a cluster. The cluster will provision as before but with a blank monitoring profile.
We also do not provide a default log analytics workspace if none is provided like AKS does with its add-on capabilities.
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.
Looks like you delete the logic and it's just a renaming PR. Right?
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.
I deleted the logic because as of right now we do not want to support workspace name for the reasons @JackQuincy explained. I am just using this PR to rename the parameters around the flag for documentation purposes. The subsequent work in the future should address these issues. The user of this flag will be demonstrated within the examples and forced to used the existing workspace in the format that is similar to VNET peering.
[openshift]Test command for openshift create with monitor profile as None
62b9190
to
2970cbe
Compare
}) | ||
|
||
# create | ||
create_cmd = 'openshift create --resource-group={resource_group} --name={name} --location={location} ' \ |
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.
is it able to link a workspace since this PR is related with workspace
? We have az monitor log-analytics workspace create
@troy0820 Actually, this should be a breaking change for users. However, I just checked usage data and it's quite low. So I think it's ok. |
@troy0820 Could you add [Breaking Change] in History.rst? Or I can add it for you later in other PR if you don't mind. |
d8de3f6
to
91d7c20
Compare
@myronfanqiu I don't mind if you add it. I think that'll work if that is easier. |
Issue #6949 (comment) describes this problem across AKS and Azure Red Hat Openshift when trying to use monitoring when creating clusters. To clearly distinguish the parameter that Azure Red Hat Openshift needs to create a cluster with monitoring, changing this parameter to
workspace-resource
and providing the context in the help menu when usingaz openshift create -h
will allow the user to see what is expected. The conversation was in PR #10775 and settled on the former but subsequent work will create issues of handling the id with future commands.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).
I adhere to the Command Guidelines.