feat: patch CR status via the Kubernetes client, not kubectl - #2324
Closed
haseebsyed12 wants to merge 1 commit into
Closed
feat: patch CR status via the Kubernetes client, not kubectl#2324haseebsyed12 wants to merge 1 commit into
haseebsyed12 wants to merge 1 commit into
Conversation
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.
A hook process handles every CR in one binding context, and each status
write forked kubectl: process spawn, kubeconfig load and API discovery per
resource. With a few dozen CRs that is tens of seconds of pure overhead per
reconcile. One CustomObjectsApi, configured once, replaces it.
It also makes failures diagnosable. The chart derives the /status
RBAC rule from the CRD, so a template miss surfaces as a 403 -- previously
an opaque stderr string, now an HTTP status in the log. The error body is
truncated so one apiserver Status object cannot flood a log line.
The request on the wire is unchanged: the client's default content type for
this method is application/merge-patch+json, the same as
kubectl patch --type merge --subresource status.group, version and plural are derived from the two environment values the
chart already injects, so no new configuration. kubernetes>=32.0.0 was
already a dependency and utils.py already loaded client config; that load
is extracted as load_kubernetes_config and shared.
A namespace is now required to address the object rather than falling back
to kubectl's context namespace. All three plugin CRDs are Namespaced and the
namespace comes from the CR or POD_NAMESPACE, so this is unreachable in
practice; it is a warning-and-skip rather than a silent misdirected patch.
What does this change do?
Upgrade impact
upgrade-impactlabel and a release note: runscriv createfrom therepository root and describe the required action in the generated
changelog.d/file. See RELEASING.md.Operator action means anything a deployment has to do beyond a normal resync:
deploy repo or values changes, new or removed secrets, enabling or disabling a
component, or a manual one-time step.