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

build: Use goreman for starting locally. #3074

Merged
merged 3 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ commands:
- checkout
- maybe_skip_job
- install_kustomize
- run:
name: Preemptively pull images
command: make pull-build-images test-images
background: true
- run:
name: Install and start K3S v1.0.1
command: curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.0.1 INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
background: true
- restore_go_cache
- install_golang
- run:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix regular failing builds (due to Golang not being installed)

name: Preemptively pull images
command: make pull-build-images test-images
background: true
- restore_go_mod
- run: go mod download
- run:
Expand Down
52 changes: 21 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ STATIC_BUILD ?= true
CI ?= false
DB ?= postgres
K3D := $(shell if [ "`which kubectl`" != '' ] && [ "`kubectl config current-context`" = "k3s-default" ]; then echo true; else echo false; fi)
# which components to start, useful if you want to disable them to debug
COMPONENTS := controller,argo-server
LOG_LEVEL := debug
ALWAYS_OFFLOAD_NODE_STATUS := true

ifeq ($(DB),no-db)
ALWAYS_OFFLOAD_NODE_STATUS := false
endif

ifeq ($(CI),true)
TEST_OPTS := -coverprofile=coverage.out
Expand Down Expand Up @@ -125,6 +128,10 @@ define docker_build
if [ $(K3D) = true ]; then k3d import-images $(IMAGE_NAMESPACE)/$(1):$(VERSION); fi
touch $(3)
endef
define docker_pull
docker pull $(1)
if [ $(K3D) = true ]; then k3d import-images $(1); fi
endef

.PHONY: build
build: status clis executor-image controller-image manifests/install.yaml manifests/namespace-install.yaml manifests/quick-start-postgres.yaml manifests/quick-start-mysql.yaml
Expand Down Expand Up @@ -310,32 +317,17 @@ $(VERSION_FILE):
@mkdir -p dist
touch $(VERSION_FILE)

dist/postgres.yaml: $(MANIFESTS) $(E2E_MANIFESTS) $(VERSION_FILE)
kustomize build --load_restrictor=none test/e2e/manifests/postgres | sed 's/:$(MANIFESTS_VERSION)/:$(VERSION)/' | sed 's/pns/$(E2E_EXECUTOR)/' > dist/postgres.yaml

dist/no-db.yaml: $(MANIFESTS) $(E2E_MANIFESTS) $(VERSION_FILE)
dist/$(DB).yaml: $(MANIFESTS) $(E2E_MANIFESTS) $(VERSION_FILE)
# We additionally disable ALWAYS_OFFLOAD_NODE_STATUS
kustomize build --load_restrictor=none test/e2e/manifests/no-db | sed 's/:$(MANIFESTS_VERSION)/:$(VERSION)/' | sed 's/pns/$(E2E_EXECUTOR)/' | sed 's/"true"/"false"/' > dist/no-db.yaml

dist/mysql.yaml: $(MANIFESTS) $(E2E_MANIFESTS) $(VERSION_FILE)
kustomize build --load_restrictor=none test/e2e/manifests/mysql | sed 's/:$(MANIFESTS_VERSION)/:$(VERSION)/' | sed 's/pns/$(E2E_EXECUTOR)/' > dist/mysql.yaml
kustomize build --load_restrictor=none test/e2e/manifests/$(DB) | sed 's/:$(MANIFESTS_VERSION)/:$(VERSION)/' | sed 's/pns/$(E2E_EXECUTOR)/' > dist/$(DB).yaml

.PHONY: install
install: dist/postgres.yaml dist/mysql.yaml dist/no-db.yaml
install: dist/$(DB).yaml
ifeq ($(K3D),true)
k3d start
endif
# Install quick-start
kubectl apply -f test/e2e/manifests/argo-ns.yaml
ifeq ($(DB),postgres)
kubectl -n argo apply -f dist/postgres.yaml
else
ifeq ($(DB),mysql)
kubectl -n argo apply -f dist/mysql.yaml
else
kubectl -n argo apply -f dist/no-db.yaml
endif
endif
kubectl -n argo apply -l app.kubernetes.io/part-of=argo --prune --force -f dist/$(DB).yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will delete mysql if you run postgres and vice-versa, but not delete workflows

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for fitting my use case.


.PHONY: pull-build-images
pull-build-images:
Expand All @@ -354,29 +346,27 @@ test/e2e/images/argosay/v2/argosay: $(shell find test/e2e/images/argosay/v2/main

.PHONY: test-images
test-images:
docker pull argoproj/argosay:v1
docker pull argoproj/argosay:v2
docker pull python:alpine3.6
$(call docker_pull,argoproj/argosay:v1)
$(call docker_pull,argoproj/argosay:v2)
$(call docker_pull,python:alpine3.6)

.PHONY: stop
stop:
killall argo workflow-controller pf.sh kubectl || true

$(GOPATH)/bin/goreman:
go get github.com/mattn/goreman

.PHONY: start-aux
start-aux:
start-aux: $(GOPATH)/bin/goreman
kubectl config set-context --current --namespace=argo
kubectl -n argo wait --for=condition=Ready pod --all -l app --timeout 2m
./hack/port-forward.sh
# Check minio, postgres and mysql are in hosts file
grep '127.0.0.1 *minio' /etc/hosts
grep '127.0.0.1 *postgres' /etc/hosts
grep '127.0.0.1 *mysql' /etc/hosts
ifneq ($(findstring controller,$(COMPONENTS)),)
ALWAYS_OFFLOAD_NODE_STATUS=true OFFLOAD_NODE_STATUS_TTL=30s WORKFLOW_GC_PERIOD=30s UPPERIO_DB_DEBUG=1 ARCHIVED_WORKFLOW_GC_PERIOD=30s ./dist/workflow-controller --executor-image argoproj/argoexec:$(VERSION) --namespaced --loglevel $(LOG_LEVEL) &
endif
ifneq ($(findstring argo-server,$(COMPONENTS)),)
UPPERIO_DB_DEBUG=1 ./dist/argo --loglevel $(LOG_LEVEL) server --namespaced --auth-mode client --secure &
endif
env ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) LOG_LEVEL=$(LOG_LEVEL) VERSION=$(VERSION) goreman -set-ports=false start

.PHONY: start
start: status stop install controller cli executor-image start-aux wait env
Expand Down
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
workflow-controller: ALWAYS_OFFLOAD_NODE_STATUS=${ALWAYS_OFFLOAD_NODE_STATUS} OFFLOAD_NODE_STATUS_TTL=30s WORKFLOW_GC_PERIOD=30s UPPERIO_DB_DEBUG=1 ARCHIVED_WORKFLOW_GC_PERIOD=30s ./dist/workflow-controller --executor-image argoproj/argoexec:${VERSION} --namespaced --loglevel ${LOG_LEVEL}
argo-server: UPPERIO_DB_DEBUG=1 ./dist/argo --loglevel ${LOG_LEVEL} server --namespaced --auth-mode client --secure
Loading