fab-city-os-core-chart/Makefile
2022-10-25 13:38:56 +02:00

110 lines
3 KiB
Makefile

##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Setup
up: k3d-create update build ## Create a local k3d development cluster.
down: k3d-delete ## Delete the local k3d development cluster.
k3d-create: ## Create a local K3D development cluster.
@k3d cluster create fcos-dev --config k3d-dev.yaml
k3d-delete: ## Delete the local K3D development cluster
@k3d cluster delete fcos-dev
info: ## Show k3d cluster info
@k3d cluster list
@kubectl cluster-info
##@ Helm
update: ## Update helm dependencies
@helm dependency update
build: ## Build helm dependencies
@helm dependency build
dry-run: ## Run helm dry run
@helm install --dry-run fcoscore .
install: ## Run helm install
@helm install fcoscore .
uninstall: ## Run helm uninstall
@helm uninstall fcoscore || true
reinstall: uninstall install ## Run helm reinstall
clean: down up ## Clean the local Kubernetes development cluster.
##@ Lint
lint: helm ## Lint all input files.
lint-yaml: ## Lint YAML files.
@yamllint -f auto .
lint-markdown: ## Lint Markdown files.
@mdl .
lint-chart: ## Lint Charts files.
@ct lint
lint-helm: ## Lint Helm files.
@helm lint .
##@ Show
get: ## Get specific Kubernetes resources from all namespaces.
@kubectl get --all-namespaces $(filter-out $@, $(MAKECMDGOALS))
get-pods: ## Get Kubernetes pods from all namespaces.
@kubectl get --all-namespaces pods
get-events: ## Get Kubernetes events from all namespaces.
@kubectl get --all-namespaces events
get-all: ## Get the state of all Kubernetes resources.
@kubectl get all --all-namespaces
get-ns: ## Get all Kubernetes namespaces.
@kubectl get namespaces
get-api: ## Get all Kubernetes api resources.
@kubectl api-resources
get-crd: ## Get all Kubernetes api resources.
@kubectl get crd
get-node: ## Get all Kubernetes nodes.
@kubectl get nodes -o wide
watch-all: ## Watch the state of all Kubernetes resources.
@watch -n 1 kubectl get all --all-namespaces
##@ Log
events: ## Show all Kubernetes cluster events.
@kubectl get events --watch --all-namespaces
##@ Tools
nav: ## Start K9s to view and manage your Kubernetes clusters.
@k9s --all-namespaces --headless
%:
@true