Repository navigation
Support init containers - #12019
Support init containers#12019
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12019 +/- ##
==========================================
- Coverage 87.44% 87.30% -0.14%
==========================================
Files 196 196
Lines 9534 9582 +48
==========================================
+ Hits 8337 8366 +29
- Misses 923 940 +17
- Partials 274 276 +2
Continue to review full report at Codecov.
|
|
Test fail unrelated: |
|
haven't actually looked through things yet, but since tomorrow's the release cut, let's delay this after that out of an abundance of caution. /hold |
185901f to
349c6de
Compare
|
|
/unhold Release is done. |
|
/assign @dprotaso |
da04659 to
69fb63f
Compare
|
Failures are irrelevant: |
|
@dprotaso gentle ping. |
| var errs *apis.FieldError | ||
| if len(ports) == 0 { | ||
| return nil | ||
| } | ||
| for _, p := range ports { | ||
| errs = errs.Also(validateContainerPortBasic(p)) | ||
| } | ||
| return errs | ||
| } |
There was a problem hiding this comment.
It looks like init containers ports are being treated differently than sidecar ports
we're skipping the checks
- only TCP is allowed
- only allow port names
httph2cand `` (blank)
Thus I'm wondering what motivated the relaxed requirement and whether we should consider revisiting what we do for sidecars
There was a problem hiding this comment.
My pov is that init containers are not part of normal app operation. So I thought users should be more flexible (be closer to K8s initi container's allowed spec) and so to use more stuff than normal Service operation allows. For example port names should be arbitrary at this point and communication protocol can be any because people may want to setup their app in some arbitrary way.
There was a problem hiding this comment.
I agree - but let's pull this thread into an issue and see if anyone else has any opinions & thoughts.
| if !test.skipContainerTest { | ||
| got := ValidateContainer(ctx, test.c, test.volumes) | ||
| if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" { | ||
| t.Errorf("ValidateContainer (-want, +got): \n%s", diff) | ||
| } | ||
| } | ||
|
|
||
| if test.testAsInitContainer { | ||
| got := validateInitContainer(ctx, test.c, test.volumes) | ||
| if diff := cmp.Diff(test.wantForInitContainer.Error(), got.Error()); diff != "" { | ||
| t.Errorf("ValidateInitContainer (-want, +got): \n%s", diff) | ||
| } |
There was a problem hiding this comment.
I think for the sake of clarity and readability we pull the init container validation tests into a separate Test function with it's own cases
There was a problem hiding this comment.
I thought about it but this seems the most compact representation (trade-off with clarity) to avoid repeating stuff as most scenarios apply both to user containers and init containers. Afterall these are just containers to validated in the same pod.
Otherwise I will have to copy all common cases to a func that returns them and then add only the specific ones for user containers, as the init containers ones are a subset. Anyway I can try it and see.
69fb63f to
520174e
Compare
|
@dprotaso I refactored the test cases, ready for review. Let's discuss sidecar containers although init containers are not like that because they are not running along with the app but they run to completion before the app is run. So I consider them to have different semantics. |
Fails look irrelevant. |
|
/lgtm Posting my comment re: sidecar vs. container differences again
@skonto can you update the docs/websites highlighting the new feature flag & create a new issue for the topic above |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, skonto The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I just made the docs issue & comment - so I can close this tab :) |
Tracking Issue: #12024
Sample run:
/cc @julz @dprotaso @markusthoemmes