From 9c7baf94dd72c4b84f423625a0ae138df9d37317 Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Mon, 30 Oct 2017 15:48:39 -0700 Subject: [PATCH] Add node label to GCE nodes with accelerators attached. This node label is the same as what GKE attaches to node pools with accelerators attached. This will help us target accelerator specific daemonsets etc. to these nodes. --- cluster/gce/config-default.sh | 3 +++ cluster/gce/config-test.sh | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 460b09c006..90433158b1 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -183,6 +183,9 @@ FEATURE_GATES="${KUBE_FEATURE_GATES:-ExperimentalCriticalPodAnnotation=true}" if [[ ! -z "${NODE_ACCELERATORS}" ]]; then FEATURE_GATES="${FEATURE_GATES},DevicePlugins=true" + if [[ "${NODE_ACCELERATORS}" =~ .*type=([a-zA-Z0-9-]+).* ]]; then + NODE_LABELS="${NODE_LABELS},cloud.google.com/gke-accelerator=${BASH_REMATCH[1]}" + fi fi # Optional: Install cluster DNS. diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 94b36e6992..7c6c230537 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -108,10 +108,6 @@ RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}" # Optional: set feature gates FEATURE_GATES="${KUBE_FEATURE_GATES:-ExperimentalCriticalPodAnnotation=true}" -if [[ ! -z "${NODE_ACCELERATORS}" ]]; then - FEATURE_GATES="${FEATURE_GATES},DevicePlugins=true" -fi - TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100} # Extra docker options for nodes. @@ -228,6 +224,13 @@ if [[ ${KUBE_ENABLE_INSECURE_REGISTRY:-false} == "true" ]]; then EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS} --insecure-registry 10.0.0.0/8" fi +if [[ ! -z "${NODE_ACCELERATORS}" ]]; then + FEATURE_GATES="${FEATURE_GATES},DevicePlugins=true" + if [[ "${NODE_ACCELERATORS}" =~ .*type=([a-zA-Z0-9-]+).* ]]; then + NODE_LABELS="${NODE_LABELS},cloud.google.com/gke-accelerator=${BASH_REMATCH[1]}" + fi +fi + # Optional: Install cluster DNS. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}" DNS_SERVER_IP="10.0.0.10"