Config overrides: use apiVersion instead of group for easier UX #489
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.
This is an experiment building on @andreaskaris's work in #475.
After reviewing the override functionality, I wanted to explore a couple of changes that I think make the feature easier to use and more robust.
What changed
1. Replace
groupwithapiVersionin the override specThe original implementation required users to specify:
This means users need to remember API group names (
apps,storage.k8s.io, empty string for core resources, etc.) and mentally splitapiVersioninto group/version.The new approach uses
apiVersiondirectly:This is the same format users see in
kubectl get -o yamloutput, so they can copy/paste directly. No need to remember that ConfigMaps have an empty group or that DaemonSets live inapps.2. Use scheme-based GVK resolution
The original implementation matched overrides using
resource.GetObjectKind().GroupVersionKind(). This is fragile because many objects constructed in code don't have their TypeMeta populated - it's only reliably set when objects are decoded from the API server.The PR had already worked around this by manually adding TypeMeta to the ConfigMap:
The new approach uses the controller's scheme to resolve GVK:
This works reliably for all objects regardless of how they were constructed, so we can remove the manual TypeMeta workaround.
Testing
I've tested this on a kind cluster:
The escape hatch semantics work as expected: complete hands-off while unmanaged, operator resumes control when the override is removed.
Summary
These changes are subjective improvements for UX and robustness. The core override functionality from #475 is unchanged - this just makes it easier to configure and removes a potential source of silent matching failures.
Happy to discuss if there are concerns or alternative approaches.