2019-05-28 14:13:52 +00:00
|
|
|
.PHONY: all test yamls
|
|
|
|
.FORCE:
|
2016-07-19 22:35:42 +00:00
|
|
|
|
2018-09-12 13:40:56 +00:00
|
|
|
IMAGE_BUILD_CMD := docker build
|
2018-11-16 13:32:48 +00:00
|
|
|
IMAGE_BUILD_EXTRA_OPTS :=
|
2018-11-16 13:03:46 +00:00
|
|
|
IMAGE_PUSH_CMD := docker push
|
2018-09-12 13:40:56 +00:00
|
|
|
|
2016-07-19 22:35:42 +00:00
|
|
|
VERSION := $(shell git describe --tags --dirty --always)
|
|
|
|
|
2018-11-16 12:26:33 +00:00
|
|
|
IMAGE_REGISTRY := quay.io/kubernetes_incubator
|
|
|
|
IMAGE_NAME := node-feature-discovery
|
|
|
|
IMAGE_TAG_NAME := $(VERSION)
|
|
|
|
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
|
|
|
|
IMAGE_TAG := $(IMAGE_REPO):$(IMAGE_TAG_NAME)
|
2019-05-28 14:13:52 +00:00
|
|
|
K8S_NAMESPACE := kube-system
|
2018-11-16 15:08:51 +00:00
|
|
|
KUBECONFIG :=
|
2018-11-16 12:26:33 +00:00
|
|
|
|
2019-05-28 14:13:52 +00:00
|
|
|
yaml_templates := $(wildcard *.yaml.template)
|
|
|
|
yaml_instances := $(patsubst %.yaml.template,%.yaml,$(yaml_templates))
|
2018-11-16 12:26:33 +00:00
|
|
|
|
2018-09-12 13:40:56 +00:00
|
|
|
all: image
|
2016-07-19 22:35:42 +00:00
|
|
|
|
2019-05-28 14:13:52 +00:00
|
|
|
image: yamls
|
2018-09-12 13:40:56 +00:00
|
|
|
$(IMAGE_BUILD_CMD) --build-arg NFD_VERSION=$(VERSION) \
|
2018-11-16 13:32:48 +00:00
|
|
|
-t $(IMAGE_TAG) \
|
|
|
|
$(IMAGE_BUILD_EXTRA_OPTS) ./
|
2018-07-09 10:12:11 +00:00
|
|
|
|
2019-05-28 14:13:52 +00:00
|
|
|
yamls: $(yaml_instances)
|
|
|
|
|
|
|
|
%.yaml: %.yaml.template .FORCE
|
|
|
|
@echo "$@: namespace: ${K8S_NAMESPACE}"
|
|
|
|
@echo "$@: image: ${IMAGE_TAG}"
|
|
|
|
@sed -E \
|
|
|
|
-e s',^(\s*)name: node-feature-discovery # NFD namespace,\1name: ${K8S_NAMESPACE},' \
|
|
|
|
-e s',^(\s*)image:.+$$,\1image: ${IMAGE_TAG},' \
|
|
|
|
-e s',^(\s*)namespace:.+$$,\1namespace: ${K8S_NAMESPACE},' \
|
|
|
|
$< > $@
|
|
|
|
|
2018-07-09 10:12:11 +00:00
|
|
|
mock:
|
|
|
|
mockery --name=FeatureSource --dir=source --inpkg --note="Re-generate by running 'make mock'"
|
2019-01-23 08:15:47 +00:00
|
|
|
mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'"
|
|
|
|
mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'"
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test ./cmd/... ./pkg/...
|
2018-11-16 13:03:46 +00:00
|
|
|
|
2018-11-16 15:08:51 +00:00
|
|
|
e2e-test:
|
|
|
|
go test -v ./test/e2e/ -args -nfd.repo=$(IMAGE_REPO) -nfd.tag=$(IMAGE_TAG_NAME) -kubeconfig=$(KUBECONFIG)
|
|
|
|
|
2018-11-16 13:03:46 +00:00
|
|
|
push:
|
|
|
|
$(IMAGE_PUSH_CMD) $(IMAGE_TAG)
|