mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 04:06:24 +00:00
Update Makefile and remove godep
This commit is contained in:
Generated
-1042
File diff suppressed because it is too large
Load Diff
Generated
-5
@@ -1,5 +0,0 @@
|
||||
This directory tree is generated automatically by godep.
|
||||
|
||||
Please do not edit.
|
||||
|
||||
See https://github.com/tools/godep for more information.
|
||||
@@ -14,7 +14,8 @@
|
||||
|
||||
# Build the node-problem-detector image.
|
||||
|
||||
.PHONY: all build-container build-tar build push-container push-tar push clean vet fmt version \
|
||||
.PHONY: all build-container build-tar build push-container push-tar push \
|
||||
clean vet fmt version \
|
||||
Dockerfile build-binaries docker-builder build-in-docker
|
||||
|
||||
all: build
|
||||
@@ -45,14 +46,14 @@ TARBALL:=node-problem-detector-$(VERSION).tar.gz
|
||||
# IMAGE is the image name of the node problem detector container image.
|
||||
IMAGE:=$(REGISTRY)/node-problem-detector:$(TAG)
|
||||
|
||||
# ENABLE_JOURNALD enables build journald support or not. Building journald support needs libsystemd-dev
|
||||
# or libsystemd-journal-dev.
|
||||
# ENABLE_JOURNALD enables build journald support or not. Building journald
|
||||
# support needs libsystemd-dev or libsystemd-journal-dev.
|
||||
ENABLE_JOURNALD?=1
|
||||
|
||||
# TODO(random-liu): Support different architectures.
|
||||
# The debian-base:0.4.0 image built from kubernetes repository is based on Debian Stretch.
|
||||
# It includes systemd 232 with support for both +XZ and +LZ4 compression.
|
||||
# +LZ4 is needed on some os distros such as COS.
|
||||
# The debian-base:0.4.0 image built from kubernetes repository is based on
|
||||
# Debian Stretch. It includes systemd 232 with support for both +XZ and +LZ4
|
||||
# compression. +LZ4 is needed on some os distros such as COS.
|
||||
BASEIMAGE:=k8s.gcr.io/debian-base-amd64:0.4.0
|
||||
|
||||
# Disable cgo by default to make the binary statically linked.
|
||||
@@ -61,15 +62,18 @@ CGO_ENABLED:=0
|
||||
ifeq ($(ENABLE_JOURNALD), 1)
|
||||
# Enable journald build tag.
|
||||
BUILD_TAGS:=-tags journald
|
||||
# Enable cgo because sdjournal needs cgo to compile. The binary will be dynamically
|
||||
# linked if CGO_ENABLED is enabled. This is fine because fedora already has necessary
|
||||
# dynamic library. We can not use `-extldflags "-static"` here, because go-systemd uses
|
||||
# dlopen, and dlopen will not work properly in a statically linked application.
|
||||
# Enable cgo because sdjournal needs cgo to compile. The binary will be
|
||||
# dynamically linked if CGO_ENABLED is enabled. This is fine because fedora
|
||||
# already has necessary dynamic library. We can not use `-extldflags "-static"`
|
||||
# here, because go-systemd uses dlopen, and dlopen will not work properly in a
|
||||
# statically linked application.
|
||||
CGO_ENABLED:=1
|
||||
endif
|
||||
|
||||
vet:
|
||||
go list ./... | grep -v "./vendor/*" | xargs go vet $(BUILD_TAGS)
|
||||
GO111MODULE=on go list -mod vendor $(BUILD_TAGS) ./... | \
|
||||
grep -v "./vendor/*" | \
|
||||
GO111MODULE=on xargs go vet -mod vendor $(BUILD_TAGS)
|
||||
|
||||
fmt:
|
||||
find . -type f -name "*.go" | grep -v "./vendor/*" | xargs gofmt -s -w -l
|
||||
@@ -78,20 +82,26 @@ version:
|
||||
@echo $(VERSION)
|
||||
|
||||
./bin/log-counter: $(PKG_SOURCES)
|
||||
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux go build -o bin/log-counter \
|
||||
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
|
||||
$(BUILD_TAGS) cmd/logcounter/log_counter.go
|
||||
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GO111MODULE=on go build \
|
||||
-mod vendor \
|
||||
-o bin/log-counter \
|
||||
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
|
||||
$(BUILD_TAGS) \
|
||||
cmd/logcounter/log_counter.go
|
||||
|
||||
./bin/node-problem-detector: $(PKG_SOURCES)
|
||||
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux go build -o bin/node-problem-detector \
|
||||
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
|
||||
$(BUILD_TAGS) cmd/node_problem_detector.go
|
||||
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GO111MODULE=on go build \
|
||||
-mod vendor \
|
||||
-o bin/node-problem-detector \
|
||||
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
|
||||
$(BUILD_TAGS) \
|
||||
cmd/node_problem_detector.go
|
||||
|
||||
Dockerfile: Dockerfile.in
|
||||
sed -e 's|@BASEIMAGE@|$(BASEIMAGE)|g' $< >$@
|
||||
|
||||
test: vet fmt
|
||||
go test -timeout=1m -v -race ./cmd/options ./pkg/... $(BUILD_TAGS)
|
||||
GO111MODULE=on go test -mod vendor -timeout=1m -v -race $(BUILD_TAGS) ./...
|
||||
|
||||
build-binaries: ./bin/node-problem-detector ./bin/log-counter
|
||||
|
||||
@@ -109,7 +119,9 @@ docker-builder:
|
||||
docker build -t npd-builder ./builder
|
||||
|
||||
build-in-docker: clean docker-builder
|
||||
docker run -v `pwd`:/gopath/src/k8s.io/node-problem-detector/ npd-builder:latest bash -c 'cd /gopath/src/k8s.io/node-problem-detector/ && make build-binaries'
|
||||
docker run \
|
||||
-v `pwd`:/gopath/src/k8s.io/node-problem-detector/ npd-builder:latest bash \
|
||||
-c 'cd /gopath/src/k8s.io/node-problem-detector/ && make build-binaries'
|
||||
|
||||
push-container: build-container
|
||||
gcloud auth configure-docker
|
||||
|
||||
Reference in New Issue
Block a user