diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 95cc6a576cc..e6269e1a840 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -180,6 +180,16 @@ if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}projectcalico.org/ds-ready=true" fi +# Optional: Enable netd. +ENABLE_NETD="${KUBE_ENABLE_NETD:-false}" +CUSTOM_NETD_YAML="${KUBE_CUSTOM_NETD_YAML:-}" + +# To avoid running netd on a node that is not configured appropriately, +# label each Node so that the DaemonSet can run the Pods only on ready Nodes. +if [[ ${ENABLE_NETD:-} == "true" ]]; then + NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}beta.kubernetes.io/kube-netd-ready=true" +fi + # Enable metadata concealment by firewalling pod traffic to the metadata server # and run a proxy daemonset on nodes. # diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index bc4df7fe10b..d1fe69f7ecf 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -206,6 +206,16 @@ NODE_LABELS="${KUBE_NODE_LABELS:-beta.kubernetes.io/fluentd-ds-ready=true}" # NON_MASTER_NODE_LABELS are labels will only be applied on non-master nodes. NON_MASTER_NODE_LABELS="${KUBE_NON_MASTER_NODE_LABELS:-}" +# Optional: Enable netd. +ENABLE_NETD="${KUBE_ENABLE_NETD:-false}" +CUSTOM_NETD_YAML="${KUBE_CUSTOM_NETD_YAML:-}" + +# To avoid running netd on a node that is not configured appropriately, +# label each Node so that the DaemonSet can run the Pods only on ready Nodes. +if [[ ${ENABLE_NETD:-} == "true" ]]; then + NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}beta.kubernetes.io/kube-netd-ready=true" +fi + # To avoid running Calico on a node that is not configured appropriately, # label each Node so that the DaemonSet can run the Pods only on ready Nodes. if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index aa1449cc7f3..f02b8ed7b2b 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -2243,6 +2243,19 @@ EOF fi } +# Sets up the manifests of netd for k8s addons. +function setup-netd-manifest { + local -r netd_file="${dst_dir}/netd/netd.yaml" + mkdir -p "${dst_dir}/netd" + touch "${netd_file}" + if [ -n "${CUSTOM_NETD_YAML:-}" ]; then + # Replace with custom GCP netd deployment. + cat > "${netd_file}" <