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

OCPBUGS-24005: webhookcontroller: report when a webhook resource is missing a caBundle provided by the service-ca-operator #1587

Conversation

p0lyn0mial
Copy link
Contributor

@p0lyn0mial p0lyn0mial commented Nov 22, 2023

This is clearly a gap in the platform. Perhaps the best way would be to introduce a readiness condition kas would honour. On the other hand the issue is not that severe since most of the time it will appear during a webhook installation. I've checked and the cert-manager works exactly in the same way.

Initially I was thinking about waiting for a caBundle to be populated but realised it would hide the issue. I've changed the PR to report the issue instead.

@p0lyn0mial
Copy link
Contributor Author

/hold

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Nov 22, 2023
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 22, 2023
// waitForServiceCABundle returns true if a resource has the service-ca
// annotation and the caBundle hasn't been yet provided.
func waitForServiceCABundle(annotations map[string]string, caBundle []byte) bool {
if hasServiceCaAnnotation(annotations) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to check for the annotation, shouldn't it be enough to just check for the length of the caBundle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we do, at least when the resource is annotated, in that case we rely on the service-ca to provide the bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general, a caBundle is optional and when it is empty we use CAs provided by the underlying OS.

Comment on lines 75 to 77
if annotations == nil {
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if annotations == nil {
return false
}

@p0lyn0mial
Copy link
Contributor Author

TODO: check what would kas do in such a situation. I think there might be a gap in the platfrom.

I haven't found any additional checks in kas that would prevent the server from passing request to a "not fully" configured webhook. I think that the assumption here is that administrators/controllers provide a complete configuration. In OCP that step requires an input from the service-ca.

The service-ca requires a non-empty WebhookClientConfig so that it can inject a caBundle. In order to have a non-emptyWebhookClientConfig you have to specify a service ref or an url address otherwise the extention-apiserver won't allow you to add a conversion configuration .

the actuall values of the conditions were changed in 0b85b30
@p0lyn0mial p0lyn0mial force-pushed the webhook-controller-checks-service-ca-annotation branch from 090fc9e to 686ff4b Compare November 27, 2023 10:46
@p0lyn0mial p0lyn0mial changed the title [WIP] webhooksupportabilitycontroller: checks if a caBundle has been provided by the service-ca webhookcontroller: report when a webhook resource is missing a caBundle provided by the service-ca-operator Nov 27, 2023
@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 Nov 27, 2023
@p0lyn0mial
Copy link
Contributor Author

/hold cancel
/assign @sanchezl

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 27, 2023
@p0lyn0mial p0lyn0mial changed the title webhookcontroller: report when a webhook resource is missing a caBundle provided by the service-ca-operator OCPBUGS-24005: webhookcontroller: report when a webhook resource is missing a caBundle provided by the service-ca-operator Nov 29, 2023
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Nov 29, 2023
@openshift-ci-robot
Copy link

@p0lyn0mial: This pull request references Jira Issue OCPBUGS-24005, which is invalid:

  • expected the bug to target the "4.15.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

This is clearly a gap in the platform. Perhaps the best way would be to introduce a readiness condition kas would honour. On the other hand the issue is not that severe since most of the time it will appear during a webhook installation. I've checked and the cert-manager works exactly in the same way.

Initially I was thinking about waiting for a caBundle to be populated but realised it would hide the issue. I've changed the PR to report the issue instead.

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.

Comment on lines 143 to 145
if caBundleProvidedByServiceCA && len(caBundle) == 0 {
err = fmt.Errorf("%v. NOTE that the caBundle is provided by the service-ca-operator but was empty. Please check the service-ca's logs", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should perform this check before attempting the connection. There is little chance that the connection would succeed anyway. This would allow for a simpler error message for the status and less noise in the webhook logs for failed connections that would never have succeeded without the CA bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I've updated the PR, PTAL.

@p0lyn0mial p0lyn0mial force-pushed the webhook-controller-checks-service-ca-annotation branch from 686ff4b to aa5d5ed Compare December 18, 2023 14:21
@p0lyn0mial
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot
Copy link

@p0lyn0mial: This pull request references Jira Issue OCPBUGS-24005, which is invalid:

  • expected the bug to target either version "4.16." or "openshift-4.16.", but it targets "4.15.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/jira refresh

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.

@p0lyn0mial
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Dec 18, 2023
@openshift-ci-robot
Copy link

@p0lyn0mial: This pull request references Jira Issue OCPBUGS-24005, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @gangwgr

In response to this:

/jira refresh

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.

@openshift-ci openshift-ci bot requested a review from gangwgr December 18, 2023 14:29
@p0lyn0mial
Copy link
Contributor Author

/retest-required

Copy link
Contributor

openshift-ci bot commented Dec 19, 2023

@p0lyn0mial: 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-aws-operator-disruptive-single-node aa5d5ed link false /test e2e-aws-operator-disruptive-single-node
ci/prow/e2e-gcp-operator-single-node aa5d5ed link false /test e2e-gcp-operator-single-node
ci/prow/e2e-aws-ovn-single-node aa5d5ed link false /test e2e-aws-ovn-single-node

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.

@p0lyn0mial
Copy link
Contributor Author

/retest-required

Copy link
Contributor

@sanchezl sanchezl left a comment

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci bot commented Dec 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: p0lyn0mial, sanchezl

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:
  • OWNERS [p0lyn0mial,sanchezl]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit d6f4bca into openshift:master Dec 19, 2023
12 of 15 checks passed
@openshift-ci-robot
Copy link

@p0lyn0mial: Jira Issue OCPBUGS-24005: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-24005 has been moved to the MODIFIED state.

In response to this:

This is clearly a gap in the platform. Perhaps the best way would be to introduce a readiness condition kas would honour. On the other hand the issue is not that severe since most of the time it will appear during a webhook installation. I've checked and the cert-manager works exactly in the same way.

Initially I was thinking about waiting for a caBundle to be populated but realised it would hide the issue. I've changed the PR to report the issue instead.

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.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-cluster-kube-apiserver-operator-container-v4.16.0-202312191909.p0.gd6f4bca.assembly.stream for distgit ose-cluster-kube-apiserver-operator.
All builds following this will include this PR.

@p0lyn0mial
Copy link
Contributor Author

/cherry-pick release-4.15

@openshift-cherrypick-robot

@p0lyn0mial: new pull request created: #1628

In response to this:

/cherry-pick release-4.15

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.

@wangke19
Copy link

/cherry-pick release-4.14

@openshift-cherrypick-robot

@wangke19: new pull request created: #1646

In response to this:

/cherry-pick release-4.14

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.

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/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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.

None yet

8 participants