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

NE-1244: Use permissions instead of the "Contributor" role in Azure CredentialsRequest #929

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented May 8, 2023

Instead of requesting the "Contributor" role, request the individual permissions that the operator requires in order to manage DNS records on Azure.

  • manifests/00-ingress-credentials-request.yaml: Replace the "Contributor" role with a list of permissions.

Notes for reviewers: Per discussions on NE-1244, this PR restricts the CredentialsRequest for Azure to a specific set of permissions. Because of the way the e2e-azure-operator job is configured, this job doesn't actually use the precise rules or permissions that are listed in the CredentialsRequest, but the e2e-azure-manual-oidc job that was added by openshift/release#41502 does.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 8, 2023
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented May 8, 2023

@Miciah: This pull request references NE-1244 which is a valid jira issue.

In response to this:

Instead of requesting the "Contributor" role, request the less privileged "DNS Zone Contributor" and "Private DNS Zone Contributor" roles.

The Azure built-in roles are documented here: https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles.

The "Contributor" role grants access to all resources whereas the "DNS Zone Contributor" and "Private DNS Zone Contributor" roles grant access only to DNS zones and record sets.

  • manifests/00-ingress-credentials-request.yaml: Replace the "Contributor" role with the "DNS Zone Contributor" and "Private DNS Zone Contributor" roles.
  • pkg/manifests/bindata.go: Regenerate.

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/test-infra repository.

@Miciah
Copy link
Contributor Author

Miciah commented May 8, 2023

/test e2e-azure-operator

@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 8, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2023
@Miciah
Copy link
Contributor Author

Miciah commented May 9, 2023

e2e-azure-operator failed on TestManagedDNSToUnmanagedDNSIngressController. As that was the only failure, it seems that the operator is working properly in general with the finer-grained roles in the CredentialsRequest.

@Miciah
Copy link
Contributor Author

Miciah commented May 9, 2023

@abutcher, is this sufficiently fine-grained to satisfy the requirements of the epic?

providerSpec:
apiVersion: cloudcredential.openshift.io/v1
kind: AzureProviderSpec
roleBindings:
- role: DNS Zone Contributor
- role: Private DNS Zone Contributor

@abutcher
Copy link
Member

abutcher commented May 9, 2023

@Miciah Yeah, I think this will be sufficiently fine grained. Azure e2e is currently credentialsMode: passthrough only and we don't yet have e2e utilizing the CredentialsRequests roleBinding field; that will require openshift/cloud-credential-operator#523 (CCO-232) and CCO-234 to follow which will process the CredentialsRequests for Azure Workload Identity purposes.

@Miciah Miciah force-pushed the NE-1244-use-fine-grained-roles-in-Azure-CredentialsRequest branch from c468b1d to 6330929 Compare July 19, 2023 16:08
@Miciah Miciah changed the title NE-1244: Use fine-grained roles in Azure CredentialsRequest NE-1244: Use permissions instead of the "Contributor" role in Azure CredentialsRequest Jul 19, 2023
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jul 19, 2023

@Miciah: This pull request references NE-1244 which is a valid jira issue.

In response to this:

Instead of requesting the "Contributor" role, request the individual permissions that the operator requires in order to manage DNS records on Azure.

  • manifests/00-ingress-credentials-request.yaml: Replace the "Contributor" role with a list of permissions.
  • pkg/manifests/bindata.go: Regenerate.

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/test-infra repository.

@Miciah
Copy link
Contributor Author

Miciah commented Jul 19, 2023

/test e2e-azure-operator

@Miciah
Copy link
Contributor Author

Miciah commented Jul 19, 2023

