forked from linkerd/linkerd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce inject check for known sidecars (linkerd#1619)
`linkerd inject` was not checking its input for known sidecars and initContainers. Modify `linkerd inject` to check for existing sidecars and initContainers, specifically, Linkerd, Istio, and Contour. Part of linkerd#1516 Signed-off-by: Andrew Seigner <[email protected]>
- Loading branch information
Showing
21 changed files
with
357 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
cli/cmd/testdata/inject-filepath/expected/injected_nginx.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
cli/cmd/testdata/inject-filepath/expected/injected_redis.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: contour | ||
name: contour | ||
namespace: heptio-contour | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: contour | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: contour | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/port: "9001" | ||
prometheus.io/path: "/stats" | ||
prometheus.io/format: "prometheus" | ||
spec: | ||
containers: | ||
- image: gcr.io/heptio-images/contour:master | ||
imagePullPolicy: Always | ||
name: contour | ||
command: ["contour"] | ||
args: ["serve", "--incluster"] | ||
- image: docker.io/envoyproxy/envoy-alpine:v1.6.0 | ||
name: envoy | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
- containerPort: 8443 | ||
name: https | ||
command: ["envoy"] | ||
args: | ||
- --config-path /config/contour.yaml | ||
- --service-cluster cluster0 | ||
- --service-node node0 | ||
- --log-level info | ||
- --v2-config-only | ||
volumeMounts: | ||
- name: contour-config | ||
mountPath: /config | ||
initContainers: | ||
- image: gcr.io/heptio-images/contour:master | ||
imagePullPolicy: Always | ||
name: envoy-initconfig | ||
command: ["contour"] | ||
args: ["bootstrap", "/config/contour.yaml"] | ||
volumeMounts: | ||
- name: contour-config | ||
mountPath: /config | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
hostNetwork: pods do not use host networking...............................[ok] | ||
sidecar: pods do not have a proxy or initContainer already injected........[warn] -- known sidecar detected in deployment/contour | ||
supported: at least one resource injected..................................[warn] -- no supported objects found | ||
udp: pod specs do not include UDP ports....................................[ok] | ||
|
||
Summary: 0 of 1 YAML document(s) injected | ||
|
151 changes: 151 additions & 0 deletions
151
cli/cmd/testdata/inject_emojivoto_already_injected.input.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
creationTimestamp: null | ||
name: web1 | ||
namespace: emojivoto | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: web-svc | ||
strategy: {} | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: web-svc | ||
spec: | ||
containers: | ||
- env: | ||
- name: WEB_PORT | ||
value: "80" | ||
- name: EMOJISVC_HOST | ||
value: emoji-svc.emojivoto:8080 | ||
- name: VOTINGSVC_HOST | ||
value: voting-svc.emojivoto:8080 | ||
- name: INDEX_BUNDLE | ||
value: dist/index_bundle.js | ||
image: buoyantio/emojivoto-web:v3 | ||
name: web-svc | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
resources: {} | ||
- image: gcr.io/linkerd-io/proxy:foo | ||
status: {} | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
creationTimestamp: null | ||
name: web2 | ||
namespace: emojivoto | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: web-svc | ||
strategy: {} | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: web-svc | ||
spec: | ||
containers: | ||
- env: | ||
- name: WEB_PORT | ||
value: "80" | ||
- name: EMOJISVC_HOST | ||
value: emoji-svc.emojivoto:8080 | ||
- name: VOTINGSVC_HOST | ||
value: voting-svc.emojivoto:8080 | ||
- name: INDEX_BUNDLE | ||
value: dist/index_bundle.js | ||
image: buoyantio/emojivoto-web:v3 | ||
name: web-svc | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
resources: {} | ||
- name: linkerd-proxy | ||
status: {} | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
creationTimestamp: null | ||
name: web3 | ||
namespace: emojivoto | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: web-svc | ||
strategy: {} | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: web-svc | ||
spec: | ||
containers: | ||
- env: | ||
- name: WEB_PORT | ||
value: "80" | ||
- name: EMOJISVC_HOST | ||
value: emoji-svc.emojivoto:8080 | ||
- name: VOTINGSVC_HOST | ||
value: voting-svc.emojivoto:8080 | ||
- name: INDEX_BUNDLE | ||
value: dist/index_bundle.js | ||
image: buoyantio/emojivoto-web:v3 | ||
name: web-svc | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
resources: {} | ||
initContainers: | ||
- image: gcr.io/linkerd-io/proxy-init:foo | ||
status: {} | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
creationTimestamp: null | ||
name: web4 | ||
namespace: emojivoto | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: web-svc | ||
strategy: {} | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: web-svc | ||
spec: | ||
containers: | ||
- env: | ||
- name: WEB_PORT | ||
value: "80" | ||
- name: EMOJISVC_HOST | ||
value: emoji-svc.emojivoto:8080 | ||
- name: VOTINGSVC_HOST | ||
value: voting-svc.emojivoto:8080 | ||
- name: INDEX_BUNDLE | ||
value: dist/index_bundle.js | ||
image: buoyantio/emojivoto-web:v3 | ||
name: web-svc | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
resources: {} | ||
initContainers: | ||
- name: linkerd-init | ||
status: {} | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
hostNetwork: pods do not use host networking...............................[ok] | ||
sidecar: pods do not have a proxy or initContainer already injected........[warn] -- known sidecar detected in deployment/web1, deployment/web2, deployment/web3, deployment/web4 | ||
supported: at least one resource injected..................................[warn] -- no supported objects found | ||
udp: pod specs do not include UDP ports....................................[ok] | ||
|
||
Summary: 0 of 4 YAML document(s) injected | ||
|
Oops, something went wrong.