Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Logging Driver #663

Merged
merged 9 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ jobs:
make push-images
fi

- run:
name: Push Docker Plugin
command: |
if [ -n "$DOCKER_USER" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make push-plugin
fi

publish-master:
<<: *defaults
steps:
Expand All @@ -151,6 +159,14 @@ jobs:
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make push-latest

- run:
name: Push Docker Plugin
command: |
if [ -n "$DOCKER_USER" ]; then
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
PLUGIN_TAG=master make push-plugin && PLUGIN_TAG=latest make push-plugin
fi

test-helm:
environment:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ cmd/loki/loki
cmd/promtail/promtail
cmd/loki/loki-debug
cmd/promtail/promtail-debug
cmd/docker-driver/docker-driver
/loki
/promtail
/logcli
dlv
dlv
rootfs/
183 changes: 180 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 25 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

.PHONY: all test clean images protos assets check_assets release-prepare release-perform
.DEFAULT_GOAL := all

Expand Down Expand Up @@ -32,7 +33,7 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
DONT_FIND := -name tools -prune -o -name vendor -prune -o -name .git -prune -o -name .cache -prune -o -name .pkg -prune -o

# Get a list of directories containing Dockerfiles
DOCKERFILES := $(shell find . $(DONT_FIND) -type f -name 'Dockerfile' -print)
DOCKERFILES := $(shell find . -name docker-driver -prune -o $(DONT_FIND) -type f -name 'Dockerfile' -print)
UPTODATE_FILES := $(patsubst %/Dockerfile,%/$(UPTODATE),$(DOCKERFILES))
DEBUG_DOCKERFILES := $(shell find . $(DONT_FIND) -type f -name 'Dockerfile.debug' -print)
DEBUG_UPTODATE_FILES := $(patsubst %/Dockerfile.debug,%/$(DEBUG_UPTODATE),$(DEBUG_DOCKERFILES))
Expand Down Expand Up @@ -90,7 +91,7 @@ vendor/github.com/cortexproject/cortex/pkg/ingester/client/cortex.pb.go: vendor/
vendor/github.com/cortexproject/cortex/pkg/chunk/storage/caching_index_client.pb.go: vendor/github.com/cortexproject/cortex/pkg/chunk/storage/caching_index_client.proto
pkg/promtail/server/server.go: assets
pkg/logql/expr.go: pkg/logql/expr.y
all: $(UPTODATE_FILES)
all: $(UPTODATE_FILES) build-plugin
test: $(PROTO_GOS) $(YACC_GOS)
debug: $(DEBUG_UPTODATE_FILES)
yacc: $(YACC_GOS)
Expand Down Expand Up @@ -289,4 +290,25 @@ helm-upgrade: helm


helm-clean:
-helm delete --purge loki-stack
-helm delete --purge loki-stack

PLUGIN_FOLDER = ./cmd/docker-driver
PLUGIN_TAG ?= $(IMAGE_TAG)

build-plugin: $(PLUGIN_FOLDER)/docker-driver
-docker plugin disable grafana/loki-docker-driver:$(IMAGE_TAG)
-docker plugin rm grafana/loki-docker-driver:$(IMAGE_TAG)
-rm -rf $(PLUGIN_FOLDER)/rootfs
mkdir $(PLUGIN_FOLDER)/rootfs
docker build -t rootfsimage $(PLUGIN_FOLDER)
ID=$$(docker create rootfsimage true) && \
(docker export $$ID | tar -x -C $(PLUGIN_FOLDER)/rootfs) && \
docker rm -vf $$ID
docker rmi rootfsimage -f
docker plugin create grafana/loki-docker-driver:$(PLUGIN_TAG) $(PLUGIN_FOLDER)

push-plugin: build-plugin
docker plugin push grafana/loki-docker-driver:$(PLUGIN_TAG)

enable-plugin:
docker plugin enable grafana/loki-docker-driver:$(PLUGIN_TAG)
Loading