cert-manager-operator icon indicating copy to clipboard operation
cert-manager-operator copied to clipboard

feat: Allows for override replicas quantity to deploy a HA cert manager

Open appiepollo14 opened this issue 1 year ago β€’ 6 comments

As there was IMHO no way to deploy a HA cert manager, via the cert-manager-operator, I've added the option to override the replicas via the resource. If no override is done, the default (1) replicas is used, If an override is passed, other than 0, that value is set as the replicacount.

Love to hear your feedback.

appiepollo14 avatar Jan 27 '25 12:01 appiepollo14

Hi @appiepollo14. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

openshift-ci[bot] avatar Jan 27 '25 12:01 openshift-ci[bot]

@swghosh @deads2k any update in this PR please.

appiepollo14 avatar Feb 03 '25 19:02 appiepollo14

@swghosh can we continue? This fixes: https://issues.redhat.com/browse/RFE-6735

appiepollo14 avatar Feb 14 '25 12:02 appiepollo14

/ok-to-test

swghosh avatar Mar 12 '25 17:03 swghosh

/test all

swghosh avatar May 22 '25 14:05 swghosh

@swghosh who needs to resolve? Let’s merge soon In order to prevent conflict in the future.

appiepollo14 avatar May 23 '25 16:05 appiepollo14

@appiepollo14 Can you help rebase this?

swghosh avatar Jun 03 '25 09:06 swghosh

@swghosh done, let merge please.

appiepollo14 avatar Jun 07 '25 18:06 appiepollo14

/retest

appiepollo14 avatar Jun 08 '25 10:06 appiepollo14

/retest

appiepollo14 avatar Jun 08 '25 16:06 appiepollo14

/retitle RFE-6735: Allows for override replicas quantity to deploy a HA cert manager

/hold until CM-589 is concluded.

swghosh avatar Jun 20 '25 18:06 swghosh

@appiepollo14: This pull request references RFE-6735 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 feature request to target the "4.20.0" version, but no target version was set.

In response to this:

As there was IMHO no way to deploy a HA cert manager, via the cert-manager-operator, I've added the option to override the replicas via the resource. If no override is done, the default (1) replicas is used, If an override is passed, other than 0, that value is set as the replicacount.

Love to hear your feedback.

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-robot avatar Jun 20 '25 18:06 openshift-ci-robot

@swghosh ready to emerge?

appiepollo14 avatar Jun 20 '25 18:06 appiepollo14

/retest

appiepollo14 avatar Sep 01 '25 08:09 appiepollo14

@swghosh the e2e failure is unrelated to this change. Can we please move forward after 8 months.

appiepollo14 avatar Sep 01 '25 12:09 appiepollo14

Walkthrough

Adds an optional OverrideReplicas field to the DeploymentConfig API and CRD schemas, implements logic to read and apply replica overrides in the deployment controller via a new hook, updates applyconfigurations and deep-copy code, and adds unit tests.

Changes

Cohort / File(s) Summary of Changes
API type extension
api/operator/v1alpha1/certmanager_types.go
Added OverrideReplicas *int32 to DeploymentConfig with kubebuilder validation (minimum: 1) and JSON tag overrideReplicas,omitempty.
Applyconfigurations update
pkg/operator/applyconfigurations/operator/v1alpha1/deploymentconfig.go
Added OverrideReplicas *int32 to DeploymentConfigApplyConfiguration and fluent setter WithOverrideReplicas(value int32) *DeploymentConfigApplyConfiguration.
Deep-copy generation
api/operator/v1alpha1/zz_generated.deepcopy.go
Added nil-guarded deep-copy support for OverrideReplicas.
CRD and bundle schemas
config/crd/bases/operator.openshift.io_certmanagers.yaml, bundle/manifests/operator.openshift.io_certmanagers.yaml
Inserted overrideReplicas (integer, format: int32, minimum: 1) with description "OverrideReplicas defines the number of replicas to run for an operand" under spec.[cainjectorConfig, controllerConfig, webhookConfig].properties.
Deployment controller helpers and hooks
pkg/controller/deployment/deployment_helper.go, pkg/controller/deployment/deployment_overrides.go, pkg/controller/deployment/generic_deployment_controller.go
Added getOverrideReplicasFor(certmanagerinformer.CertManagerInformer, string) (*int32, error); introduced overrideReplicasFunc type and withDeploymentReplicasOverrideHook(...) to apply non-nil overrides to deployment.Spec.Replicas; integrated the hook into the generic deployment controller.
Tests
pkg/controller/deployment/deployment_helper_test.go
Added TestGetOverrideReplicasFor to verify override extraction for controller, webhook, cainjector, and no-override cases (test appears duplicated).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

βœ… Passed checks (3 passed)
Check name Status Explanation
Title Check βœ… Passed The title clearly summarizes the primary change by indicating that the pull request adds the ability to override replica counts for deploying a highly available cert manager, and it directly relates to the main functionality introduced without extraneous details.
Description Check βœ… Passed The description directly explains the new feature of overriding replica counts for HA deployments, aligns with the changeset, and provides context on default behavior and usage, making it sufficiently related to the pull request.
Docstring Coverage βœ… Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
πŸ§ͺ Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between f2482cc1739e1198a4217d2e1fd0a4194a82af33 and bc4ff39390b2b1ecb90e2c1fa110e9632fec64e7.

πŸ“’ Files selected for processing (1)
  • bundle/manifests/operator.openshift.io_certmanagers.yaml (3 hunks)
πŸ”‡ Additional comments (1)
bundle/manifests/operator.openshift.io_certmanagers.yaml (1)

180-185: Schema update mirrors DeploymentConfig addition.

The new overrideReplicas property (int32, minimum 1) is wired through for each operand, keeping the CRD bundle aligned with the API changes.

Also applies to: 422-427, 709-714


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 24 '25 17:09 coderabbitai[bot]

/approve

appiepollo14 avatar Sep 24 '25 17:09 appiepollo14

@appiepollo14 Appreciate your contribution and patience! I believe we're very close to landing it.

Implemented the requested changes, thanks. Let's continu. It has just been 9 months now ;)

appiepollo14 avatar Sep 24 '25 17:09 appiepollo14

/retest

appiepollo14 avatar Sep 24 '25 18:09 appiepollo14

/retest

appiepollo14 avatar Sep 25 '25 04:09 appiepollo14

@lunarwhite are the e2e failures related to this change?

appiepollo14 avatar Sep 25 '25 07:09 appiepollo14

are the e2e failures related to this change?

@appiepollo14 No not relevant

In order to do some quick followup tests end-to-end, I've cherrypicked your commit into PR #315 and specially called out your amazing contribution. Apart from your code change I just added some more UTs and along with e2e tests. We're going to include this feature in the upcoming v1.18.0 release (targeting Oct.)

lunarwhite avatar Sep 25 '25 11:09 lunarwhite

are the e2e failures related to this change?

@appiepollo14 No not relevant

In order to do some quick followup tests end-to-end, I've cherrypicked your commit into PR #315 and specially called out your amazing contribution. Apart from your code change I just added some more UTs and along with e2e tests. We're going to include this feature in the upcoming v1.18.0 release (targeting Oct.)

Ahhh so this pr will be discarded?

appiepollo14 avatar Sep 25 '25 12:09 appiepollo14

In order to do some quick followup tests end-to-end, I've cherrypicked your commit into PR #315 and specially called out your amazing contribution. Apart from your code change I just added some more UTs and along with e2e tests. We're going to include this feature in the upcoming v1.18.0 release (targeting Oct.)

@lunarwhite Thanks for the acknowledgement and for moving this along! I’d love for my original PRs to get merged directly where possible β€” happy to take on test additions or follow-ups if that helps. That said, I’m glad this feature made it into the upcoming release πŸŽ‰.

appiepollo14 avatar Sep 25 '25 17:09 appiepollo14

/lgtm /label px-approved

bharath-b-rh avatar Sep 29 '25 06:09 bharath-b-rh

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: appiepollo14, bharath-b-rh

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:

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

openshift-ci[bot] avatar Sep 29 '25 06:09 openshift-ci[bot]

/label qe-approved /verified by permerge

lunarwhite avatar Sep 29 '25 06:09 lunarwhite

@lunarwhite: This PR has been marked as verified by permerge.

In response to this:

/label qe-approved /verified by permerge

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-robot avatar Sep 29 '25 06:09 openshift-ci-robot

@appiepollo14: This pull request references RFE-6735 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 feature request to target the "4.21.0" version, but no target version was set.

In response to this:

As there was IMHO no way to deploy a HA cert manager, via the cert-manager-operator, I've added the option to override the replicas via the resource. If no override is done, the default (1) replicas is used, If an override is passed, other than 0, that value is set as the replicacount.

Love to hear your feedback.

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-robot avatar Sep 29 '25 06:09 openshift-ci-robot

/unhold

bharath-b-rh avatar Sep 29 '25 06:09 bharath-b-rh