OCPBUGS-84254: Redeploy console pods upon cert rotation#1142
OCPBUGS-84254: Redeploy console pods upon cert rotation#1142jhadvig wants to merge 1 commit intoopenshift:release-4.20from
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@jhadvig: This pull request references Jira Issue OCPBUGS-63502, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@jhadvig: This pull request references Jira Issue OCPBUGS-84254, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
@jhadvig: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Root cause
When the
console-serving-certsecret is rotated (by service-ca operator), the console-operator does not detect the change. The console pods continuerunning with the old certificate mounted at
/var/serving-cert, leading to TLS errors and console unavailability until pods are manually restarted.Solution
Register an informer for the
console-serving-certsecret so the operator watches it for changes. When the secret'sresourceVersionchanges, theoperator stamps the new value as a
console.openshift.io/serving-cert-secret-versionannotation on the console Deployment, which triggers anautomatic pod rollout with the new certificate.
Backport of #1093
Test cases
Scenario 1: Verify secret informer registration
$ oc get secret console-serving-cert -n openshift-console -o jsonpath='{.metadata.resourceVersion}'
36546
$ oc get deployment console -n openshift-console -o jsonpath='{.spec.template.metadata.annotations.console.openshift.io/serving-cert-secret-version}'
36546
Expected: The deployment annotation matches the secret's
resourceVersion.Scenario 2: Automatic pod restart on certificate rotation
Delete the serving cert to simulate rotation
$ oc delete secret console-serving-cert -n openshift-console
Wait for service-ca to regenerate it, then verify
$ oc get secret console-serving-cert -n openshift-console -o jsonpath='{.metadata.resourceVersion}'
38672
$ oc get deployment console -n openshift-console -o jsonpath='{.spec.template.metadata.annotations.console.openshift.io/serving-cert-secret-version}'
38672
$ oc get pods -n openshift-console
NAME READY STATUS RESTARTS AGE
console-75d8bfcdf6-6w2wf 1/1 Running 0 55s <-- redeployed
console-75d8bfcdf6-9zn7z 1/1 Running 0 55s <-- redeployed
downloads-6d94488dc7-rnqts 1/1 Running 0 52m
downloads-6d94488dc7-tb4bz 1/1 Running 0 52m
Expected: The annotation updates to the new
resourceVersionand console pods are automatically redeployed. Downloads pods remain untouched./assign @Leo6Leo