Skip to content

[OSD-22253] refactor sts command to support wif as well#583

Merged
openshift-merge-bot[bot] merged 5 commits intoopenshift:masterfrom
mrWinston:osd-22253-gap-analysis-for-gcpwif
Jun 26, 2024
Merged

[OSD-22253] refactor sts command to support wif as well#583
openshift-merge-bot[bot] merged 5 commits intoopenshift:masterfrom
mrWinston:osd-22253-gap-analysis-for-gcpwif

Conversation

@mrWinston
Copy link
Member

@mrWinston mrWinston commented Jun 17, 2024

Description

This PR is part of the ongoing effort to support gcp WIF the same way we do for aws sts.

It rewrites the osdctl sts subcommand to support both aws sts policies as well as gcp wif templates. To reflect the change, the command was renamed to osdctl managedpolicies and it's subcommands were renamed to get and diff respectively:

  • osdctl sts policy 4.15.0 --> osdctl iampermissions get -c aws -r 4.15.0
  • osdctl sts policy-diff 4.14.0 4.15.0 --> osdctl iampermissions diff -c aws -b 4.15.0 -t 4.15.0

Furthermore, a new command is added to convert the credentialsrequests for a given cloud and version to a format that can be consumed directly by managed-cluster-config. osdctl managedpolicies save creates a json or yaml file (json for aws, yaml for gcp) for each credentialsrequest in a given folder. These contain the neccessary permissions for the service accounts.

Examples

  • Download CredentialsRequests:
# download aws credentialsrequests for 4.15.0 
./osdctl -S iampermissions get -c aws -r 4.15.0

OCP managed policy files for aws have been saved in /tmp/osdctl-crs-2292554493 directory

# same for gcp
./osdctl -S iampermissions get -c gcp -r 4.15.0

OCP managed policy files for gcp have been saved in /tmp/osdctl-crs-2900638342 directory
  • Diff between versions
./osdctl -S iampermissions diff -c aws -b 4.15.0 -t 4.16.0-rc.0
Downloading Credential Requests for 4.15.0
Downloading Credential Requests for 4.16.0-rc.0
diff /tmp/osdctl-crs-1845971928/0000_50_cluster-image-registry-operator_01-registry-credentials-request.yaml /tmp/osdctl-crs-2115331329/0000_50_cluster-image-registry-operator_01-registry-credentials-request.yaml
6a7
>     include.release.openshift.io/hypershift: "true"
diff /tmp/osdctl-crs-1845971928/0000_50_cluster-ingress-operator_00-ingress-credentials-request.yaml /tmp/osdctl-crs-2115331329/0000_50_cluster-ingress-operator_00-ingress-credentials-request.yaml
6c6
<     capability.openshift.io/name: CloudCredential
---
>     capability.openshift.io/name: CloudCredential+Ingress
  • Extract managedpolicies from the credentialsrequests and save them to a local folder:
$ ./osdctl -S iampermissions save -d ./aws1 -c aws -r 4.16.0-rc.0
Writing aws1/openshift-ingress.json
Writing aws1/openshift-cloud-network-config-controller-aws.json
Writing aws1/aws-ebs-csi-driver-operator.json
Writing aws1/openshift-cluster-api-aws.json
Writing aws1/openshift-machine-api-aws.json
Writing aws1/cloud-credential-operator-iam-ro.json
Writing aws1/openshift-image-registry.json

# same for gcp

$ ./osdctl -S iampermissions save -d ./gcp -c gcp -r 4.16.0-rc.0
Writing gcp/openshift-image-registry-gcs.yaml
Writing gcp/openshift-ingress-gcp.yaml
Writing gcp/openshift-cloud-network-config-controller-gcp.yaml
Writing gcp/openshift-gcp-pd-csi-driver-operator.yaml
Writing gcp/openshift-gcp-ccm.yaml
Writing gcp/openshift-cluster-api-gcp.yaml
Writing gcp/openshift-machine-api-gcp.yaml
Writing gcp/cloud-credential-operator-gcp-ro-creds.yaml

@openshift-ci openshift-ci bot requested review from mjlshen and sam-nguyen7 June 17, 2024 13:50
@fahlmant
Copy link
Contributor

@mrWinston Why was this renamed to managed policies? That has a specific meaning in ROSA, so it may be confusing to change this command to that name when it doesn't directly relate to the ROSA meaning.

@mrWinston
Copy link
Member Author

@mrWinston Why was this renamed to managed policies? That has a specific meaning in ROSA, so it may be confusing to change this command to that name when it doesn't directly relate to the ROSA meaning.

In general, the name sts for the command would be confusing when it also supported gcp wif. managedpolicies was the first thing that came to my mind when thinking about a new name. But naming is hard and i wasn't aware that it's also a thing in rosa. Let's rename it to something else.

Do you already have an idea for a better name?

@fahlmant
Copy link
Contributor

Maybe something like cloud-permissions or iam-permissions since both AWS and GCP use the IAM terminology?

@mrWinston
Copy link
Member Author

Renamed the command to iampermissions to avoid confusion.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 19, 2024
@mrWinston mrWinston force-pushed the osd-22253-gap-analysis-for-gcpwif branch from fb3bf2a to 60ed068 Compare June 25, 2024 08:34
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 25, 2024

@mrWinston: 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-sigs/prow repository. I understand the commands that are listed here.

@AlexVulaj
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlexVulaj, mrWinston

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit bcd870d into openshift:master Jun 26, 2024
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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants