Skip to content

Commit 3a6494e

Browse files
author
k8s-merge-robot
authored
Merge pull request kubernetes#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)]()
2 parents 594e4d8 + 816c4d9 commit 3a6494e

File tree

11 files changed

+101
-19
lines changed

11 files changed

+101
-19
lines changed

build/common.sh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -953,24 +953,6 @@ function kube::release::package_kube_manifests_tarball() {
953953
mkdir -p "${dst_dir}/dns"
954954
tar c -C "${KUBE_ROOT}/cluster/saltbase/salt/kube-dns" ${objects} | tar x -C "${dst_dir}/dns"
955955

956-
# We leave the `{{ pillar['federations_domain_map'] }}` parameter as is, if
957-
# the right federation environment variables isn't set. This is to allow
958-
# users to provide these pillar values using the regular salt's mechanisms
959-
# during cluster bootstrap.
960-
if [[ "${FEDERATION:-}" == "true" ]]; then
961-
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
962-
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
963-
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
964-
fi
965-
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
966-
sed -i 's/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/- --federations='"${FEDERATIONS_DOMAIN_MAP}"'/g' "${dst_dir}/dns/skydns-rc.yaml.in"
967-
else
968-
sed -i '/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/d' "${dst_dir}/dns/skydns-rc.yaml.in"
969-
fi
970-
else
971-
sed -i '/{{ pillar\['"'"'federations_domain_map'"'"'\] }}/d' "${dst_dir}/dns/skydns-rc.yaml.in"
972-
fi
973-
974956
# This is for coreos only. ContainerVM, GCI, or Trusty does not use it.
975957
cp -r "${KUBE_ROOT}/cluster/gce/coreos/kube-manifests"/* "${release_stage}/"
976958

cluster/common.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,28 @@ EOF
710710
cat >>$file <<EOF
711711
ENABLE_CLUSTER_AUTOSCALER: $(yaml-quote ${ENABLE_CLUSTER_AUTOSCALER})
712712
AUTOSCALER_MIG_CONFIG: $(yaml-quote ${AUTOSCALER_MIG_CONFIG})
713+
EOF
714+
fi
715+
716+
# Federation specific environment variables.
717+
if [[ -n "${FEDERATION:-}" ]]; then
718+
cat >>$file <<EOF
719+
FEDERATION: $(yaml-quote ${FEDERATION})
720+
EOF
721+
fi
722+
if [ -n "${FEDERATIONS_DOMAIN_MAP:-}" ]; then
723+
cat >>$file <<EOF
724+
FEDERATIONS_DOMAIN_MAP: $(yaml-quote ${FEDERATIONS_DOMAIN_MAP})
725+
EOF
726+
fi
727+
if [ -n "${FEDERATION_NAME:-}" ]; then
728+
cat >>$file <<EOF
729+
FEDERATION_NAME: $(yaml-quote ${FEDERATION_NAME})
730+
EOF
731+
fi
732+
if [ -n "${DNS_ZONE_NAME:-}" ]; then
733+
cat >>$file <<EOF
734+
DNS_ZONE_NAME: $(yaml-quote ${DNS_ZONE_NAME})
713735
EOF
714736
fi
715737
}

cluster/gce/configure-vm.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,25 @@ enable_cluster_autoscaler: '$(echo "${ENABLE_CLUSTER_AUTOSCALER}" | sed -e "s/'/
551551
autoscaler_mig_config: '$(echo "${AUTOSCALER_MIG_CONFIG}" | sed -e "s/'/''/g")'
552552
EOF
553553
fi
554-
554+
if [[ "${FEDERATION:-}" == "true" ]]; then
555+
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
556+
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
557+
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
558+
fi
559+
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
560+
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
561+
federations_domain_map: '$(echo "- --federations=${FEDERATIONS_DOMAIN_MAP}" | sed -e "s/'/''/g")'
562+
EOF
563+
else
564+
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
565+
federations_domain_map: ''
566+
EOF
567+
fi
568+
else
569+
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
570+
federations_domain_map: ''
571+
EOF
572+
fi
555573
}
556574

557575
# The job of this function is simple, but the basic regular expression syntax makes

cluster/gce/gci/configure-helper.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,20 @@ function start-kube-addons {
837837
sed -i -e "s@{{ *pillar\['dns_replicas'\] *}}@${DNS_REPLICAS}@g" "${dns_rc_file}"
838838
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${dns_rc_file}"
839839
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${dns_svc_file}"
840+
841+
if [[ "${FEDERATION:-}" == "true" ]]; then
842+
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
843+
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
844+
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
845+
fi
846+
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
847+
sed -i -e "s@{{ *pillar\['federations_domain_map'\] *}}@- --federations=${FEDERATIONS_DOMAIN_MAP}@g" "${dns_rc_file}"
848+
else
849+
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
850+
fi
851+
else
852+
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
853+
fi
840854
fi
841855
if [[ "${ENABLE_CLUSTER_REGISTRY:-}" == "true" ]]; then
842856
setup-addon-manifests "addons" "registry"

cluster/gce/trusty/configure-helper.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,20 @@ start_kube_addons() {
767767
sed -i -e "s@{{ *pillar\['dns_replicas'\] *}}@${DNS_REPLICAS}@g" "${dns_rc_file}"
768768
sed -i -e "s@{{ *pillar\['dns_domain'\] *}}@${DNS_DOMAIN}@g" "${dns_rc_file}"
769769
sed -i -e "s@{{ *pillar\['dns_server'\] *}}@${DNS_SERVER_IP}@g" "${dns_svc_file}"
770+
771+
if [[ "${FEDERATION:-}" == "true" ]]; then
772+
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
773+
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
774+
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
775+
fi
776+
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
777+
sed -i -e "s@{{ *pillar\['federations_domain_map'\] *}}@- --federations=${FEDERATIONS_DOMAIN_MAP}@g" "${dns_rc_file}"
778+
else
779+
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
780+
fi
781+
else
782+
sed -i -e "/{{ *pillar\['federations_domain_map'\] *}}/d" "${dns_rc_file}"
783+
fi
770784
fi
771785
if [ "${ENABLE_CLUSTER_REGISTRY:-}" = "true" ]; then
772786
setup_addon_manifests "addons" "registry"

cluster/mesos/docker/deploy-dns.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ workspace=$(pwd)
3131
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"
3232
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"
3333

34+
# Federation specific values.
35+
if [[ "${FEDERATION:-}" == "true" ]]; then
36+
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
37+
if [[ -z "${FEDERATIONS_DOMAIN_MAP}" && -n "${FEDERATION_NAME:-}" && -n "${DNS_ZONE_NAME:-}" ]]; then
38+
FEDERATIONS_DOMAIN_MAP="${FEDERATION_NAME}=${DNS_ZONE_NAME}"
39+
fi
40+
if [[ -n "${FEDERATIONS_DOMAIN_MAP}" ]]; then
41+
sed -i -e "s/{{ pillar\['federations_domain_map'\] }}/- --federations=${FEDERATIONS_DOMAIN_MAP}/g" "${workspace}/skydns-rc.yaml"
42+
else
43+
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" "${workspace}/skydns-rc.yaml"
44+
fi
45+
else
46+
sed -i -e "/{{ pillar\['federations_domain_map'\] }}/d" "${workspace}/skydns-rc.yaml"
47+
fi
48+
3449
# Use kubectl to create skydns rc and service
3550
"${kubectl}" create -f "${workspace}/skydns-rc.yaml"
3651
"${kubectl}" create -f "${workspace}/skydns-svc.yaml"

cluster/openstack-heat/kubernetes-heat/fragments/configure-salt.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ write_files:
4646
dns_replicas: "1"
4747
dns_server: 10.246.0.10
4848
dns_domain: cluster.local
49+
federations_domain_map: ''
4950
instance_prefix: kubernetes
5051
admission_control: NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
5152
enable_cpu_cfs_quota: "true"

cluster/photon-controller/templates/create-dynamic-salt-files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ enable_cluster_dns: "${ENABLE_CLUSTER_DNS:-false}"
120120
dns_replicas: ${DNS_REPLICAS:-1}
121121
dns_server: $DNS_SERVER_IP
122122
dns_domain: $DNS_DOMAIN
123+
federations_domain_map: ''
123124
e2e_storage_test_environment: "${E2E_STORAGE_TEST_ENVIRONMENT:-false}"
124125
cluster_cidr: "$NODE_IP_RANGES"
125126
allocate_node_cidrs: "${ALLOCATE_NODE_CIDRS:-true}"

cluster/vagrant/provision-utils.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ enable_cluster_dns: '$(echo "$ENABLE_CLUSTER_DNS" | sed -e "s/'/''/g")'
5959
dns_replicas: '$(echo "$DNS_REPLICAS" | sed -e "s/'/''/g")'
6060
dns_server: '$(echo "$DNS_SERVER_IP" | sed -e "s/'/''/g")'
6161
dns_domain: '$(echo "$DNS_DOMAIN" | sed -e "s/'/''/g")'
62+
federations_domain_map: ''
6263
instance_prefix: '$(echo "$INSTANCE_PREFIX" | sed -e "s/'/''/g")'
6364
admission_control: '$(echo "$ADMISSION_CONTROL" | sed -e "s/'/''/g")'
6465
enable_cpu_cfs_quota: '$(echo "$ENABLE_CPU_CFS_QUOTA" | sed -e "s/'/''/g")'

cluster/vsphere/templates/create-dynamic-salt-files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ enable_cluster_dns: "${ENABLE_CLUSTER_DNS:-false}"
120120
dns_replicas: ${DNS_REPLICAS:-1}
121121
dns_server: $DNS_SERVER_IP
122122
dns_domain: $DNS_DOMAIN
123+
federations_domain_map: ''
123124
e2e_storage_test_environment: "${E2E_STORAGE_TEST_ENVIRONMENT:-false}"
124125
cluster_cidr: "$NODE_IP_RANGES"
125126
allocate_node_cidrs: "${ALLOCATE_NODE_CIDRS:-true}"

0 commit comments

Comments
 (0)