Bug 1948628 - ccoctl needs to plan for future (non-AWS) platform support in the CLI
Summary: ccoctl needs to plan for future (non-AWS) platform support in the CLI
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Cloud Credential Operator
Version: 4.8
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 4.8.0
Assignee: Akhil Rane
QA Contact: wang lin
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-12 16:15 UTC by Akhil Rane
Modified: 2021-07-27 22:59 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: Refactoring ccoctl to make it more extensible Reason: To support more cloud providers in future Result: Completed successfully
Clone Of:
Environment:
Last Closed: 2021-07-27 22:59:27 UTC
Target Upstream Version:
Embargoed:
lwan: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cloud-credential-operator pull 321 0 None open Bug 1948628: Add aws subcommand to ccoctl and additional UX changes 2021-04-12 16:18:16 UTC
Github openshift cloud-credential-operator pull 325 0 None open Bug 1948628: Fix ccoctl create aws iam-roles command and docs 2021-04-13 23:01:15 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:59:43 UTC

Description Akhil Rane 2021-04-12 16:15:48 UTC
Description of problem:
Currently, ccoctl tool for credentials management only supports the AWS cloud. We need to revamp ccoctl so that that it becomes easy to extend it for other cloud platforms in the future.

Version-Release number of selected component (if applicable):
4.8


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 wang lin 2021-04-13 06:56:46 UTC
Hi Akhil, there is an issue for roles created by ccoctl, the trust relationships for components are wrong.

The trust relationship ccoctl created is below:
##Such as role for image registry as below, the StringEquals have the wrong values.
$ aws iam get-role --role-name lwan-tt-1-openshift-image-registry-installer-cloud-credentials | jq -r .Role.AssumeRolePolicyDocument
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::XXXXXXXXXX:oidc-provider/lwan-tt-1-oidc.s3.us-east-1.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "lwan-tt-1-oidc.s3.us-east-1.amazonaws.com:sub": [
            "system:serviceaccount:cluster-image-registry-operator:cluster-image-registry-operator",
            "system:serviceaccount:registry:registry"
          ]
        }
      }
    }
  ]
}

But it should be as below:
$ aws iam get-role --role-name lwan-ccoctl-openshift-image-registry-installer-cloud-credentials | jq -r .Role.AssumeRolePolicyDocument
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::XXXXXXXXXX:oidc-provider/lwan-ccoctl-oidc.s3.us-east-2.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "lwan-ccoctl-oidc.s3.us-east-2.amazonaws.com:sub": [
            "system:serviceaccount:openshift-image-registry:registry",
            "system:serviceaccount:openshift-image-registry:cluster-image-registry-operator"
          ]
        }
      }
    }
  ]
}

All components have the same issue.


And the doc has a small issue in https://github.com/openshift/cloud-credential-operator/blob/master/docs/ccoctl.md#creating-openid-connect-provider
for creating-openid-connect-provider subcommand, the parameter should be "--public-key-file", rather than 
"--public-key"

Comment 2 Akhil Rane 2021-04-13 23:04:02 UTC
Hi Lin,

Thanks for reporting this issue. I have opened a PR to fix it and docs correction https://github.com/openshift/cloud-credential-operator/pull/325

Comment 4 wang lin 2021-04-15 05:59:42 UTC
The `ccoctl create-iam-roles` issue has fix in commitid fed3bffc9d

$ aws iam get-role --role-name lwan-tt-cco-5-openshift-image-registry-installer-cloud-credentia | jq -r .Role.AssumeRolePolicyDocument
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Federated": "arn:aws:iam::XXXXXXXXXX:oidc-provider/lwan-tt-cco-5-oidc.s3.us-east-2.amazonaws.com"
      },
      "Action": "sts:AssumeRoleWithWebIdentity",
      "Condition": {
        "StringEquals": {
          "lwan-tt-cco-5-oidc.s3.us-east-2.amazonaws.com:sub": [
            "system:serviceaccount:openshift-image-registry:cluster-image-registry-operator",
            "system:serviceaccount:openshift-image-registry:registry"
          ]
        }
      }
    }
  ]
}

Comment 7 errata-xmlrpc 2021-07-27 22:59:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438


Note You need to log in before you can comment on or make changes to this bug.