-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom sidecar config #4280
Conversation
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
pkg/plugins/resources/k8s/native/api/v1alpha1/container_patch.go
Outdated
Show resolved
Hide resolved
} | ||
patchStr += `}]` | ||
|
||
return jsonpatch.DecodePatch([]byte(patchStr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch is a []Operation and Operation is a map[string]*json.RawMessage, RawMessage is a []byte.
So to me you can rebuild this all more easily with a
func ToJsonPatch(in []patchBlock) (jsonpatch.Patch) {
res := []jsonPath.Operation{}
for _, o := range in {
res = append(res, map[string]*json.RawMessage{
"op": (&o.op).(*json.RawMessage),
....
})
}
return res
}
Seems like you'd solve potential injection problems and also a json deserialization cost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, also building raw json by appending strings is pretty ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, not exactly like in the comment. Please take a look
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
BTW I don't see the default in the CP no problem for adding it in a follow up PR but can you open an issue and add it to the project so we don't forget about it :) |
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
Why do we need a default? |
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
…-config Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #4280 +/- ##
==========================================
- Coverage 55.75% 55.65% -0.10%
==========================================
Files 935 937 +2
Lines 56434 56569 +135
==========================================
+ Hits 31462 31483 +21
- Misses 22498 22599 +101
- Partials 2474 2487 +13
Continue to review full report at Codecov.
|
Signed-off-by: Łukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Łukasz Dziedziak <lukidzi@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's getting in a good shape! One question re:selecting a patch that doesn't exist and should we add a webhook to validate that patches are only installed in the namespace of the CP?
yes we should, let me do it |
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
Summary
Add CRD for applying patches to sidecar and init containers.
Two small deviations from the proposal -
Making this a draft until I can get the injector tests working locally.
Full changelog
Issues resolved
Fix #4273
Documentation
Testing
Backwards compatibility
UPGRADE.md
with any steps users will need to take when upgrading.backport-to-stable
label if the code follows our backporting policy