Skip to content

Commit fcebfdf

Browse files
committed
Refactor Makefiles #83
1 parent 8a2ad90 commit fcebfdf

29 files changed

Lines changed: 122 additions & 257 deletions

File tree

‎hack/package-system.mk‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.DEFAULT_GOAL=help
2+
.PHONY=help show diff apply delete update image
3+
4+
help: ## Show this help.
5+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
6+
7+
show: ## Show output of rendered templates
8+
case "$(NAME)" in
9+
cilium|kubeovn)
10+
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
11+
;;
12+
*)
13+
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
14+
;;
15+
esac
16+
17+
apply: suspend ## Apply Helm release to a Kubernetes cluster
18+
case "$(NAME)" in
19+
cilium|kubeovn)
20+
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
21+
;;
22+
*)
23+
helm upgrade -i -n $(NAMESPACE) $(NAME) .
24+
;;
25+
esac
26+
27+
diff: ## Diff Helm release against objects in a Kubernetes cluster
28+
case "$(NAME)" in
29+
cilium|kubeovn)
30+
kubectl get hr -n $(NAMESPACE) $(NAME) -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
31+
;;
32+
*)
33+
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
34+
;;
35+
esac
36+
37+
suspend: ## Suspend reconciliation for an existing Helm release
38+
flux suspend hr -n $(NAMESPACE) $(NAME)
39+
40+
resume: ## Resume reconciliation for an existing Helm release
41+
flux resume hr -n $(NAMESPACE) $(NAME)

‎packages/core/fluxcd/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
NAMESPACE=cozy-fluxcd
21
NAME=fluxcd
2+
NAMESPACE=cozy-$(NAME)
33

44
API_VERSIONS_FLAGS=$(addprefix -a ,$(shell kubectl api-versions))
55

‎packages/core/installer/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
NAMESPACE=cozy-system
21
NAME=installer
2+
NAMESPACE=cozy-system
33
PUSH := 1
44
LOAD := 0
55
REGISTRY := ghcr.io/aenix-io/cozystack

‎packages/core/platform/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
NAMESPACE=cozy-system
21
NAME=platform
2+
NAMESPACE=cozy-system
33

44
API_VERSIONS_FLAGS=$(addprefix -a ,$(shell kubectl api-versions))
55

‎packages/system/capi-operator/Makefile‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
NAME=capi-operator
22
NAMESPACE=cozy-cluster-api
33

4-
show:
5-
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
6-
7-
apply:
8-
helm upgrade -i -n $(NAMESPACE) $(NAME) .
9-
10-
diff:
11-
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
4+
include ../../hack/package-system.mk
125

136
update:
147
rm -rf charts
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
NAME=capi-providers
22
NAMESPACE=cozy-cluster-api
33

4-
show:
5-
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
6-
7-
apply:
8-
helm upgrade -i -n $(NAMESPACE) $(NAME) .
9-
10-
diff:
11-
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
4+
include ../../hack/package-system.mk
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
NAME=cert-manager-issuers
22
NAMESPACE=cozy-cert-manager
33

4-
show:
5-
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
6-
7-
apply:
8-
helm upgrade -i -n $(NAMESPACE) $(NAME) .
9-
10-
diff:
11-
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
4+
include ../../hack/package-system.mk
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
NAME=cert-manager
2-
NAMESPACE=cozy-cert-manager
2+
NAMESPACE=cozy-$(NAME)
33

4-
show:
5-
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
6-
7-
apply:
8-
helm upgrade -i -n $(NAMESPACE) $(NAME) .
9-
10-
diff:
11-
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
4+
include ../../hack/package-system.mk
125

136
update:
147
rm -rf charts
158
helm repo add jetstack https://charts.jetstack.io
169
helm repo update jetstack
17-
helm pull jetstack/cert-manager --untar --untardir charts
10+
helm pull jetstack/$(NAME) --untar --untardir charts

‎packages/system/cilium/Makefile‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
NAMESPACE=cozy-cilium
21
NAME=cilium
2+
NAMESPACE=cozy-$(NAME)
33

4-
show:
5-
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm template --dry-run=server -n $(NAMESPACE) $(NAME) . -f -
6-
7-
apply:
8-
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm upgrade -i -n $(NAMESPACE) $(NAME) . -f -
9-
10-
diff:
11-
kubectl get hr -n cozy-cilium cilium -o jsonpath='{.spec.values}' | helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) . -f -
4+
include ../../hack/package-system.mk
125

136
update:
147
rm -rf charts
15-
helm repo add cilium https://helm.cilium.io/
16-
helm repo update cilium
17-
helm pull cilium/cilium --untar --untardir charts --version 1.14
18-
sed -i -e '/Used in iptables/d' -e '/SYS_MODULE/d' charts/cilium/values.yaml
8+
helm repo add $(NAME) https://helm.cilium.io/
9+
helm repo update $(NAME)
10+
helm pull $(NAME)/$(NAME) --untar --untardir charts --version 1.14
11+
sed -i -e '/Used in iptables/d' -e '/SYS_MODULE/d' charts/$(NAME)/values.yaml
1912
patch -p3 --no-backup-if-mismatch < patches/fix-cgroups.patch

‎packages/system/clickhouse-operator/Makefile‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
NAME=clickhouse-operator
22
NAMESPACE=cozy-clickhouse-operator
33

4-
show:
5-
helm template --dry-run=server -n $(NAMESPACE) $(NAME) .
6-
7-
apply:
8-
helm upgrade -i -n $(NAMESPACE) $(NAME) .
9-
10-
diff:
11-
helm diff upgrade --allow-unreleased --normalize-manifests -n $(NAMESPACE) $(NAME) .
4+
include ../../hack/package-system.mk
125

136
update:
147
rm -rf charts

0 commit comments

Comments
 (0)