Skip to content
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

Add option for budget approval ticket #159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smalleni
Copy link

@smalleni smalleni commented Jun 13, 2023

Description

Adds an optional parameter for tagging resources created in AWS with cloud spend approval ticket id.

Fixes

@dry923
Copy link
Member

dry923 commented Jun 14, 2023

IMHO this and #157 should go to simply a generic key:value list option exactly like it is to the rosa cli. Its then a simple append to the rosa create command.
Something to the extent of:
--rosa-tags "foo:bar,bar:foobar"

Thoughts @smalleni @morenod @krishvoor ?

@morenod
Copy link
Collaborator

morenod commented Jun 14, 2023

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one

What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.

For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"

This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

@dry923
Copy link
Member

dry923 commented Jun 14, 2023

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one

What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.

For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"

This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

+1 to just moving to the wildcard option. I completely forgot about that in my previous comment. @morenod++

@krishvoor
Copy link
Member

krishvoor commented Jun 15, 2023

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one
What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.
For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"
This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

+1 to just moving to the wildcard option. I completely forgot about that in my previous comment. @morenod++

@dry923 @morenod with --wildcard-options we will be limited to tag/target resources created during _build_cluster() and not operator_roles, oidc_objects, VPCs, machinepools.

@smalleni can we consider consolidating #157 and #159 into one?

@dry923
Copy link
Member

dry923 commented Jun 15, 2023

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one
What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.
For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"
This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

+1 to just moving to the wildcard option. I completely forgot about that in my previous comment. @morenod++

@dry923 @morenod with --wildcard-options we will be limited to tag/target resources created during _build_cluster() and not operator_roles, oidc_objects, VPCs, machinepools.

@smalleni can we consider consolidating #157 and #159 into one?

@krishvoor per my conversation with the cloud-gov folks they only care that the instance is tagged

@smalleni smalleni closed this Jun 16, 2023
@smalleni smalleni reopened this Jun 16, 2023
@smalleni
Copy link
Author

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one
What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.
For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"
This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

+1 to just moving to the wildcard option. I completely forgot about that in my previous comment. @morenod++

@dry923 @morenod with --wildcard-options we will be limited to tag/target resources created during _build_cluster() and not operator_roles, oidc_objects, VPCs, machinepools.

@smalleni can we consider consolidating #157 and #159 into one?

@krishvoor I am not following this. Using --wild-card-options to pass --tags option with TicketId to rosa cli is no different from explicitly consuming and passing --tags TicketId. However as @morenod mentioned anything passed to -wildcard-options is not mandatory and does not undergo any additional checks, which is not different from how this patch uses --ticket-id argument.

@smalleni
Copy link
Author

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one

What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.

For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"

This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

I agree with David's assessment. The only case where we need --ticket-id as a separate argument is if we consider it mandatory aka required. I think given the direction we are moving with cloud budgeting and spend, it makes sense to enforce this argument. However, while I would like to make the TicketId mandatory for spinning up HCPs, I'm not exactly sure if have the necessary mechanisms to verify if the ticket is valid AND approved. Perhaps the clpud governance framework exposes an API to check this? @krishvoor can you check?

@krishvoor
Copy link
Member

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one
What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.
For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"
This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

I agree with David's assessment. The only case where we need --ticket-id as a separate argument is if we consider it mandatory aka required. I think given the direction we are moving with cloud budgeting and spend, it makes sense to enforce this argument. However, while I would like to make the TicketId mandatory for spinning up HCPs, I'm not exactly sure if have the necessary mechanisms to verify if the ticket is valid AND approved. Perhaps the clpud governance framework exposes an API to check this? @krishvoor can you check?

We can make use of JIRA API(s) to validate if a ticket is opened.
I have jotted something like this:
http://pastebin.test.redhat.com/1102940
which checks if an Issue ID is present.

@dry923
Copy link
Member

dry923 commented Jun 20, 2023

What I think is that this new parameter --ticket-id makes sense if we change it to required=True, and we validate somehow that it is a valid ticket. if it is going to be optional and directly passed to the create command, we should use the existing --wildcard-options one
What we decided about the parameters when we started to work on this wrapper was that we will only add parameters that we need to use, manage, transform or validate in the wrapper. Any parameter that is going to be directly passed to the rosa create command can be added in the --wildcard-options parameter.
For example, we dont have any parameter for the version of openshift to be installed, because we are not validating it on any way, so if you want to specify a version to install, you can use, for example --wildcard-options "--channel-group candidate --version 4.13.0-rc.4"
This is the same scenario, the only scope for this parameter is to pass across all the functions to arrive the cluster create command, and we can do that with any code change as --wildcard-options "--tags=TicketId:XXXX

I agree with David's assessment. The only case where we need --ticket-id as a separate argument is if we consider it mandatory aka required. I think given the direction we are moving with cloud budgeting and spend, it makes sense to enforce this argument. However, while I would like to make the TicketId mandatory for spinning up HCPs, I'm not exactly sure if have the necessary mechanisms to verify if the ticket is valid AND approved. Perhaps the clpud governance framework exposes an API to check this? @krishvoor can you check?

We can make use of JIRA API(s) to validate if a ticket is opened. I have jotted something like this: http://pastebin.test.redhat.com/1102940 which checks if an Issue ID is present.

IMHO ^ should not be in this script. You can verify it outside and pass the "approved" value in in airflow or something but this would not align with the overall goal of the rosa-hypershift wrapper.

@krishvoor
Copy link
Member

IMHO ^ should not be in this script. You can verify it outside and pass the "approved" value in in airflow or something but this would not align with the overall goal of the rosa-hypershift wrapper.

Ack, we will not taper the sanity of the wrapper, we can stage it in utils/* and pass the value accordingly.

@krishvoor
Copy link
Member

Hi @dry923 @morenod @smalleni 👋
I have tackled it outside the scope of the wrapper script via #162
and checks for a "valid" JIRA Ticket and applies logic accordingly, please review.

Signed-off-by: Sai Sindhur Malleni <[email protected]>
@krishvoor
Copy link
Member

Hi @smalleni, looks like you got some resolve conflicts, kindly resolve.

'--ticket-id',
type=int,
help='Ticket ID for cloud spend approval',
required=True)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we want to enforce this as required=True?

Copy link
Member

Choose a reason for hiding this comment

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

@smalleni: Having required=True, will compel users to provide ticket-id,
which may not be the case always, thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants