Skip to content

Commit

Permalink
Enhance nfd-worker placement
Browse files Browse the repository at this point in the history
* Enhance nfd-worker placement

Enable NFD operator to deploy nfd-worker pods on nodes labeled other
than "node-role.kubernetes.io/worker"

Also: Fix clean-labels make target

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>

* Add tolerations

Co-authored-by: Markus Lehtonen <markus.lehtonen@intel.com>

* rm extra white line after tolerations

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>

Co-authored-by: Markus Lehtonen <markus.lehtonen@intel.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
  • Loading branch information
ArangoGutierrez and marquiz committed Sep 29, 2020
1 parent 0f254cd commit 5b142e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ BINDATA=pkg/manifests/bindata.go

GOFMT_CHECK=$(shell find . -not \( \( -wholename './.*' -o -wholename '*/vendor/*' \) -prune \) -name '*.go' | sort -u | xargs gofmt -s -l)

# Container image-related variables
IMAGE_BUILD_CMD ?= podman build
IMAGE_PUSH_CMD ?= podman push
DOCKERFILE=Dockerfile
IMAGE_TAG=openshift-psap/origin-cluster-nfd-operator
IMAGE_REGISTRY=quay.io

vpath bin/go-bindata $(GOPATH)
GOBINDATA_BIN=bin/go-bindata
Expand Down Expand Up @@ -85,13 +86,16 @@ clean:
go clean
rm -f $(BIN)

clean-labels:
kubectl get no -o yaml | sed -e '/^\s*nfd.node.kubernetes.io/d' -e '/^\s*feature.node.kubernetes.io/d' | kubectl replace -f -

local-image:
podman build --no-cache -t $(IMAGE) -f $(DOCKERFILE) .
$(IMAGE_BUILD_CMD) $(IMAGE_BUILD_EXTRA_OPTS) -t $(IMAGE) -f $(DOCKERFILE) .

local-image-push:
$(IMAGE_PUSH_CMD) $(IMAGE_PUSH_EXTRA_OPTS) $(IMAGE)

test:
go test ./cmd/... ./pkg/... -coverprofile cover.out

local-image-push:
podman push $(IMAGE)

.PHONY: all build generate verify verify-gofmt clean local-image local-image-push $(DEPLOY_OBJECTS) $(DEPLOY_OPERATOR) $(DEPLOY_CRDS) $(DEPLOY_CRS)
17 changes: 9 additions & 8 deletions assets/worker/0700_worker_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ spec:
labels:
app: nfd-worker
spec:
nodeSelector:
node-role.kubernetes.io/worker: ""
tolerations:
- operator: Exists
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
- operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: DoesNotExist
hostNetwork: true
serviceAccount: nfd-worker
readOnlyRootFilesystem: true
Expand Down Expand Up @@ -78,5 +81,3 @@ spec:
items:
- key: nfd-worker-conf
path: nfd-worker.conf


0 comments on commit 5b142e2

Please sign in to comment.