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

Improved UX for updating wif-config. #700

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renan-campos
Copy link
Collaborator

The included changes provide the following properties to the update command:

  • Operations that modify GCP cloud resources are always accompanied by a log message displayed to the user.
  • Changes to GCP cloud resources are made only when necessary.

Additional logic was needed to check the configuration of jwks and service account access. Prior to this, these resources were being updated every time the command was called.

@renan-campos renan-campos force-pushed the OCM-13183 branch 2 times, most recently from e2943d7 to 85739cb Compare January 4, 2025 15:05
needPolicyUpdate := false

policy, err := c.gcpClient.GetProjectIamPolicy(ctx, projectName, &cloudresourcemanager.GetIamPolicyRequest{})

if err != nil {
return fmt.Errorf("error fetching policy for project: %v", err)
return false, fmt.Errorf("error fetching policy for project: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related specifically to this MR: why not using errors.Wrap (as done in other places in this file)?

pkg/gcp/error_handlers.go Show resolved Hide resolved
jwksStrB string,
) bool {
var jwksA, jwksB struct {
Keys []struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about x5c and x5t?

Is there a a third party comparison tool that we can use? trying not to re-invent the wheel

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

…esource updation

Ensured all operations modifying GCP cloud resources will log messages
to the user.

The 'ocm gcp update wif-config' command was unnecessarily updating the
oidc data of the workload identity pool, even when there were only
formatting differences. By improving the evaluation method for the jwks
configuration, the oidc configuration will now only be updated if there
is a meaningful difference.

Service Account access policies were being during every run of the
update command. By checking whether the policies are already in place,
updates to the policy will only occur if necassary.
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.

3 participants