-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add native sidecar support #11465
Add native sidecar support #11465
Changes from 19 commits
dcffd36
2c1d8a1
945cd81
ccf447d
8dd3eea
9bf8f86
50fb0ee
6cb451d
f082f51
28b0aca
f6b2ddb
6e8f068
6303ff3
db2f92b
27b1328
2cda129
8e91ba2
6d68d65
7b36117
fb3f58c
7cd3679
62bcf87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{{ $prefix := .Values.pathPrefix -}} | ||
{{ $initIndex := ternary "0" "-" (dig "proxy" "nativeSidecar" false (merge (dict) .Values)) -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to have a template comment here explaining this. if I understand correctly, the reasoning is that in native sidecar mode, we can put our containers first so that other init containers can take advantage of the proxy but without native sidecar, the proxy-init and network-validator init containers must be last to ensure there are no containers that start after iptables has been configured but before the proxy has started. in other words, the proxy-init, network-validator, and proxy contains must be started consecutively. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree a comment is needed. My goal here was partially to preserve the current behavior when nativeSidecar was not enabled since it's entirely possible someone is relying on the order of the containers in a kubectl patch, kustomize or something. |
||
[ | ||
{{- if .Values.addRootMetadata }} | ||
{ | ||
|
@@ -62,14 +63,14 @@ | |
}, | ||
{ | ||
"op": "add", | ||
"path": "{{$prefix}}/spec/initContainers/-", | ||
"path": "{{$prefix}}/spec/initContainers/{{$initIndex}}{{$initIndex = add1 $initIndex}}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It silently becomes 1. I thought it was an acceptable quirk since in that case the variable is not used again. |
||
"value": | ||
{{- include "partials.proxy-init" . | fromYaml | toPrettyJson | nindent 6 }} | ||
}, | ||
{{- else if and .Values.proxy .Values.cniEnabled }} | ||
{ | ||
"op": "add", | ||
"path": "{{$prefix}}/spec/initContainers/-", | ||
"path": "{{$prefix}}/spec/initContainers/{{$initIndex}}{{$initIndex = add1 $initIndex}}", | ||
"value": | ||
{{- include "partials.network-validator" . | fromYaml | toPrettyJson | nindent 6 }} | ||
}, | ||
|
@@ -103,7 +104,9 @@ | |
{{- end }} | ||
{ | ||
"op": "add", | ||
{{- if .Values.proxy.await }} | ||
{{- if .Values.proxy.nativeSidecar }} | ||
"path": "{{$prefix}}/spec/initContainers/{{$initIndex}}", | ||
{{- else if .Values.proxy.await }} | ||
"path": "{{$prefix}}/spec/containers/0", | ||
{{- else }} | ||
"path": "{{$prefix}}/spec/containers/-", | ||
|
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.
I think these variables should be added to values.yaml. This will allow us to set default values in values.yaml instead of needing to do defaulting inline in the template like this.
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.
The inline defaults are for injection because I didn't plumb the values into
pkg/charts/linkerd2.Proxy
.I'm happy to do this, but I think this would expose those settings to users to modify which we discussed above as being out of scope or perhaps undesired. Please let me know if I'm mistaken.