Skip to content

Commit

Permalink
Add deployment and debugging Makefile targets
Browse files Browse the repository at this point in the history
Signed-off-by: Dean Troyer <[email protected]>
  • Loading branch information
dtroyer-salad committed Oct 20, 2023
1 parent 7a80410 commit d9f18af
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
# virtual-kubelet-saladcloud

# Standard Development Targets
# build - build the project, binaries go into ./bin
# build-image - build a Docker image with the virtual-kubelet binary
# clean - clean up built binaries and cached Go artifacts
# lint - run golangci-lint (set args in LINT_ARGS)
# tidy - "go mod tidy"

# Deployment and Debug Targets
# install - install the Docker image into the current k8s environment
# (add additional args in INSTALL_ARGS)
# dry-install - run install with --dry-run
# uninstall - delete the Docker image deployment from the current k8s environment
# run - run bin/virtual-kubelet in the foreground using the SCE_* environment variables

IMAGE_TAG ?= latest

NAMESPACE ?= saladcloud
DEPLOYMENT_NAME ?= mysaladcloud

# These must be defined in the environmnet before executing 'make install'
SCE_API_KEY ?= api-key
SCE_ORGANIZATION_NAME ?= org-name
SCE_PROJECT_NAME ?= project-name

# Development targets

.PHONY: build
build: CGO_ENABLED=0
build:
go build -o ./bin/virtual-kubelet ./cmd/virtual-kubelet/main.go

.PHONY: build-image
build-image:
docker build --tag ghcr.io/saladtechnologies/virtual-kubelet-saladcloud:$(IMAGE_TAG) --file docker/Dockerfile .

.PHONY: clean
clean:
rm -rf ./bin
Expand All @@ -19,3 +49,40 @@ test:

tidy:
go mod tidy

# Deploy and debug targets

# Install and start the Docker image in k8s
.PHONY: install
install:
helm install \
--create-namespace \
--namespace $(NAMESPACE) \
--set salad.apiKey=$(SCE_API_KEY) \
--set salad.organizationName=$(SCE_ORGANIZATION_NAME) \
--set salad.projectName=$(SCE_PROJECT_NAME) \
--set provider.image.tag=$(IMAGE_TAG) \
$(INSTALL_ARGS) \
$(DEPLOYMENT_NAME) \
./charts/virtual-kubelet

.PHONY: dry-install
dry-install:
$(MAKE) install INSTALL_ARGS="--dry-run"

.PHONY: uninstall
uninstall:
helm uninstall \
--namespace $(NAMESPACE) \
$(DEPLOYMENT_NAME)

# Run in foreground for debugging
.PHONY: run
run:
bin/virtual-kubelet \
--nodename $(DEPLOYMENT_NAME) \
--log-level DEBUG \
--disable-taint \
--sce-organization-name $(SCE_ORGANIZATION_NAME) \
--sce-project-name $(SCE_PROJECT_NAME) \
--sce-api-key $(SCE_API_KEY)

0 comments on commit d9f18af

Please sign in to comment.