e2e-azure-operator failed because TestHeaderNameCaseAdjustment failed. TestHeaderNameCaseAdjustment is checking for the "X-Forwarded-For" and "Cache-Control" headers, but the logs indicate it only got the "X-Forwarded-For" header and not "Cache-Control":

        GET / HTTP/1.1
        user-agent: curl/7.61.1
        accept: */*
        host: header-name-case-adjustment-echo-openshift-ingress.apps.ci-op-q50r7bib-04a70.ci.azure.devcluster.openshift.com
        x-forwarded-host: header-name-case-adjustment-echo-openshift-ingress.apps.ci-op-q50r7bib-04a70.ci.azure.devcluster.openshift.com
        x-forwarded-port: 80
        x-forwarded-proto: http
        forwarded: for=10.128.2.33;host=header-name-case-adjustment-echo-openshift-ingress.apps.ci-op-q50r7bib-04a70.ci.azure.devcluster.openshift.com;proto=http
        X-Forwarded-For: 10.128.2.33

I don't think I've seen this failure before. At the same time, I don't see how the changes in this PR could cause it.
/test e2e-azure-operator

@Miciah
Copy link
Contributor Author

Miciah commented Jul 20, 2023

I think the bot missed my previous comment.
/test e2e-azure-operator

@Miciah Miciah force-pushed the NE-1244-use-fine-grained-roles-in-Azure-CredentialsRequest branch from 6330929 to 2a198b1 Compare July 20, 2023 21:09
@Miciah
Copy link
Contributor Author

Miciah commented Jul 20, 2023

Rebased for #900.

Instead of requesting the "Contributor" role, request the individual
permissions that the operator requires in order to manage DNS records on
Azure.

This commit resolves NE-1244.

https://issues.redhat.com/browse/NE-1244

* manifests/00-ingress-credentials-request.yaml: Replace the "Contributor"
role with a list of permissions.
@Miciah Miciah force-pushed the NE-1244-use-fine-grained-roles-in-Azure-CredentialsRequest branch from 2a198b1 to 162f14c Compare July 24, 2023 23:36
@Miciah
Copy link
Contributor Author

Miciah commented Jul 24, 2023

Rebased for #905.

/test e2e-azure-operator
since openshift/release#41502 merged.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jul 24, 2023

@Miciah: This pull request references NE-1244 which is a valid jira issue.

In response to this:

Instead of requesting the "Contributor" role, request the individual permissions that the operator requires in order to manage DNS records on Azure.

  • manifests/00-ingress-credentials-request.yaml: Replace the "Contributor" role with a list of permissions.

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/test-infra repository.

@abutcher
Copy link
Member

/test e2e-azure-manual-oidc

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jul 25, 2023

@Miciah: This pull request references NE-1244 which is a valid jira issue.

In response to this:

Instead of requesting the "Contributor" role, request the individual permissions that the operator requires in order to manage DNS records on Azure.

  • manifests/00-ingress-credentials-request.yaml: Replace the "Contributor" role with a list of permissions.

Notes for reviewers: Per discussions on NE-1244, this PR restricts the CredentialsRequest for Azure to a specific set of permissions. Because of the way the e2e-azure-operator job is configured, this job doesn't actually use the precise rules or permissions that are listed in the CredentialsRequest, but the e2e-azure-manual-oidc job that was added by openshift/release#41502 does.

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/test-infra repository.

@Miciah Miciah marked this pull request as ready for review July 25, 2023 17:47
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 25, 2023
@openshift-ci openshift-ci bot requested review from frobware and knobunc July 25, 2023 17:48
@abutcher
Copy link
Member

abutcher commented Jul 25, 2023

A custom role was created during credentials provisioning:

2023/07/25 13:06:16 Created customRole ci-op-p522x59d-281b0-openshift-ingress-operator-cloud-credentials ...

Ingress operator pod logs from the test are here.

I noticed we kicked off an e2e-azure-operator test. Will it be necessary to integrate e2e-azure-operator with e2e-azure-manual-oidc into a workflow that combines steps from e2e-azure-operator to fully test the operator on Azure?

@Miciah
Copy link
Contributor Author

Miciah commented Jul 25, 2023

A custom role was created during credentials provisioning:

2023/07/25 13:06:16 Created customRole ci-op-p522x59d-281b0-openshift-ingress-operator-cloud-credentials ...

Excellent!

Ingress operator pod logs from the test are here.

I noticed we kicked off an e2e-azure-operator test. Will it be necessary to integrate e2e-azure-operator with e2e-azure-manual-oidc into a workflow that combines steps from e2e-azure-operator to fully test the operator on Azure?

The e2e-azure-manual-oidc job suffices in my opinion. The operator logs show that the operator succeeded in both creating and deleting DNS records, in both the public and private zones. We only use one record type on Azure (namely type A), so there isn't much variation in what the operator does on Azure as far as DNS is concerned.

@candita
Copy link
Contributor

candita commented Jul 26, 2023

/assign

@newtonheath
Copy link

@candita - can you wrap this up today?

@candita
Copy link
Contributor

candita commented Aug 3, 2023

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: candita

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 Aug 3, 2023
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD ddba423 and 2 for PR HEAD 162f14c in total

@candita
Copy link
Contributor

candita commented Aug 3, 2023

@Miciah followup question asked in slack.

@Miciah
Copy link
Contributor Author

Miciah commented Aug 4, 2023

e2e-aws-operator failed with a lot of test failures: TestAWSELBConnectionIdleTimeout, TestHTTPHeaderBufferSize, TestHeaderNameCaseAdjustment, TestUniqueIdHeader, TestForwardedHeaderPolicyReplace, TestForwardedHeaderPolicyNever, TestForwardedHeaderPolicyAppend, TestUnmanagedDNSToManagedDNSInternalIngressController, and TestHstsPolicyWorks.

It appears that AWS did not enforce the 3-second idle timeout that TestAWSELBConnectionIdleTimeout configures. This might be a new failure to watch for.

The TestUnmanagedDNSToManagedDNSInternalIngressController failure doesn't look like OCPBUGS-10983, so this too might be a novel failure.

The other tests appear to have failed because they were pulling the "openshift/origin-node" image from Docker Hub. I filed OCPBUGS-17359 and posted #970 to address that issue.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 4e7b2da and 1 for PR HEAD 162f14c in total

@newtonheath
Copy link

@Miciah @candita does this good and affected by items outside of this PR?

@candita
Copy link
Contributor

candita commented Aug 4, 2023

@Miciah @candita does this good and affected by items outside of this PR?

Hi @newtonheath - the hold is on CI failures right now.

@candita
Copy link
Contributor

candita commented Aug 4, 2023

/test e2e-hypershift

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 4, 2023

@Miciah: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn 162f14c link false /test e2e-gcp-ovn
ci/prow/e2e-aws-ovn-single-node 162f14c link false /test e2e-aws-ovn-single-node
ci/prow/e2e-azure-ovn 162f14c link false /test e2e-azure-ovn

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@candita
Copy link
Contributor

candita commented Aug 4, 2023

--- FAIL: TestNodePool/NodePool_Tests_Group/TestNodepoolMachineconfigGetsRolledout/EnsureNoCrashingPods (0.08s) --- FAIL: TestNodePool/NodePool_Tests_Group/TestNTOMachineConfigGetsRolledOut/EnsureNoCrashingPods (0.08s)

/test e2e-hypershift

@openshift-merge-robot openshift-merge-robot merged commit 833bc28 into openshift:master Aug 4, 2023
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants