Skip to content

feat: implement controller for component config and annotations (EP-1898)#127

Open
swghosh wants to merge 2 commits intoopenshift:ai-staging-release-1.0from
swghosh:feature/controller-impl-1898
Open

feat: implement controller for component config and annotations (EP-1898)#127
swghosh wants to merge 2 commits intoopenshift:ai-staging-release-1.0from
swghosh:feature/controller-impl-1898

Conversation

@swghosh
Copy link
Copy Markdown
Member

@swghosh swghosh commented Apr 6, 2026

Summary

  • Implements controller reconciliation logic for the new annotations and componentConfigs API fields from EP-1898
  • Adds component_config.go with functions to apply per-component deployment overrides and global annotations
  • Integrates into the existing getDeploymentObject() flow in deployments.go
  • Includes comprehensive unit test coverage in component_config_test.go

Enhancement Proposal

openshift/enhancements#1898

Depends On

Changes

File Description
pkg/controller/external_secrets/component_config.go New file: annotation application, component config overrides, env var merging
pkg/controller/external_secrets/component_config_test.go Unit tests for all new functions
pkg/controller/external_secrets/deployments.go Integration: calls applyAnnotations() and applyComponentConfig()

Implementation Details

  • applyAnnotations() — merges user annotations onto Deployment + Pod template metadata
  • applyComponentConfig() — maps ComponentName → deployment asset, applies revisionHistoryLimit and overrideEnv
  • applyOverrideEnv() — merges user env vars into the correct container, overriding conflicts

Test plan

  • make generate passes
  • make build passes (compilation verified)
  • Unit tests validate annotation application, component config mapping, env var merging
  • Integration: annotations are applied to all 4 component deployments
  • Integration: revisionHistoryLimit correctly applied per-component
  • Integration: overrideEnv correctly merged with existing container env vars

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f181a7b6-b58b-4901-bd3b-18e3821f7c6d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: swghosh

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 6, 2026
@swghosh swghosh force-pushed the feature/controller-impl-1898 branch 2 times, most recently from 9034bd5 to c93ed1f Compare April 6, 2026 08:26
…-1898)

Extend the ExternalSecretsConfig API with annotations and componentConfig
fields in ControllerConfig to support per-component deployment overrides.

New types added:
- ComponentConfig: per-component configuration with deploymentConfigs and overrideEnv
- DeploymentConfig: deployment-level overrides (revisionHistoryLimit)
- KVPair/Annotation: reusable key-value pair types for custom annotations

New ComponentName enum values: Webhook, CertController (extending existing
ExternalSecretsCoreController and BitwardenSDKServer).

Includes CEL validation rules for:
- Reserved annotation prefix rejection (kubernetes.io/, openshift.io/, etc.)
- Reserved environment variable prefix rejection (HOSTNAME, KUBERNETES_, EXTERNAL_SECRETS_)
- Component name uniqueness enforcement
- RevisionHistoryLimit minimum value of 1

Also includes comprehensive integration test suite covering all new fields,
validation rules, and update scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@swghosh swghosh force-pushed the feature/controller-impl-1898 branch from c93ed1f to b60b8fc Compare April 6, 2026 08:30
…(EP-1898)

Add controller implementation to reconcile the new annotations and
componentConfig fields from ExternalSecretsConfig into operand deployments.

New file: component_config.go
- applyAnnotations: merges custom annotations onto Deployment and Pod template
- applyComponentConfig: applies per-component overrides (revisionHistoryLimit, overrideEnv)
- applyOverrideEnv: merges override environment variables with existing container env
- componentNameToDeploymentAsset/componentNameToContainerName: mapping tables
- getComponentNameForAsset: reverse lookup from asset to component name

Modified files:
- deployments.go: integrates annotation and component config application into
  getDeploymentObject pipeline
- networkpolicy.go: extends getPodSelectorForComponent with Webhook and
  CertController pod selectors

Unit tests: component_config_test.go
- TestApplyAnnotations: empty, single, multiple, override scenarios
- TestApplyComponentConfig: revisionHistoryLimit, overrideEnv, no-match, combined
- TestApplyOverrideEnv: add, override, no-match container scenarios
- TestGetComponentNameForAsset: all 4 components + unknown asset error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant