Skip to content

HOSTEDCP-2035: Use Client Cert Auth for ARO HCP deployments#156

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
bryan-cox:HOSTEDCP-1994
Nov 18, 2024
Merged

HOSTEDCP-2035: Use Client Cert Auth for ARO HCP deployments#156
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
bryan-cox:HOSTEDCP-1994

Conversation

@bryan-cox
Copy link
Copy Markdown
Member

@bryan-cox bryan-cox commented Oct 7, 2024

Use Client Certificate Authentication for ARO HCP deployments. HyperShift will pass the needed environment variables for this authentication method: ARO_HCP_MI_CLIENT_ID, ARO_HCP_TENANT_ID, and ARO_HCP_CLIENT_CERTIFICATE_PATH.

@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 Oct 7, 2024
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Oct 7, 2024

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

@bryan-cox bryan-cox force-pushed the HOSTEDCP-1994 branch 2 times, most recently from c8f4099 to dbc3e29 Compare October 9, 2024 18:35
@bryan-cox bryan-cox marked this pull request as ready for review October 9, 2024 18:35
@bryan-cox bryan-cox changed the title Refactor to use Azure SDK default cred chain HOSTEDCP-1994: Refactor to use Azure SDK default cred chain Oct 9, 2024
@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 Oct 9, 2024
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 9, 2024
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Oct 9, 2024

@bryan-cox: This pull request references HOSTEDCP-1994 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target only the "4.18.0" version, but multiple target versions were set.

Details

In response to this:

Refactor to use the Azure SDK for Go's default credential chain function, NewDefaultAzureCredential.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from andreaskaris and trozet October 9, 2024 18:40
@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

@bryan-cox bryan-cox marked this pull request as draft October 18, 2024 20:23
@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 Oct 18, 2024
@bryan-cox bryan-cox changed the title HOSTEDCP-1994: Refactor to use Azure SDK default cred chain HOSTEDCP-2035: Refactor to use Azure SDK default cred chain Oct 19, 2024
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Oct 19, 2024

@bryan-cox: This pull request references HOSTEDCP-2035 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target only the "4.18.0" version, but multiple target versions were set.

Details

In response to this:

Refactor to use the Azure SDK for Go's default credential chain function, NewDefaultAzureCredential.

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 openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox bryan-cox changed the title HOSTEDCP-2035: Refactor to use Azure SDK default cred chain HOSTEDCP-2035: Use Client Cert Auth for ARO HCP deployments Oct 19, 2024
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Oct 19, 2024

@bryan-cox: This pull request references HOSTEDCP-2035 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target only the "4.18.0" version, but multiple target versions were set.

Details

In response to this:

Use Client Certificate Authentication for ARO HCP deployments. HyperShift will pass the needed environment variables for this authentication method: ARO_HCP_MI_CLIENT_ID, ARO_HCP_TENANT_ID, and ARO_HCP_CLIENT_CERTIFICATE_PATH.

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 openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox bryan-cox marked this pull request as ready for review October 19, 2024 19:45
@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 Oct 19, 2024
@openshift-ci openshift-ci Bot requested a review from danwinship October 19, 2024 19:46
@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

3 similar comments
@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

@bryan-cox
Copy link
Copy Markdown
Member Author

/test unit

@bryan-cox bryan-cox force-pushed the HOSTEDCP-1994 branch 4 times, most recently from 1eb3c6b to 63e9561 Compare November 1, 2024 23:45
@bryan-cox
Copy link
Copy Markdown
Member Author

/retest

Copy link
Copy Markdown
Contributor

@kyrtapz kyrtapz left a comment

Choose a reason for hiding this comment

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

I am not confident in the new approach, It causes a hard stop and has a potentially significant delay.

Comment thread pkg/filewatcher/filewatcher.go
Comment thread pkg/filewatcher/filewatcher.go Outdated
Comment thread pkg/filewatcher/filewatcher.go Outdated
return
}

initialFileHash = hashSimple(fileContents)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What was the reason behind going with periodic hash check instead of a file watch?
With the current implementation there is a chance we are going to be using the old cert file for ~30min which seems unnecessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We can certainly poll sooner than 30m for the file check. How quick would you like it to poll?

Copy link
Copy Markdown
Member Author

@bryan-cox bryan-cox Nov 4, 2024

Choose a reason for hiding this comment

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

The reason for the periodic hash check - the previous file watcher code was not catching the changes when I was testing this function against the CPO. I could exec into the pod and see the file changed but the pod was not restarted nor did I see any messages about the file changing.

This current change seemed just as simple and required less code. This change was working when I was testing the same function against the CPO in openshift/hypershift#4997


done := make(chan bool)

go func() {
Copy link
Copy Markdown
Contributor

@kyrtapz kyrtapz Nov 4, 2024

Choose a reason for hiding this comment

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

you run checkForFileChanges as a go routine but it starts one inside with the done channel waiting for it, why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I didn't need the second goroutine so I removed it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Apparently this is needed. The pod does not restart when I removed this.

Comment thread pkg/filewatcher/filewatcher.go Outdated
klog.Infof("Checking file for changes, %s", fileToWatch)
fileContents, err := os.ReadFile(fileToWatch)
if err != nil {
klog.Error("failed to read the file: %v", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When a file read fails we will just stop watching it and if it changes this will never be caught.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The return should just return from the sync.Once function and the error would be returned at the end of WatchFileForChanges

@bryan-cox bryan-cox force-pushed the HOSTEDCP-1994 branch 6 times, most recently from ca29e0b to 6ba6f9b Compare November 6, 2024 16:22
Use Client Certificate Authentication for ARO HCP deployments.
HyperShift will pass the needed environment variables for this
authentication method: ARO_HCP_MI_CLIENT_ID, ARO_HCP_TENANT_ID, and
ARO_HCP_CLIENT_CERTIFICATE_PATH.

Signed-off-by: Bryan Cox <brcox@redhat.com>
@kyrtapz
Copy link
Copy Markdown
Contributor

kyrtapz commented Nov 18, 2024

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 18, 2024
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Nov 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, kyrtapz

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 Nov 18, 2024
@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD a6bc591 and 2 for PR HEAD ba58106 in total

@bryan-cox
Copy link
Copy Markdown
Member Author

/test e2e-azure-ovn

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Nov 18, 2024

@bryan-cox: The following test 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/security ba58106 link false /test security

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit f648c78 into openshift:master Nov 18, 2024
@bryan-cox bryan-cox deleted the HOSTEDCP-1994 branch November 19, 2024 02:16
@openshift-bot
Copy link
Copy Markdown

[ART PR BUILD NOTIFIER]

Distgit: ose-cloud-network-config-controller
This PR has been included in build ose-cloud-network-config-controller-container-v4.19.0-202411190035.p0.gf648c78.assembly.stream.el9.
All builds following this will include this PR.

@bryan-cox
Copy link
Copy Markdown
Member Author

/cherry-pick release-4.17

@openshift-cherrypick-robot
Copy link
Copy Markdown

@bryan-cox: #156 failed to apply on top of branch "release-4.17":

Applying: Use Client Cert Auth for ARO HCP deployments
Using index info to reconstruct a base tree...
M	go.mod
Falling back to patching base and 3-way merge...
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Use Client Cert Auth for ARO HCP deployments

Details

In response to this:

/cherry-pick release-4.17

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.

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