feat: make PodTemplateSpec more robust and less error prone #255
+1,582
−188
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.
What this PR does / why we need it:
This PR makes strategic merge patch more robust and less error prone by preventing several problematic use cases:
users needing to restate the base manifest (generated by KGO) which is not known to them before hand.
With this PR, this won't be necessary anymore as. Users won't need to provide elements form base manifests.
So this:
becomes:
using Go API users could experience merging mutually exclusive fields e.g. when setting env vars:
gateway-operator/pkg/utils/kubernetes/resources/strategicmerge_test.go
Lines 752 to 807 in 3876430
This PR fixes this as well. Users are not required anymore to restate the elements from the base manifest array as in e.g.
gateway-operator/pkg/utils/kubernetes/resources/strategicmerge_test.go
Lines 808 to 870 in 3876430
this PR additionally catches previously uncaught errors like setting not fully spec's readinessProbe on a sidecar:
gateway-operator/config/samples/dataplane-sidecar.yaml
Lines 44 to 46 in 36c58ab
This now properly yields an error and is not silenced:
Which issue this PR fixes
Related #128
Special notes for your reviewer:
Prior work: https://github.com/Kong/gateway-operator-archive/pull/1489/
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect significant changes