Skip to content

Add pluggable ClusterTLSPolicy extension point - #243

Open
mytreya-rh wants to merge 3 commits into
operator-framework:mainfrom
mytreya-rh:upstream-cluster-tls-policy-extension-point
Open

Add pluggable ClusterTLSPolicy extension point#243
mytreya-rh wants to merge 3 commits into
operator-framework:mainfrom
mytreya-rh:upstream-cluster-tls-policy-extension-point

Conversation

@mytreya-rh

@mytreya-rh mytreya-rh commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds internal/cmd/ansible-operator/run/tlspolicy.go: a ClusterTLSPolicy interface (Apply/Watch) plus RegisterClusterTLSPolicy, and wires it into run/cmd.go:
    • run() now uses a cancellable context (derived from signals.SetupSignalHandler()) so a registered policy can trigger a graceful shutdown/restart.
    • If a policy is registered, Apply() is called after f.ToManagerOptions() and before manager.New() so it can augment manager.Options (e.g. metrics server TLSOpts).
    • If a policy is registered, Watch() is called once the manager exists and before mgr.Start(ctx), so it can react to policy changes at runtime.
  • No policy is registered by default (registeredTLSPolicy is nil), so this is a no-op, backward-compatible change with zero new dependencies.
  • This is intended as a generic extension point that distributions (e.g. OpenShift's downstream fork) can hook into to enforce a centralized TLS policy without needing to carry a diff to cmd.go/run.go itself.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./internal/cmd/ansible-operator/run/... (new tlspolicy_test.go covers registration, overwrite, no-op default, and the fail-open contract)

Made with Cursor

mytreya-rh and others added 2 commits August 14, 2026 12:29
Adds internal/cmd/ansible-operator/run/tlspolicy.go: a ClusterTLSPolicy
interface (Apply/Watch) plus RegisterClusterTLSPolicy, and wires it into
run/cmd.go:
- run() now uses a cancellable context (derived from
  signals.SetupSignalHandler()) so a registered policy can trigger a
  graceful shutdown/restart.
- If a policy is registered, Apply() is called after
  f.ToManagerOptions() and before manager.New() so it can augment
  manager.Options (e.g. metrics server TLSOpts).
- If a policy is registered, Watch() is called once the manager exists
  and before mgr.Start(ctx), so it can react to policy changes at
  runtime.

No policy is registered by default (registeredTLSPolicy is nil), so this
is a no-op, backward-compatible change with zero new dependencies.

This is intended as a generic extension point that distributions (e.g.
OpenShift's downstream fork) can hook into to enforce a centralized TLS
policy without needing to carry a diff to cmd.go/run.go itself.

Co-authored-by: Cursor <cursoragent@cursor.com>
internal/cmd/ansible-operator/run/tlspolicy_test.go covers the
ClusterTLSPolicy hook: registration, overwriting a previously
registered policy, the no-op default (nothing registered), and the
fail-open contract (Apply may return an error; callers are expected to
log it and continue with the input options unchanged).

Co-authored-by: Cursor <cursoragent@cursor.com>
Bumps [cryptography](https://github.com/pyca/cryptography) from 49.0.0 to 50.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@49.0.0...50.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 50.0.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
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.

1 participant