Skip to content

🐛 Fix webhook cert duplicate volume mount path bug - #2002

Merged
openshift-merge-bot[bot] merged 3 commits into
operator-framework:mainfrom
perdasilva:fix-webhook-cert-volume-mount
Jun 2, 2025
Merged

🐛 Fix webhook cert duplicate volume mount path bug#2002
openshift-merge-bot[bot] merged 3 commits into
operator-framework:mainfrom
perdasilva:fix-webhook-cert-volume-mount

Conversation

@perdasilva

Copy link
Copy Markdown
Contributor

Description

  1. Removes the APIService volume mount - since we don't yet support APIServices (let's avoid adding things that aren't needed yet)
  2. Moves the tls.crt and tls.key magic strings to constants
  3. Addresses the following bug:

When installing the Red Hat Network Observability operator, we were faced with the following error:

"error for resolved bundle \"network-observability-operator.v1.7.0\" with version \"1.7.0\": failed to create resource: Deployment.apps \"netobserv-controller-manager\" is invalid: spec.template.spec.containers[0].volumeMounts[2].mountPath: Invalid value: \"/tmp/k8s-webhook-server/serving-certs\": must be unique",

The root cause is related to the operator's Deployment's Pod template spec described in the CSV that included a volume mount pointing to the webhook certificate volume mount path (but had a different name than 'webhook-cert'):

volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true

This PR updates the bundle deployment generator to replace any volume/mount referencing a protected path with the OLM generated values.

Before fixes, OLMv1 generated a deployment like:

volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
- mountPath: /etc/tls/private
name: manager-metric-tls
readOnly: true
- mountPath: /apiserver.local.config/certificates
name: apiservice-cert
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-cert
volumes:
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
- name: manager-metric-tls
secret:
defaultMode: 420
secretName: manager-metrics-tls
- name: apiservice-cert
secret:
items:
- key: tls.crt
path: apiserver.crt
- key: tls.key
path: apiserver.key
secretName: netobserv-controller-manager-service-cert
- name: webhook-cert
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
secretName: netobserv-controller-manager-service-cert

Now, it looks like:

volumeMounts:
- mountPath: /etc/tls/private
name: manager-metric-tls
readOnly: true
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-cert
volumes:
- name: manager-metric-tls
secret:
defaultMode: 420
secretName: manager-metrics-tls
- name: webhook-cert
secret:
items:
- key: tls.crt
path: tls.crt
- key: tls.key
path: tls.key
secretName: netobserv-controller-manager-service-cert

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Per Goncalves da Silva added 3 commits June 2, 2025 12:46
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
…t replaced
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
@perdasilva
perdasilva requested a review from a team as a code ownerJune 2, 2025 11:27
@netlify

netlifyBot commented Jun 2, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commit91dc9a1
🔍 Latest deploy loghttps://app.netlify.com/projects/olmv1/deploys/683d8aad1924f40008794ad1
😎 Deploy Previewhttps://deploy-preview-2002--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@camilamacedo86camilamacedo86 left a comment

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.

It really make sense 👍

@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Jun 2, 2025
@openshift-ci

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

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-ciopenshift-ciBot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 2, 2025
@codecov

codecovBot commented Jun 2, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.17%. Comparing base (d41ddd0) to head (91dc9a1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #2002 +/- ##
=======================================
Coverage 69.17% 69.17% =======================================
Files 79 79 Lines 7027 7037 +10 =======================================
+ Hits 4861 4868 +7 - Misses 1885 1887 +2 - Partials 281 282 +1 
FlagCoverage Δ
e2e43.00% <0.00%> (-0.14%)⬇️
unit60.05% <100.00%> (+0.04%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-merge-bot
openshift-merge-botBot merged commit 8f81c23 into operator-framework:mainJun 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@perdasilva@camilamacedo86