forked from kubernetes-retired/heapster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Built heapster for multiple architectures and distributes them as a m…
…anifest list. Cleaned up the Dockerfile to be based on busybox => much smaller. Improved the Makefile. Removed an old Dockerfile and a script that's unnecessary with this Makefile
- Loading branch information
Showing
5 changed files
with
94 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ eventer | |
*.un~ | ||
Session.vim | ||
.netrwhist | ||
.idea | ||
.idea | ||
*manifest-tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,116 @@ | ||
all: build | ||
|
||
PREFIX = gcr.io/google_containers | ||
FLAGS = | ||
PREFIX?=gcr.io/google_containers | ||
FLAGS= | ||
ARCH?=amd64 | ||
ALL_ARCHITECTURES=amd64 arm arm64 ppc64le s390x | ||
ML_PLATFORMS=linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x | ||
GOLANG_VERSION?=1.7 | ||
TEMP_DIR:=$(shell mktemp -d) | ||
|
||
VERSION = v1.3.0-beta.0 | ||
GIT_COMMIT := `git rev-parse --short HEAD` | ||
VERSION?=v1.3.0-alpha.0 | ||
GIT_COMMIT:=$(shell git rev-parse --short HEAD) | ||
|
||
SUPPORTED_KUBE_VERSIONS = "1.4.6" | ||
TEST_NAMESPACE = heapster-e2e-tests | ||
# You can set this variable for testing and the built image will also be tagged with this name | ||
OVERRIDE_IMAGE_NAME?= | ||
|
||
deps: | ||
which godep || go get github.com/tools/godep | ||
# If this session isn't interactive, then we don't want to allocate a | ||
# TTY, which would fail, but if it is interactive, we do want to attach | ||
# so that the user can send e.g. ^C through. | ||
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0) | ||
TTY= | ||
ifeq ($(INTERACTIVE), 1) | ||
TTY=-t | ||
endif | ||
|
||
SUPPORTED_KUBE_VERSIONS=1.4.6 | ||
TEST_NAMESPACE=heapster-e2e-tests | ||
|
||
HEAPSTER_LDFLAGS=-w -X k8s.io/heapster/version.HeapsterVersion=$(VERSION) -X k8s.io/heapster/version.GitCommit=$(GIT_COMMIT) | ||
|
||
ifeq ($(ARCH),amd64) | ||
BASEIMAGE?=busybox | ||
endif | ||
ifeq ($(ARCH),arm) | ||
BASEIMAGE?=armhf/busybox | ||
endif | ||
ifeq ($(ARCH),arm64) | ||
BASEIMAGE?=aarch64/busybox | ||
endif | ||
ifeq ($(ARCH),ppc64le) | ||
BASEIMAGE?=ppc64le/busybox | ||
endif | ||
ifeq ($(ARCH),s390x) | ||
BASEIMAGE?=s390x/busybox | ||
endif | ||
|
||
fmt: | ||
find . -type f -name "*.go" | grep -v "./vendor*" | xargs gofmt -s -w | ||
|
||
build: clean deps fmt | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags "-w -X k8s.io/heapster/version.HeapsterVersion=$(VERSION) -X k8s.io/heapster/version.GitCommit=$(GIT_COMMIT)" -o heapster k8s.io/heapster/metrics | ||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags "-w -X k8s.io/heapster/version.HeapsterVersion=$(VERSION) -X k8s.io/heapster/version.GitCommit=$(GIT_COMMIT)" -o eventer k8s.io/heapster/events | ||
build: clean fmt | ||
GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags "$(HEAPSTER_LDFLAGS)" -o heapster k8s.io/heapster/metrics | ||
GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags "$(HEAPSTER_LDFLAGS)" -o eventer k8s.io/heapster/events | ||
|
||
sanitize: | ||
hooks/check_boilerplate.sh | ||
hooks/check_gofmt.sh | ||
hooks/run_vet.sh | ||
|
||
test-unit: clean deps sanitize build | ||
GOOS=linux GOARCH=amd64 godep go test --test.short -race ./... $(FLAGS) | ||
test-unit: clean sanitize build | ||
GOARCH=$(ARCH) go test --test.short -race ./... $(FLAGS) | ||
|
||
test-unit-cov: clean deps sanitize build | ||
test-unit-cov: clean sanitize build | ||
hooks/coverage.sh | ||
|
||
test-integration: clean deps build | ||
godep go test -v --timeout=60m ./integration/... --vmodule=*=2 $(FLAGS) --namespace=$(TEST_NAMESPACE) --kube_versions=$(SUPPORTED_KUBE_VERSIONS) | ||
test-integration: clean build | ||
go test -v --timeout=60m ./integration/... --vmodule=*=2 $(FLAGS) --namespace=$(TEST_NAMESPACE) --kube_versions=$(SUPPORTED_KUBE_VERSIONS) | ||
|
||
container: build | ||
cp heapster deploy/docker/heapster | ||
cp eventer deploy/docker/eventer | ||
docker build -t $(PREFIX)/heapster:$(VERSION) deploy/docker/ | ||
container: | ||
# Run the build in a container in order to have reproducible builds | ||
# Also, fetch the latest ca certificates | ||
docker run --rm -i $(TTY) -v $(TEMP_DIR):/build -v $(shell pwd):/go/src/k8s.io/heapster -w /go/src/k8s.io/heapster golang:$(GOLANG_VERSION) /bin/bash -c "\ | ||
cp /etc/ssl/certs/ca-certificates.crt /build \ | ||
&& GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags \"$(HEAPSTER_LDFLAGS)\" -o /build/heapster k8s.io/heapster/metrics \ | ||
&& GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags \"$(HEAPSTER_LDFLAGS)\" -o /build/eventer k8s.io/heapster/events" | ||
|
||
grafana: | ||
docker build -t $(PREFIX)/heapster_grafana:$(VERSION) grafana/ | ||
cp deploy/docker/Dockerfile $(TEMP_DIR) | ||
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile | ||
|
||
docker build -t $(PREFIX)/heapster-$(ARCH):$(VERSION) $(TEMP_DIR) | ||
ifneq ($(OVERRIDE_IMAGE_NAME),) | ||
docker tag $(PREFIX)/heapster-$(ARCH):$(VERSION) $(OVERRIDE_IMAGE_NAME) | ||
endif | ||
rm -rf $(TEMP_DIR) | ||
|
||
push: ./manifest-tool $(addprefix sub-push-,$(ALL_ARCHITECTURES)) | ||
./manifest-tool push from-args --platforms $(ML_PLATFORMS) --template $(PREFIX)/heapster-ARCH:$(VERSION) --target $(PREFIX)/heapster:$(VERSION) | ||
|
||
sub-push-%: | ||
$(MAKE) ARCH=$* PREFIX=$(PREFIX) VERSION=$(VERSION) container | ||
ifeq ($(findstring gcr.io,$(PREFIX)),gcr.io) | ||
gcloud docker push $(PREFIX)/heapster-$*:$(VERSION) | ||
else | ||
docker push $(PREFIX)/heapster-$*:$(VERSION) | ||
endif | ||
|
||
influxdb: | ||
docker build -t $(PREFIX)/heapster_influxdb:$(VERSION) influxdb/ | ||
ARCH=$(ARCH) PREFIX=$(PREFIX) make -C influxdb build | ||
|
||
grafana: | ||
ARCH=$(ARCH) PREFIX=$(PREFIX) make -C grafana build | ||
|
||
push-influxdb: | ||
PREFIX=$(PREFIX) make -C influxdb push | ||
|
||
push-grafana: | ||
PREFIX=$(PREFIX) make -C grafana push | ||
|
||
./manifest-tool: | ||
curl -sSL https://github.com/luxas/manifest-tool/releases/download/v0.3.0/manifest-tool > manifest-tool | ||
chmod +x manifest-tool | ||
|
||
clean: | ||
rm -f heapster | ||
rm -f eventer | ||
rm -f deploy/docker/heapster | ||
rm -f deploy/docker/eventer | ||
|
||
.PHONY: all deps build sanitize test-unit test-unit-cov test-integration container grafana influxdb clean | ||
.PHONY: all build sanitize test-unit test-unit-cov test-integration container grafana influxdb clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
FROM alpine:3.2 | ||
MAINTAINER [email protected] | ||
FROM BASEIMAGE | ||
|
||
ENV GLIBC_VERSION "2.23-r1" | ||
|
||
RUN apk add --update ca-certificates curl && \ | ||
curl -Ls https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk -o glibc-${GLIBC_VERSION}.apk && \ | ||
curl -Ls https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk -o glibc-bin-${GLIBC_VERSION}.apk && \ | ||
apk add --allow-untrusted glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk | ||
|
||
RUN for cert in `ls -1 /etc/ssl/certs/*.crt | grep -v /etc/ssl/certs/ca-certificates.crt`; do cat "$cert" >> /etc/ssl/certs/ca-certificates.crt; done | ||
|
||
# cAdvisor discovery via external files. | ||
VOLUME /var/run/heapster/hosts | ||
ADD heapster /heapster | ||
ADD eventer /eventer | ||
COPY heapster eventer / | ||
COPY ca-certificates.crt /etc/ssl/certs/ | ||
|
||
ENTRYPOINT ["/heapster"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.