Merge pull request #86 from aenix-io/83-refactor-makefiles

Refactor Makefiles #83
This commit is contained in:
Marian Koreniuk
2024-04-17 22:39:14 +02:00
committed by GitHub
29 changed files with 67 additions and 223 deletions

20
hack/package-system.mk Normal file
View File

@@ -0,0 +1,20 @@
.DEFAULT_GOAL=help
.PHONY=help show diff apply delete update image
help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
show: ## Show output of rendered templates
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
apply: suspend ## Apply Helm release to a Kubernetes cluster
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
diff: ## Diff Helm release against objects in a Kubernetes cluster
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
suspend: ## Suspend reconciliation for an existing Helm release
flux suspend hr -n $(NAMESPACE) $(NAME)
resume: ## Resume reconciliation for an existing Helm release
flux resume hr -n $(NAMESPACE) $(NAME)

View File

@@ -1,5 +1,5 @@
NAMESPACE=cozy-fluxcd
NAME=fluxcd
NAMESPACE=cozy-$(NAME)
API_VERSIONS_FLAGS=$(addprefix -a ,$(shell kubectl api-versions))

View File

@@ -1,5 +1,5 @@
NAMESPACE=cozy-system
NAME=installer
NAMESPACE=cozy-system
PUSH := 1
LOAD := 0
REGISTRY := ghcr.io/aenix-io/cozystack

View File

@@ -1,5 +1,5 @@
NAMESPACE=cozy-system
NAME=platform
NAMESPACE=cozy-system
API_VERSIONS_FLAGS=$(addprefix -a ,$(shell kubectl api-versions))

View File

@@ -1,14 +1,7 @@
NAME=capi-operator
NAMESPACE=cozy-cluster-api
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,11 +1,4 @@
NAME=capi-providers
NAMESPACE=cozy-cluster-api
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk

View File

@@ -1,11 +1,4 @@
NAME=cert-manager-issuers
NAMESPACE=cozy-cert-manager
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk

View File

@@ -1,14 +1,7 @@
NAME=cert-manager
NAMESPACE=cozy-cert-manager
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAMESPACE=cozy-cilium
NAME=cilium
NAMESPACE=cozy-$(NAME)
show:
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
apply:
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
diff:
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=clickhouse-operator
NAMESPACE=cozy-clickhouse-operator
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,18 +1,11 @@
NAME=dashboard
NAMESPACE=cozy-dashboard
NAMESPACE=cozy-$(NAME)
PUSH := 1
LOAD := 0
REPOSITORY := ghcr.io/aenix-io/cozystack
TAG := v0.2.0
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update: update-chart update-dockerfiles
image: image-dashboard image-kubeapps-apis

View File

@@ -1,14 +1,7 @@
NAME=grafana-operator
NAMESPACE=cozy-grafana-operator
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=ingress-nginx
NAMESPACE=cozy-ingress-nginx
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=kafka-operator
NAMESPACE=cozy-kafka-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,15 +1,7 @@
NAME=kamaji
NAMESPACE=cozy-kamaji
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
flux suspend hr kamaji -n cozy-kamaji || true
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAMESPACE=cozy-kubeovn
NAME=kubeovn
NAMESPACE=cozy-$(NAME)
show:
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
apply:
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
diff:
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
include ../../hack/package-system.mk
update:
rm -rf charts && mkdir -p charts/kube-ovn

View File

@@ -1,14 +1,7 @@
NAME=kubevirt-cdi-operator
NAMESPACE=cozy-kubevirt-cdi
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf templates

View File

@@ -1,14 +1,7 @@
NAME=kubevirt-cdi
NAMESPACE=cozy-kubevirt-cdi
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf templates

View File

@@ -1,19 +1,12 @@
NAME=kubevirt-operator
NAMESPACE=cozy-kubevirt
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf templates
mkdir templates
export RELEASE=$$(curl https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirt/stable.txt) && \
wget https://github.com/kubevirt/kubevirt/releases/download/$${RELEASE}/kubevirt-operator.yaml -O templates/kubevirt-operator.yaml && \
sed -i 's/namespace: kubevirt/namespace: cozy-kubevirt/g' templates/kubevirt-operator.yaml
sed -i 's/namespace: kubevirt/namespace: $(NAMESPACE)/g' templates/kubevirt-operator.yaml
awk -i inplace -v RS="---" '!/kind: Namespace/{printf "%s", $$0 RS}' templates/kubevirt-operator.yaml

View File

@@ -1,14 +1,7 @@
NAME=kubevirt
NAMESPACE=cozy-kubevirt
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf templates

View File

@@ -1,11 +1,4 @@
NAME=linstor
NAMESPACE=cozy-linstor
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk

View File

@@ -1,14 +1,7 @@
NAME=mariadb-operator
NAMESPACE=cozy-mariadb-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=metallb
NAMESPACE=cozy-metallb
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=monitoring
NAMESPACE=cozy-monitoring
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=postgres-operator
NAMESPACE=cozy-postgres-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,17 +1,10 @@
NAME=rabbitmq-operator
NAMESPACE=cozy-rabbitmq-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf templates/cluster-operator.yml
wget -O templates/cluster-operator.yml https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml
yq -i 'del(select(.kind=="Namespace"))' templates/cluster-operator.yml
sed -i 's/rabbitmq-system/cozy-rabbitmq-operator/g' templates/cluster-operator.yml
sed -i 's/rabbitmq-system/$(NAMESPACE)/g' templates/cluster-operator.yml

View File

@@ -1,14 +1,7 @@
NAME=redis-operator
NAMESPACE=cozy-redis-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=traffic-manager
NAMESPACE=cozy-telepresence
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts

View File

@@ -1,14 +1,7 @@
NAME=victoria-metrics-operator
NAMESPACE=cozy-victoria-metrics-operator
NAMESPACE=cozy-$(NAME)
show:
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
apply:
helm upgrade -i -n $(NAMESPACE) $(NAME) .
diff:
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
include ../../hack/package-system.mk
update:
rm -rf charts