Skip to content

Commit

Permalink
Skip outbound port 443 in control-plane (#2411)
Browse files Browse the repository at this point in the history
#2349 introduced a `SelfSubjectAccessReview` check at
startup, to determine whether each control-plane component should
establish Kubernetes watches cluster-wide or namespace-wide. If this
check occurs before the linkerd-proxy sidecar is ready, it fails, and
the control-plane component restarts.

This change configures each control-plane pod to skip outbound port 443
when injecting the proxy, allowing the control-plane to connect to
Kubernetes regardless of the `linkerd-proxy` state.

A longer-term fix should involve a more robust control-plane startup,
that is resilient to failed Kubernetes API requests. An even longer-term
fix could involve injecting `linkerd-proxy` as a Kubernetes "sidecar"
container, when that becomes available.

Workaround for #2407

Signed-off-by: Andrew Seigner <[email protected]>
  • Loading branch information
siggy authored Feb 27, 2019
1 parent 40076c4 commit d08dcb0
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func validateAndBuildConfig(options *installOptions) (*installConfig, error) {
return nil, err
}

// TODO: these seem to not be used?
ignoreInboundPorts := []string{
fmt.Sprintf("%d", options.proxyControlPort),
fmt.Sprintf("%d", options.proxyMetricsPort),
Expand Down Expand Up @@ -316,11 +317,16 @@ func render(config installConfig, w io.Writer, options *installOptions) error {
}

injectOptions := newInjectOptions()
injectOptions.proxyConfigOptions = options.proxyConfigOptions
*injectOptions.proxyConfigOptions = *options.proxyConfigOptions

// Special case for linkerd-proxy running in the Prometheus pod.
injectOptions.proxyOutboundCapacity[config.PrometheusImage] = prometheusProxyOutboundCapacity

// Skip outbound port 443 to enable Kubernetes API access without the proxy.
// Once Kubernetes supports sidecar containers, this may be removed, as that
// will guarantee the proxy is running prior to control-plane startup.
injectOptions.ignoreOutboundPorts = append(injectOptions.ignoreOutboundPorts, 443)

return InjectYAML(&buf, w, ioutil.Discard, injectOptions)
}

Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_default.golden
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -517,6 +519,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -698,6 +702,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -945,6 +951,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_ha_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -535,6 +537,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -722,6 +726,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -975,6 +981,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_ha_with_overrides_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -535,6 +537,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -722,6 +726,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -975,6 +981,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
12 changes: 12 additions & 0 deletions cli/cmd/testdata/install_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -521,6 +523,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -703,6 +707,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -951,6 +957,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1188,6 +1196,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1322,6 +1332,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
10 changes: 10 additions & 0 deletions cli/cmd/testdata/install_single_namespace_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -412,6 +414,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -596,6 +600,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -846,6 +852,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1085,6 +1093,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down

0 comments on commit d08dcb0

Please sign in to comment.