Add code and yaml for Istio as an addon

This commit adds the following:
 - YAML for istio components to the addons directory (versions with
   and without auth)
 - logic to copy the appropriate YAML file into the addons manager
   dir, depending on ENABLE_ISTIO and ISTIO_AUTH_TYPE env vars
 - changes to addon manager script which allow plugins to exist in
   namespace other than kube-system. This is needed for Istio
   functionality
 - additional initialization for Istio in addon manager.
This commit is contained in:
Martin Ostrowski 2018-02-16 10:47:18 -08:00
parent 9586cd06c2
commit ec7f7a5c5f
4 changed files with 4381 additions and 4 deletions

View File

@ -107,7 +107,7 @@ function create_resource_from_string() {
local -r config_name=$4; local -r config_name=$4;
local -r namespace=$5; local -r namespace=$5;
while [ ${tries} -gt 0 ]; do while [ ${tries} -gt 0 ]; do
echo "${config_string}" | ${KUBECTL} ${KUBECTL_OPTS} --namespace="${namespace}" apply -f - && \ echo "${config_string}" | ${KUBECTL} ${KUBECTL_OPTS} apply -f - && \
log INFO "== Successfully started ${config_name} in namespace ${namespace} at $(date -Is)" && \ log INFO "== Successfully started ${config_name} in namespace ${namespace} at $(date -Is)" && \
return 0; return 0;
let tries=tries-1; let tries=tries-1;
@ -124,12 +124,12 @@ function reconcile_addons() {
# Filter out `configured` message to not noisily log. # Filter out `configured` message to not noisily log.
# `created`, `pruned` and errors will be logged. # `created`, `pruned` and errors will be logged.
log INFO "== Reconciling with deprecated label ==" log INFO "== Reconciling with deprecated label =="
${KUBECTL} ${KUBECTL_OPTS} apply --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \ ${KUBECTL} ${KUBECTL_OPTS} apply -f ${ADDON_PATH} \
-l ${CLUSTER_SERVICE_LABEL}=true,${ADDON_MANAGER_LABEL}!=EnsureExists \ -l ${CLUSTER_SERVICE_LABEL}=true,${ADDON_MANAGER_LABEL}!=EnsureExists \
--prune=true --recursive | grep -v configured --prune=true --recursive | grep -v configured
log INFO "== Reconciling with addon-manager label ==" log INFO "== Reconciling with addon-manager label =="
${KUBECTL} ${KUBECTL_OPTS} apply --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \ ${KUBECTL} ${KUBECTL_OPTS} apply -f ${ADDON_PATH} \
-l ${CLUSTER_SERVICE_LABEL}!=true,${ADDON_MANAGER_LABEL}=Reconcile \ -l ${CLUSTER_SERVICE_LABEL}!=true,${ADDON_MANAGER_LABEL}=Reconcile \
--prune=true --recursive | grep -v configured --prune=true --recursive | grep -v configured
@ -139,7 +139,7 @@ function reconcile_addons() {
function ensure_addons() { function ensure_addons() {
# Create objects already exist should fail. # Create objects already exist should fail.
# Filter out `AlreadyExists` message to not noisily log. # Filter out `AlreadyExists` message to not noisily log.
${KUBECTL} ${KUBECTL_OPTS} create --namespace=${SYSTEM_NAMESPACE} -f ${ADDON_PATH} \ ${KUBECTL} ${KUBECTL_OPTS} create -f ${ADDON_PATH} \
-l ${ADDON_MANAGER_LABEL}=EnsureExists --recursive 2>&1 | grep -v AlreadyExists -l ${ADDON_MANAGER_LABEL}=EnsureExists --recursive 2>&1 | grep -v AlreadyExists
log INFO "== Kubernetes addon ensure completed at $(date -Is) ==" log INFO "== Kubernetes addon ensure completed at $(date -Is) =="

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2238,6 +2238,13 @@ EOF
local -r metadata_proxy_yaml="${dst_dir}/metadata-proxy/gce/metadata-proxy.yaml" local -r metadata_proxy_yaml="${dst_dir}/metadata-proxy/gce/metadata-proxy.yaml"
update-prometheus-to-sd-parameters ${metadata_proxy_yaml} update-prometheus-to-sd-parameters ${metadata_proxy_yaml}
fi fi
if [[ "${ENABLE_ISTIO:-}" == "true" ]]; then
if [[ "${ISTIO_AUTH_TYPE:-}" == "MUTUAL_TLS" ]]; then
setup-addon-manifests "addons" "istio/auth"
else
setup-addon-manifests "addons" "istio/noauth"
fi
fi
# Place addon manager pod manifest. # Place addon manager pod manifest.
cp "${src_dir}/kube-addon-manager.yaml" /etc/kubernetes/manifests cp "${src_dir}/kube-addon-manager.yaml" /etc/kubernetes/manifests