fab-city-os-core-chart/Makefile
2023-03-28 19:31:30 +02:00

119 lines
3.4 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 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 fab-city-os-core-dev --config k3d-dev.yaml
k3d-delete: ## Delete the local K3D development cluster
@k3d cluster delete fab-city-os-core-dev
info: ## Show k3d cluster info
@k3d cluster list
@kubectl cluster-info
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-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
##@ Helm
get-plugins: ## Get the required helm plugins.
@helm plugin install https://github.com/chartmuseum/helm-push
add-repo: ## Add the Gitlab helm repository.
@helm repo add fab-city-os-core-beta https://gitlab.fabcity.hamburg/api/v4/projects/248/packages/helm/beta
update: ## Update helm dependencies.
@helm dependency update
build: ## Build helm dependencies.
@helm dependency build
dry-run: ## Run helm dry run.
@helm install --dry-run fab-city-os-core .
install: ## Run helm install.
@helm install fab-city-os-core .
uninstall: ## Run helm uninstall.
@helm uninstall fab-city-os-core || true
reinstall: uninstall install ## Run helm reinstall.
deploy: reinstall ## deploy helm chart.
render: ## Render helm chart.
@helm template .
package: ## Package the helm chart.
@helm package . --destination dist
push: ## Publish the helm chart.
@helm cm-push dist/fab-city-os-core-$(grep '^version:' Chart.yaml | awk '{print $2}').tgz fab-city-os-core-beta
%:
@true