mirror of https://github.com/k3s-io/k3s
Merge pull request #28132 from madhusudancs/fed-kubedns-flags-nodebootstrap
Automatic merge from submit-queue Substitute federation_domain_map parameter with its value in node bootstrap scripts. This PR also removes the substitution code we added to the build scripts. **Release Note** ```release-note If you use one of the kube-dns replication controller manifest in `cluster/saltbase/salt/kube-dns`, i.e. `cluster/saltbase/salt/kube-dns/{skydns-rc.yaml.base,skydns-rc.yaml.in}`, either substitute one of `__PILLAR__FEDERATIONS__DOMAIN__MAP__` or `{{ pillar['federations_domain_map'] }}` with the corresponding federation name to domain name value or remove them if you do not support cluster federation at this time. If you plan to substitute the parameter with its value, here is an example for `{{ pillar['federations_domain_map'] }` pillar['federations_domain_map'] = "- --federations=myfederation=federation.test" where `myfederation` is the name of the federation and `federation.test` is the domain name registered for the federation. ``` cc @erictune @kubernetes/sig-cluster-federation @MikeSpreitzer @luxas [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()pull/6/head
commit
3a6494e9ae
|
@ -953,24 +953,6 @@ function kube::release::package_kube_manifests_tarball() {
|
|||
mkdir -p "${dst_dir}/dns"
|
||||
tar c -C "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns" ${objects} | tar x -C "${dst_dir}/dns"
|
||||
|
||||
# We leave the `{{ pillar['federations_domain_map'] }}` parameter as is, if
|
||||
# the right federation environment variables isn't set. This is to allow
|
||||
# users to provide these pillar values using the regular salt's mechanisms
|
||||
# during cluster bootstrap.
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
sed -i 's/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/- --federations='"${FEDERATIONS_DOMAIN_MAP}"'/g' "${dst_dir}/dns/skydns-rc.yaml.in"
|
||||
else
|
||||
sed -i '/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/d' "${dst_dir}/dns/skydns-rc.yaml.in"
|
||||
fi
|
||||
else
|
||||
sed -i '/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/d' "${dst_dir}/dns/skydns-rc.yaml.in"
|
||||
fi
|
||||
|
||||
# This is for coreos only. ContainerVM, GCI, or Trusty does not use it.
|
||||
cp -r "${KUBE_ROOT}/cluster/gce/coreos/kube-manifests"/* "${release_stage}/"
|
||||
|
||||
|
|
|
@ -710,6 +710,28 @@ EOF
|
|||
cat >>$file <<EOF
|
||||
ENABLE_CLUSTER_AUTOSCALER: $(yaml-quote ${ENABLE_CLUSTER_AUTOSCALER})
|
||||
AUTOSCALER_MIG_CONFIG: $(yaml-quote ${AUTOSCALER_MIG_CONFIG})
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Federation specific environment variables.
|
||||
if [[ -n "${FEDERATION:-}" ]]; then
|
||||
cat >>$file <<EOF
|
||||
FEDERATION: $(yaml-quote ${FEDERATION})
|
||||
EOF
|
||||
fi
|
||||
if [ -n "${FEDERATIONS_DOMAIN_MAP:-}" ]; then
|
||||
cat >>$file <<EOF
|
||||
FEDERATIONS_DOMAIN_MAP: $(yaml-quote ${FEDERATIONS_DOMAIN_MAP})
|
||||
EOF
|
||||
fi
|
||||
if [ -n "${FEDERATION_NAME:-}" ]; then
|
||||
cat >>$file <<EOF
|
||||
FEDERATION_NAME: $(yaml-quote ${FEDERATION_NAME})
|
||||
EOF
|
||||
fi
|
||||
if [ -n "${DNS_ZONE_NAME:-}" ]; then
|
||||
cat >>$file <<EOF
|
||||
DNS_ZONE_NAME: $(yaml-quote ${DNS_ZONE_NAME})
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -551,7 +551,25 @@ enable_cluster_autoscaler: '$(echo "${ENABLE_CLUSTER_AUTOSCALER}" | sed -e "s/'/
|
|||
autoscaler_mig_config: '$(echo "${AUTOSCALER_MIG_CONFIG}" | sed -e "s/'/''/g")'
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
federations_domain_map: '$(echo "- --federations=${FEDERATIONS_DOMAIN_MAP}" | sed -e "s/'/''/g")'
|
||||
EOF
|
||||
else
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
federations_domain_map: ''
|
||||
EOF
|
||||
fi
|
||||
else
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
federations_domain_map: ''
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
# The job of this function is simple, but the basic regular expression syntax makes
|
||||
|
|
|
@ -837,6 +837,20 @@ function start-kube-addons {
|
|||
sed -i -e "s@{{ *pillar\['dns_replicas'\] *}}@${DNS_REPLICAS}@g" "${dns_rc_file}"
|
||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${dns_rc_file}"
|
||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${dns_svc_file}"
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\['federations_domain_map'\] *}}@- --federations=${FEDERATIONS_DOMAIN_MAP}@g" "${dns_rc_file}"
|
||||
else
|
||||
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
|
||||
fi
|
||||
else
|
||||
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
|
||||
fi
|
||||
fi
|
||||
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
|
||||
setup-addon-manifests "addons" "registry"
|
||||
|
|
|
@ -767,6 +767,20 @@ start_kube_addons() {
|
|||
sed -i -e "s@{{ *pillar\['dns_replicas'\] *}}@${DNS_REPLICAS}@g" "${dns_rc_file}"
|
||||
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${dns_rc_file}"
|
||||
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${dns_svc_file}"
|
||||
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
sed -i -e "s@{{ *pillar\['federations_domain_map'\] *}}@- --federations=${FEDERATIONS_DOMAIN_MAP}@g" "${dns_rc_file}"
|
||||
else
|
||||
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
|
||||
fi
|
||||
else
|
||||
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
|
||||
fi
|
||||
fi
|
||||
if [ "${ENABLE_CLUSTER_REGISTRY:-}" = "true" ]; then
|
||||
setup_addon_manifests "addons" "registry"
|
||||
|
|
|
@ -31,6 +31,21 @@ workspace=$(pwd)
|
|||
sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g" "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns/skydns-rc.yaml.in" > "${workspace}/skydns-rc.yaml"
|
||||
sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns/skydns-svc.yaml.in" > "${workspace}/skydns-svc.yaml"
|
||||
|
||||
# Federation specific values.
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
sed -i -e "s/{{ pillar\['federations_domain_map'\] }}/- --federations=${FEDERATIONS_DOMAIN_MAP}/g" "${workspace}/skydns-rc.yaml"
|
||||
else
|
||||
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" "${workspace}/skydns-rc.yaml"
|
||||
fi
|
||||
else
|
||||
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" "${workspace}/skydns-rc.yaml"
|
||||
fi
|
||||
|
||||
# Use kubectl to create skydns rc and service
|
||||
"${kubectl}" create -f "${workspace}/skydns-rc.yaml"
|
||||
"${kubectl}" create -f "${workspace}/skydns-svc.yaml"
|
||||
|
|
|
@ -46,6 +46,7 @@ write_files:
|
|||
dns_replicas: "1"
|
||||
dns_server: 10.246.0.10
|
||||
dns_domain: cluster.local
|
||||
federations_domain_map: ''
|
||||
instance_prefix: kubernetes
|
||||
admission_control: NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
|
||||
enable_cpu_cfs_quota: "true"
|
||||
|
|
|
@ -120,6 +120,7 @@ enable_cluster_dns: "${ENABLE_CLUSTER_DNS:-false}"
|
|||
dns_replicas: ${DNS_REPLICAS:-1}
|
||||
dns_server: $DNS_SERVER_IP
|
||||
dns_domain: $DNS_DOMAIN
|
||||
federations_domain_map: ''
|
||||
e2e_storage_test_environment: "${E2E_STORAGE_TEST_ENVIRONMENT:-false}"
|
||||
cluster_cidr: "$NODE_IP_RANGES"
|
||||
allocate_node_cidrs: "${ALLOCATE_NODE_CIDRS:-true}"
|
||||
|
|
|
@ -59,6 +59,7 @@ enable_cluster_dns: '$(echo "$ENABLE_CLUSTER_DNS" | sed -e "s/'/''/g")'
|
|||
dns_replicas: '$(echo "$DNS_REPLICAS" | sed -e "s/'/''/g")'
|
||||
dns_server: '$(echo "$DNS_SERVER_IP" | sed -e "s/'/''/g")'
|
||||
dns_domain: '$(echo "$DNS_DOMAIN" | sed -e "s/'/''/g")'
|
||||
federations_domain_map: ''
|
||||
instance_prefix: '$(echo "$INSTANCE_PREFIX" | sed -e "s/'/''/g")'
|
||||
admission_control: '$(echo "$ADMISSION_CONTROL" | sed -e "s/'/''/g")'
|
||||
enable_cpu_cfs_quota: '$(echo "$ENABLE_CPU_CFS_QUOTA" | sed -e "s/'/''/g")'
|
||||
|
|
|
@ -120,6 +120,7 @@ enable_cluster_dns: "${ENABLE_CLUSTER_DNS:-false}"
|
|||
dns_replicas: ${DNS_REPLICAS:-1}
|
||||
dns_server: $DNS_SERVER_IP
|
||||
dns_domain: $DNS_DOMAIN
|
||||
federations_domain_map: ''
|
||||
e2e_storage_test_environment: "${E2E_STORAGE_TEST_ENVIRONMENT:-false}"
|
||||
cluster_cidr: "$NODE_IP_RANGES"
|
||||
allocate_node_cidrs: "${ALLOCATE_NODE_CIDRS:-true}"
|
||||
|
|
|
@ -412,6 +412,19 @@ function start_kubedns {
|
|||
if [[ "${ENABLE_CLUSTER_DNS}" = true ]]; then
|
||||
echo "Creating kube-system namespace"
|
||||
sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;" "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns/skydns-rc.yaml.in" >| skydns-rc.yaml
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
|
||||
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
|
||||
fi
|
||||
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
|
||||
sed -i -e "s/{{ pillar\['federations_domain_map'\] }}/- --federations=${FEDERATIONS_DOMAIN_MAP}/g" skydns-rc.yaml
|
||||
else
|
||||
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" skydns-rc.yaml
|
||||
fi
|
||||
else
|
||||
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" skydns-rc.yaml
|
||||
fi
|
||||
sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns/skydns-svc.yaml.in" >| skydns-svc.yaml
|
||||
cat <<EOF >namespace.yaml
|
||||
apiVersion: v1
|
||||
|
|
Loading…
Reference in New Issue