Skip to content

Commit

Permalink
Enable istio-cni helm chart integration from istio.io repo (istio#9461)
Browse files Browse the repository at this point in the history
- requirements.yaml to point to official istio helm repo
- Make istio-cni enable and initContainer template flag a single option
- Makefile: add helm extra settings to generate_yaml.

Signed-off-by: Tim Swanson <tiswanso@cisco.com>
  • Loading branch information
tiswanso authored and linsun committed Oct 26, 2018
1 parent a78d9c5 commit cc53c3a
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 5 deletions.
30 changes: 26 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ endif
export GOOS ?= $(GOOS_LOCAL)

export ENABLE_COREDUMP ?= false

# Enable Istio CNI in helm template commands
export ENABLE_ISTIO_CNI ?= false

# NOTE: env var EXTRA_HELM_SETTINGS can contain helm chart override settings, example:
# EXTRA_HELM_SETTINGS="--set istio-cni.excludeNamespaces={} --set istio-cni.tag=v0.1-dev-foo"


ISTIO_HELM_REPO := https://raw.githubusercontent.com/istio/istio.io/master/static/charts
#-----------------------------------------------------------------------------
# Output control
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -612,27 +621,36 @@ $(HELM):
$(HOME)/.helm:
$(HELM) init --client-only

.PHONY: helm-repo-add

helm-repo-add:
$(HELM) repo add istio.io ${ISTIO_HELM_REPO}

# create istio-remote.yaml
istio-remote.yaml: $(HELM) $(HOME)/.helm
istio-remote.yaml: $(HELM) $(HOME)/.helm helm-repo-add
cat install/kubernetes/namespace.yaml > install/kubernetes/$@
$(HELM) dep update --skip-refresh install/kubernetes/helm/istio-remote
$(HELM) template --name=istio --namespace=istio-system \
--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
${EXTRA_HELM_SETTINGS} \
install/kubernetes/helm/istio-remote >> install/kubernetes/$@

# creates istio.yaml istio-auth.yaml istio-one-namespace.yaml istio-one-namespace-auth.yaml
# Ensure that values-$filename is present in install/kubernetes/helm/istio
isti%.yaml: $(HELM) $(HOME)/.helm
isti%.yaml: $(HELM) $(HOME)/.helm helm-repo-add
$(HELM) dep update --skip-refresh install/kubernetes/helm/istio
cat install/kubernetes/namespace.yaml > install/kubernetes/$@
$(HELM) template --set global.tag=${TAG} \
--name=istio \
--namespace=istio-system \
--set global.hub=${HUB} \
--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
${EXTRA_HELM_SETTINGS} \
--values install/kubernetes/helm/istio/values-$@ \
install/kubernetes/helm/istio >> install/kubernetes/$@

generate_yaml: $(HELM) $(HOME)/.helm
generate_yaml: $(HELM) $(HOME)/.helm helm-repo-add
$(HELM) dep update --skip-refresh install/kubernetes/helm/istio
./install/updateVersion.sh -a ${HUB},${TAG} >/dev/null 2>&1
cat install/kubernetes/namespace.yaml > install/kubernetes/istio.yaml
Expand All @@ -641,6 +659,8 @@ generate_yaml: $(HELM) $(HOME)/.helm
--namespace=istio-system \
--set global.hub=${HUB} \
--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
${EXTRA_HELM_SETTINGS} \
--values install/kubernetes/helm/istio/values.yaml \
install/kubernetes/helm/istio >> install/kubernetes/istio.yaml

Expand All @@ -652,6 +672,8 @@ generate_yaml: $(HELM) $(HOME)/.helm
--set global.mtls.enabled=true \
--set global.controlPlaneSecurityEnabled=true \
--set global.proxy.enableCoreDump=${ENABLE_COREDUMP} \
--set istio_cni.enabled=${ENABLE_ISTIO_CNI} \
${EXTRA_HELM_SETTINGS} \
--values install/kubernetes/helm/istio/values.yaml \
install/kubernetes/helm/istio >> install/kubernetes/istio-auth.yaml

Expand All @@ -662,7 +684,7 @@ generate_yaml_coredump:
# Generate the install files, using istioctl.
# TODO: make sure they match, pass all tests.
# TODO:
generate_yaml_new: $(HELM) $(HOME)/.helm
generate_yaml_new: $(HELM) $(HOME)/.helm helm-repo-add
$(HELM) init --client-only
$(HELM) dep update --skip-refresh install/kubernetes/helm/istio
./install/updateVersion.sh -a ${HUB},${TAG} >/dev/null 2>&1
Expand Down
4 changes: 4 additions & 0 deletions install/kubernetes/helm/istio-remote/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ dependencies:
version: 1.1.0
condition: security.enabled
repository: file://../subcharts/security
- name: istio-cni
version: ">=0.0.1"
repository: https://raw.githubusercontent.com/istio/istio.io/master/static/charts
condition: istio_cni.enabled
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ data:
config: |-
policy: {{ .Values.global.proxy.autoInject }}
template: |-
{{- if or (not .Values.istio_cni.enabled) .Values.global.proxy.enableCoreDump }}
initContainers:
{{- if not .Values.istio_cni.enabled }}
- name: istio-init
image: {{ .Values.global.hub }}/{{ .Values.global.proxy_init.image }}:{{ .Values.global.tag }}
args:
Expand Down Expand Up @@ -56,6 +58,7 @@ data:
privileged: true
{{ end }}
restartPolicy: Always
{{- end }}
{{ if eq .Values.global.proxy.enableCoreDump true }}
- name: enable-core-dump
args:
Expand All @@ -69,6 +72,7 @@ data:
securityContext:
privileged: true
{{ end }}
{{- end }}
containers:
- name: istio-proxy
image: {{ "[[ if (isset .ObjectMeta.Annotations \"sidecar.istio.io/proxyImage\") -]]" }}
Expand Down
8 changes: 8 additions & 0 deletions install/kubernetes/helm/istio-remote/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,11 @@ global:
# Use the Mesh Control Protocol (MCP) for configuring Mixer and
# Pilot. Requires galley (`--set galley.enabled=true`).
useMCP: false

#
# Istio CNI plugin enabled
# If true, the privileged initContainer istio-init is not needed to perform the traffic redirect
# settings for the istio-proxy.
#
istio_cni:
enabled: false
7 changes: 6 additions & 1 deletion install/kubernetes/helm/istio/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ dependencies:
- name: certmanager
version: 1.1.0
condition: certmanager.enabled
repository: file://../subcharts/certmanager
repository: file://../subcharts/certmanager
- name: istio-cni
version: ">=0.0.1"
repository: https://raw.githubusercontent.com/istio/istio.io/master/static/charts
condition: istio_cni.enabled

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ data:
config: |-
policy: {{ .Values.global.proxy.autoInject }}
template: |-
{{- if or (not .Values.istio_cni.enabled) .Values.global.proxy.enableCoreDump }}
initContainers:
{{- if not .Values.istio_cni.enabled }}
- name: istio-init
{{- if contains "/" .Values.global.proxy_init.image }}
image: "{{ .Values.global.proxy_init.image }}"
Expand Down Expand Up @@ -52,6 +54,7 @@ data:
privileged: true
{{ end -}}
restartPolicy: Always
{{- end }}
{{ if eq .Values.global.proxy.enableCoreDump true }}
- name: enable-core-dump
args:
Expand All @@ -69,6 +72,7 @@ data:
securityContext:
privileged: true
{{ end }}
{{- end }}
containers:
- name: istio-proxy
{{- if contains "/" .Values.global.proxy.image }}
Expand Down
8 changes: 8 additions & 0 deletions install/kubernetes/helm/istio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ tracing:
kiali:
enabled: false

#
# Istio CNI plugin enabled
# If true, the privileged initContainer istio-init is not needed to perform the traffic redirect
# settings for the istio-proxy.
#
istio_cni:
enabled: false

# Common settings used among istio subcharts.
global:
# Default hub for Istio images.
Expand Down

0 comments on commit cc53c3a

Please sign in to comment.