Skip to content

Commit 8924ad4

Browse files
committed
chore: WIP - native sidecar fixes and test support
* There where we iterate over containers, also iterate over init containers * Set `proxy.nativeSidecar: true`, for all tests to run in that mode without further changes * Update golden files accordingly * Fix `curl.rs` in the policy tests so it doesn't block on waiting for the proxy container to terminate * Fix integration tests dealing with injection Note that k8s started supporting native sidecars without additional feature flags in v1.28. For this reason the following tests aren't supposed to pass: * test-policy with k8s v1.23 * test-multicluster with k8s v.1.23 * CNI integration test with k8s v1.27
1 parent 75fe78b commit 8924ad4

File tree

69 files changed

+7313
-7234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+7313
-7234
lines changed

charts/linkerd-control-plane/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ proxy:
249249
# -- Enable KEP-753 native sidecars
250250
# This is an experimental feature. It requires Kubernetes >= 1.29.
251251
# If enabled, .proxy.waitBeforeExitSeconds should not be used.
252-
nativeSidecar: false
252+
nativeSidecar: true
253253
# -- Native sidecar proxy startup probe parameters.
254254
# -- LivenessProbe timeout and delay configuration
255255
livenessProbe:

cli/cmd/inject_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ func TestProxyConfigurationAnnotations(t *testing.T) {
725725
values.Proxy.Await = false
726726
values.Proxy.AccessLog = "apache"
727727
values.Proxy.ShutdownGracePeriod = "60s"
728-
values.Proxy.NativeSidecar = true
729728

730729
expectedOverrides := map[string]string{
731730
k8s.ProxyIgnoreInboundPortsAnnotation: "8500-8505",
@@ -748,7 +747,6 @@ func TestProxyConfigurationAnnotations(t *testing.T) {
748747
k8s.ProxyAwait: "disabled",
749748
k8s.ProxyAccessLogAnnotation: "apache",
750749
k8s.ProxyShutdownGracePeriodAnnotation: "60s",
751-
k8s.ProxyEnableNativeSidecarAnnotation: "true",
752750
}
753751

754752
overrides := getOverrideAnnotations(values, baseValues)
@@ -877,6 +875,7 @@ func TestOverwriteRegistry(t *testing.T) {
877875
}
878876

879877
func diffOverrides(t *testing.T, expectedOverrides map[string]string, actualOverrides map[string]string) {
878+
t.Helper()
880879
if len(expectedOverrides) != len(actualOverrides) {
881880
t.Fatalf("expected annotations:\n%s\nbut received:\n%s", expectedOverrides, actualOverrides)
882881
}

cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,48 @@ spec:
1919
linkerd.io/workload-ns: ""
2020
spec:
2121
containers:
22+
- image: nginx
23+
name: nginx
24+
ports:
25+
- containerPort: 80
26+
name: http
27+
initContainers:
28+
- args:
29+
- --firewall-bin-path
30+
- iptables-nft
31+
- --firewall-save-bin-path
32+
- iptables-nft-save
33+
- --ipv6=false
34+
- --incoming-proxy-port
35+
- "4143"
36+
- --outgoing-proxy-port
37+
- "4140"
38+
- --proxy-uid
39+
- "2102"
40+
- --inbound-ports-to-ignore
41+
- 4190,4191,4567,4568
42+
- --outbound-ports-to-ignore
43+
- 4567,4568
44+
image: cr.l5d.io/linkerd/proxy-init:v2.4.3
45+
imagePullPolicy: IfNotPresent
46+
name: linkerd-init
47+
securityContext:
48+
allowPrivilegeEscalation: false
49+
capabilities:
50+
add:
51+
- NET_ADMIN
52+
- NET_RAW
53+
privileged: false
54+
readOnlyRootFilesystem: true
55+
runAsGroup: 65534
56+
runAsNonRoot: true
57+
runAsUser: 65534
58+
seccompProfile:
59+
type: RuntimeDefault
60+
terminationMessagePolicy: FallbackToLogsOnError
61+
volumeMounts:
62+
- mountPath: /run
63+
name: linkerd-proxy-init-xtables-lock
2264
- env:
2365
- name: _pod_name
2466
valueFrom:
@@ -158,13 +200,6 @@ spec:
158200
value: linkerd-destination.linkerd.serviceaccount.identity.linkerd.cluster.local
159201
image: cr.l5d.io/linkerd/proxy:install-proxy-version
160202
imagePullPolicy: IfNotPresent
161-
lifecycle:
162-
postStart:
163-
exec:
164-
command:
165-
- /usr/lib/linkerd/linkerd-await
166-
- --timeout=2m
167-
- --port=4191
168203
livenessProbe:
169204
httpGet:
170205
path: /live
@@ -183,61 +218,26 @@ spec:
183218
port: 4191
184219
initialDelaySeconds: 2
185220
timeoutSeconds: 1
221+
restartPolicy: Always
186222
securityContext:
187223
allowPrivilegeEscalation: false
188224
readOnlyRootFilesystem: true
189225
runAsNonRoot: true
190226
runAsUser: 2102
191227
seccompProfile:
192228
type: RuntimeDefault
229+
startupProbe:
230+
failureThreshold: 120
231+
httpGet:
232+
path: /ready
233+
port: 4191
234+
periodSeconds: 1
193235
terminationMessagePolicy: FallbackToLogsOnError
194236
volumeMounts:
195237
- mountPath: /var/run/linkerd/identity/end-entity
196238
name: linkerd-identity-end-entity
197239
- mountPath: /var/run/secrets/tokens
198240
name: linkerd-identity-token
199-
- image: nginx
200-
name: nginx
201-
ports:
202-
- containerPort: 80
203-
name: http
204-
initContainers:
205-
- args:
206-
- --firewall-bin-path
207-
- iptables-nft
208-
- --firewall-save-bin-path
209-
- iptables-nft-save
210-
- --ipv6=false
211-
- --incoming-proxy-port
212-
- "4143"
213-
- --outgoing-proxy-port
214-
- "4140"
215-
- --proxy-uid
216-
- "2102"
217-
- --inbound-ports-to-ignore
218-
- 4190,4191,4567,4568
219-
- --outbound-ports-to-ignore
220-
- 4567,4568
221-
image: cr.l5d.io/linkerd/proxy-init:v2.4.3
222-
imagePullPolicy: IfNotPresent
223-
name: linkerd-init
224-
securityContext:
225-
allowPrivilegeEscalation: false
226-
capabilities:
227-
add:
228-
- NET_ADMIN
229-
- NET_RAW
230-
privileged: false
231-
readOnlyRootFilesystem: true
232-
runAsGroup: 65534
233-
runAsNonRoot: true
234-
runAsUser: 65534
235-
seccompProfile:
236-
type: RuntimeDefault
237-
terminationMessagePolicy: FallbackToLogsOnError
238-
volumeMounts:
239-
- mountPath: /run
240-
name: linkerd-proxy-init-xtables-lock
241241
volumes:
242242
- emptyDir: {}
243243
name: linkerd-proxy-init-xtables-lock

0 commit comments

Comments
 (0)