Skip to content

Commit

Permalink
Fix k8s master (1.14)
Browse files Browse the repository at this point in the history
Always use CoreDNS and remove the feature gate from config.
Add workaround for `unifiedControlPlaneImage` removal kubernetes/kubernetes#70793
Fixes kubernetes-retired#250
  • Loading branch information
Ivan Shvedunov committed Nov 14, 2018
1 parent 45a496e commit ccf5259
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 97 deletions.
38 changes: 22 additions & 16 deletions dind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
38 changes: 22 additions & 16 deletions fixed/dind-cluster-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
38 changes: 22 additions & 16 deletions fixed/dind-cluster-v1.10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
38 changes: 22 additions & 16 deletions fixed/dind-cluster-v1.11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
38 changes: 22 additions & 16 deletions fixed/dind-cluster-v1.12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
38 changes: 22 additions & 16 deletions fixed/dind-cluster-v1.9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,28 @@ function dind::init {
feature_gates="{CoreDNS: true}"
fi

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
# CoreDNS can no longer be switched off
feature_gates="{}"
if [[ ${DNS_SERVICE} = "kube-dns" ]]; then
echo >&2 "WARNING: for 1.13+, only coredns can be used as the DNS service"
DNS_SERVICE="coredns"
fi
;;
esac

component_feature_gates=""
if [ "${FEATURE_GATES}" != "none" ]; then
component_feature_gates="feature-gates: \\\"${FEATURE_GATES}\\\""
Expand All @@ -1249,22 +1271,6 @@ function dind::init {
scheduler_extra_args+=" ${opt_name}: \\\"$(eval echo \$$e)\\\"\\n"
done

kubeadm_version="$(dind::kubeadm-version)"
case $kubeadm_version in
1\.9\.* | 1\.10\.*)
template="1.10"
;;
1\.11\.*)
template="1.11"
;;
1\.12\.*)
template="1.12"
;;
*) # Includes master branch
template="1.13"
;;
esac

local mgmt_cidr=${mgmt_net_cidrs[0]}
if [[ ${IP_MODE} = "dual-stack" && ${SERVICE_NET_MODE} = "ipv6" ]]; then
mgmt_cidr=${mgmt_net_cidrs[1]}
Expand Down
2 changes: 1 addition & 1 deletion image/kubeadm.conf.1.13.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ etcd:
dataDir: /var/lib/etcd
image: ""
featureGates: {{FEATURE_GATES}}
imageRepository: k8s.gcr.io
useHyperKubeImage: true
kind: ClusterConfiguration
kubernetesVersion: "{{KUBEADM_VERSION}}"
networking:
Expand Down
13 changes: 13 additions & 0 deletions image/wrapkubeadm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ KUBEADM_SOURCE="${KUBEADM_SOURCE:-keep://}"

hypokube_base_image="mirantis/hypokube:base"
hypokube_final_image="mirantis/hypokube:final"
hypokube_extra_tags=()
# In k8s 1.14+, we can't use unifiedControlPlaneImage anymore,
# so we have to resort to a hack by pretending we have already
# pulled the hyperkube image
# https://github.com/kubernetes/kubernetes/pull/70793
if kubeadm version -o short >&/dev/null; then
image_version="$(kubeadm version -o short|sed 's/-.*//')"
hypokube_extra_tags=("k8s.gcr.io/hyperkube:${image_version}")
fi
build_src_dir="/go/src/k8s.io/kubernetes"
binary_dir="/k8s"
# FIXME: don't hardcode
Expand Down Expand Up @@ -164,6 +173,10 @@ function dind::ensure-binaries-and-hypokube {
# After we "frob" the cluster, the hyperkube image is taken from /k8s directory.
cp "${hyperkube_bin}" /hypokube/
docker build -t "${hypokube_final_image}" -f /hypokube/hypokube.dkr /hypokube
# in k8s 1.12+
for tag in "${hypokube_extra_tags[@]}"; do
docker tag "${hypokube_final_image}" "${tag}"
done
fi
}

Expand Down

0 comments on commit ccf5259

Please sign in to comment.