Optimize sync throughput, fix CRD/RBAC bugs, and add redeployLabelSelector#47
Open
felipesabadini wants to merge 6 commits intophasehq:mainfrom
Open
Optimize sync throughput, fix CRD/RBAC bugs, and add redeployLabelSelector#47felipesabadini wants to merge 6 commits intophasehq:mainfrom
felipesabadini wants to merge 6 commits intophasehq:mainfrom
Conversation
Includes fixes from 953795a: - Remove required status.conditions from CRD (fixes 422 on new PhaseSecrets) - Add phasesecrets/status permission to ClusterRole (fixes status update denied) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…version Includes: - Add Phase Kubernetes Operator v1.5.0 with updated metadata, icon, and keywords - Bump chart version to 1.5.0 and appVersion to 1.5.0 in Chart.yaml
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Hi! Just following up on this PR. I’m currently running this version self-hosted in my cluster and it has been working well so far. Since it includes fixes for the CRD status validation and the RBAC issue with phasesecrets/status, I wanted to check if the approach looks good to you or if you'd prefer any adjustments before moving forward. Happy to update anything if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the Kubernetes Secrets Operator behavior under higher load (many
PhaseSecretresources), reduces unnecessary API work, adds clearer operational telemetry, and fixes two bugs that caused the operator to silently stop processing new PhaseSecrets.Bug Fixes
CRD status validation (422 Unprocessable Entity)
The CRD schema had
required: ["conditions"]onstatus, but the operator does not populate this field on creation. This caused the API server to reject status updates for newly created PhaseSecrets with:Fix: Removed
required: ["conditions"]from the status schema incrd-template.yaml.RBAC missing
phasesecrets/status(403 Forbidden)The operator's ClusterRole was missing the
phasesecrets/statussub-resource permission. When the operator tried to update the status of a PhaseSecret, it received:After this error, kopf silently stopped processing the affected PhaseSecret daemon — no retries, no further syncs.
Fix: Added
phasesecrets/statustoverbs: [get, patch, update]in the ClusterRole.What changed
1) Operator scalability and runtime behavior
settings.execution.max_workers = 50kopf run --all-namespaces /app/main.pyPhaseSecretdaemon to avoid synchronized bursts at startup.2) Sync loop observability and log quality
statusduration_sphase_api_callsINFOtoDEBUGto reduce log noise.3) Phase API efficiency and HTTP robustness
requests.Sessionwith retry/backoff and timeout support:PHASE_HTTP_TIMEOUT(default:10)PHASE_HTTP_RETRIES(default:2)PHASE_HTTP_BACKOFF(default:0.3)Phaseclient for per-cycle visibility.phase_client,user_data,resolved_context) during sync.4) Secret reference resolution performance
build_secrets_index) and fetch cache to avoid repeated recomputation and repeated lookups when resolving references.5) Kubernetes secret update behavior
replace_namespaced_secretwithresourceVersionwhen existing,createwhen missing), avoiding transient secret deletion windows where pods could read a missing secret.6) Optional redeploy scope optimization
spec.redeployLabelSelector7) Safety fix in
Phase.get()resolved_contextis provided,user_datamust also be provided.ValueErrorinstead of failing later withAttributeError.8) Docs / charts / CRD updates
DockerfilecommandREADME.mdusage examplesredeployLabelSelectorvalues.yamlwith HTTP env defaults1.5.09) Tests
src/tests/test_secret_referencing.pyValidation
Compatibility
redeployLabelSelectoris optional — omitting it preserves the current behavior (scan all deployments in namespace).