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

Avoid reconciling field Webhook.ClientConfig.CABundle #711

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

zeeke
Copy link
Member

@zeeke zeeke commented Jun 13, 2024

Webhook resources (ValidatingWebhookConfiguration and MutatingWebhookConfiguration) in OpenShift are configured with service.beta.openshift.io/inject-cabundle in a way that a third component fills the ClientConfig.CABundle field of the webhook. When reconciling webhooks, do not override the field and avoid a flakiness, as there might be a time slot in which the API server is not configured with a valid client certificate:

Error from server (InternalError): error when creating "policies": Internal error occurred: failed calling webhook "operator-webhook.sriovnetwork.openshift.io": failed to call webhook: Post "https://operator-webhook-service.openshift-sriov-network-operator.svc:443/mutating-custom-resource?timeout=10s": tls: failed to verify certificate: x509: certificate signed by unknown authority

Refs:

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9496671093

Details

  • 52 of 84 (61.9%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 39.836%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 43 73 58.9%
Totals Coverage Status
Change from base Build 9402838972: 0.2%
Covered Lines: 5232
Relevant Lines: 13134

💛 - Coveralls

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9498846290

Details

  • 52 of 84 (61.9%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 39.797%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 43 73 58.9%
Totals Coverage Status
Change from base Build 9402838972: 0.1%
Covered Lines: 5227
Relevant Lines: 13134

💛 - Coveralls

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 19, 2024

Pull Request Test Coverage Report for Build 9577793570

Details

  • 52 of 84 (61.9%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 38.787%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 43 73 58.9%
Files with Coverage Reduction New Missed Lines %
controllers/drain_controller.go 1 68.06%
Totals Coverage Status
Change from base Build 9549902217: 0.2%
Covered Lines: 5232
Relevant Lines: 13489

💛 - Coveralls

@SchSeba
Copy link
Collaborator

SchSeba commented Jun 21, 2024

Hi @zeeke,

just a general comment we need to take care of this also for the cert-manager in vanilla kubernetes we will have the same issue https://github.com/k8snetworkplumbingwg/sriov-network-operator/blob/master/bindata/manifests/operator-webhook/003-webhook.yaml#L12

@zeeke
Copy link
Member Author

zeeke commented Jun 21, 2024

Hi @zeeke,

just a general comment we need to take care of this also for the cert-manager in vanilla kubernetes we will have the same issue https://github.com/k8snetworkplumbingwg/sriov-network-operator/blob/master/bindata/manifests/operator-webhook/003-webhook.yaml#L12

Good point. Though the unit test I implemented refers to the Openshift CA injector, the fix should be valid for the Cert Manager as well.

return nil
}

injectCABundle, ok := currentAnnotations["service.beta.openshift.io/inject-cabundle"]
Copy link
Member Author

Choose a reason for hiding this comment

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

@SchSeba I think you refer to this. Removing

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 22, 2024

Pull Request Test Coverage Report for Build 9626639262

Details

  • 47 of 75 (62.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 38.746%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 38 64 59.38%
Totals Coverage Status
Change from base Build 9549902217: 0.1%
Covered Lines: 5223
Relevant Lines: 13480

💛 - Coveralls

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 22, 2024

Pull Request Test Coverage Report for Build 9626718921

Details

  • 47 of 75 (62.67%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 38.739%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 38 64 59.38%
Files with Coverage Reduction New Missed Lines %
controllers/drain_controller.go 1 68.06%
Totals Coverage Status
Change from base Build 9549902217: 0.1%
Covered Lines: 5222
Relevant Lines: 13480

💛 - Coveralls

@@ -116,6 +122,92 @@ func MergeServiceAccountForUpdate(current, updated *uns.Unstructured) error {
return nil
}

// MergeWebhookForUpdate ensures the Webhook.ClientConfig.CABundle is never removed from a webhook
// if the resource has the `service.beta.openshift.io/inject-cabundle` annotation
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: please remove this one

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9658912326

Details

  • 48 of 75 (64.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.3%) to 39.063%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 39 64 60.94%
Files with Coverage Reduction New Missed Lines %
controllers/drain_controller.go 1 68.06%
Totals Coverage Status
Change from base Build 9658359013: 0.3%
Covered Lines: 5284
Relevant Lines: 13527

💛 - Coveralls

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 26, 2024

Pull Request Test Coverage Report for Build 9675205060

Details

  • 48 of 75 (64.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 40.63%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 39 64 60.94%
Totals Coverage Status
Change from base Build 9667839529: 0.3%
Covered Lines: 5520
Relevant Lines: 13586

💛 - Coveralls

Webhook resources (`ValidatingWebhookConfiguration` and `MutatingWebhookConfiguration`) in OpenShift
are configured with `service.beta.openshift.io/inject-cabundle` in a way that
a third component fills the ClientConfig.CABundle field of the webhook.
When reconciling webhooks, do not override the field and avoid a flakiness, as
there might be a time slot in which the API server is not configured with a valid
client certificate:

```
Error from server (InternalError): error when creating "policies": Internal error occurred: failed calling webhook "operator-webhook.sriovnetwork.openshift.io": failed to call webhook: Post "https://operator-webhook-service.openshift-sriov-network-operator.svc:443/mutating-custom-resource?timeout=10s": tls: failed to verify certificate: x509: certificate signed by unknown authority
```

The same behavior also happens when using CertManager

Refs:
- https://docs.openshift.com/container-platform/4.15/security/certificates/service-serving-certificate.html
- https://issues.redhat.com/browse/OCPBUGS-32139
- https://cert-manager.io/docs/concepts/ca-injector/

Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jun 26, 2024

Pull Request Test Coverage Report for Build 9676241549

Details

  • 48 of 75 (64.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 40.63%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/util/util.go 9 11 81.82%
pkg/apply/merge.go 39 64 60.94%
Totals Coverage Status
Change from base Build 9667839529: 0.3%
Covered Lines: 5520
Relevant Lines: 13586

💛 - Coveralls

@SchSeba
Copy link
Collaborator

SchSeba commented Jun 27, 2024

3 approvals

merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants