Make log-counter respect ENABLE_JOURNALD

This commit is contained in:
Xuewei Zhang
2019-11-26 13:58:10 -08:00
parent 3c80676e94
commit 5e55ef89f1
5 changed files with 18 additions and 0 deletions
+3
View File
@@ -21,6 +21,9 @@ RUN clean-install libsystemd0 bash
RUN test -h /etc/localtime && rm -f /etc/localtime && cp /usr/share/zoneinfo/UTC /etc/localtime || true
ADD ./bin/node-problem-detector /node-problem-detector
# Below command depends on ENABLE_JOURNAL=1.
ADD ./bin/log-counter /home/kubernetes/bin/log-counter
ADD config /config
ENTRYPOINT ["/node-problem-detector", "--system-log-monitors=/config/kernel-monitor.json"]
+9
View File
@@ -84,12 +84,16 @@ version:
@echo $(VERSION)
./bin/log-counter: $(PKG_SOURCES)
ifeq ($(ENABLE_JOURNALD), 1)
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GO111MODULE=on go build \
-mod vendor \
-o bin/log-counter \
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
-tags "$(BUILD_TAGS)" \
cmd/logcounter/log_counter.go
else
echo "Warning: log-counter requires journald, skipping."
endif
./bin/node-problem-detector: $(PKG_SOURCES)
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GO111MODULE=on go build \
@@ -101,6 +105,11 @@ version:
Dockerfile: Dockerfile.in
sed -e 's|@BASEIMAGE@|$(BASEIMAGE)|g' $< >$@
ifneq ($(ENABLE_JOURNALD), 1)
sed -i '/Below command depends on ENABLE_JOURNAL=1/,+2d' $@
echo "Warning: log-counter requires journald, skipping."
endif
test: vet fmt
GO111MODULE=on go test -mod vendor -timeout=1m -v -race -short -tags "$(BUILD_TAGS)" ./...
+2
View File
@@ -1,3 +1,5 @@
// +build journald
/*
Copyright 2018 The Kubernetes Authors All rights reserved.
+2
View File
@@ -1,3 +1,5 @@
// +build journald
/*
Copyright 2018 The Kubernetes Authors All rights reserved.
+2
View File
@@ -1,3 +1,5 @@
// +build journald
/*
Copyright 2018 The Kubernetes Authors All rights reserved.