-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
139 lines (109 loc) · 4.29 KB
/
Copy pathJustfile
File metadata and controls
139 lines (109 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
chart_dir := "./charts"
config_dir := "./configs"
# Name of the Minikube cluster
cluster := "eaasi"
# Name of the cluster namespace
namespace := "eaasi"
# Defaults for database-cluster
database_cluster_name := "database-cluster"
database_cluster_ns := "database"
### HELPERS ###################################################################
# Run spell checker
spellcheck:
typos --config "{{ config_dir }}/typos.toml"
# Run chart linter
lint chart="*":
helm lint "{{ chart_dir / chart }}"
# Run chart validator
validate chart="*":
docker run -t --rm --network="host" \
--workdir="/data" \
--volume="$PWD:/data" \
--volume="$(helm env HELM_CACHE_HOME):/root/.cache/helm:ro" \
--volume="$(helm env HELM_CONFIG_HOME):/root/.config/helm:ro" \
"quay.io/helmpack/chart-testing:v3.7.1" \
ct lint --config "{{ config_dir }}/chart-testing.yaml" \
--helm-dependency-extra-args "--skip-refresh" \
{{ if chart == "*" { "--all" } else { '--charts "' + (chart_dir / chart) + '"' } }}
# Update chart's changelog
update-changelog chart version="" dir=(chart_dir / chart):
#!/usr/bin/env -S sh -eu -o allexport
test -f cliff.env && . ./cliff.env
export cliff_commit_scope="{{ chart }}"
git cliff --unreleased \
{{ if version == "" { "--bump" } else { "--tag " + chart + "-" + version } }} \
--tag-pattern "{{ chart }}-.+" \
--prepend "{{ dir }}/CHANGELOG.md"
### HELM ######################################################################
# Add external chart repositories
add-chart-repos:
helm repo add "cnpg" "https://cloudnative-pg.github.io/charts"
# Build dependencies for all charts
build-chart-deps:
#!/usr/bin/env -S sh -eu
charts=$(ls "{{ chart_dir }}/")
for chart in $charts; do
just dep-build "$chart"
done
# Build Helm chart's dependencies from its lock file
dep-build chart *args="--skip-refresh":
helm dependency build "{{ chart_dir / chart }}" {{ args }}
# Update Helm chart's on-disk dependencies
dep-update chart *args="--skip-refresh":
helm dependency update "{{ chart_dir / chart }}" {{ args }}
# Install a Helm chart
install chart name=chart ns=namespace *args:
helm install "{{ name }}" "{{ chart_dir / chart }}" \
--namespace "{{ ns }}" --create-namespace {{ args }}
# Uninstall a Helm chart release
uninstall release ns=namespace *args:
helm uninstall "{{ release }}" --namespace "{{ ns }}" {{ args }}
# Upgrade a Helm chart release
upgrade chart release=chart ns=namespace *args:
helm upgrade "{{ release }}" "{{ chart_dir / chart }}" \
--namespace "{{ ns }}" --create-namespace --install {{ args }}
# Render a Helm chart
render chart name=chart ns=namespace *args:
helm template "{{ name }}" "{{ chart_dir / chart }}" \
--namespace "{{ ns }}" {{ args }} | less
# Test a Helm chart release
test release ns=namespace *args:
helm test "{{ release }}" --namespace "{{ ns }}" {{ args }}
### MINIKUBE ##################################################################
# Start a Minikube cluster
cluster-start name=cluster ns=namespace *args:
minikube start --profile "{{ name }}" \
--namespace "{{ ns }}" \
--cpus "no-limit" \
--memory "no-limit" \
--force-systemd=true \
{{ args }}
# Stop a Minikube cluster
cluster-stop name=cluster:
minikube stop --profile "{{ name }}"
# Pause a Minikube cluster
cluster-pause name=cluster:
minikube pause --profile "{{ name }}" --all-namespaces
# Unpause a Minikube cluster
cluster-unpause name=cluster:
minikube unpause --profile "{{ name }}" --all-namespaces
# Delete a Minikube cluster
cluster-delete name=cluster:
minikube delete --profile "{{ name }}"
### EAASI #####################################################################
# Deploy the database-operator
deploy-database-operator name="database-operator" ns="cnpg-system" *args="--wait": \
(upgrade "database" name ns "-f" (chart_dir / "database/configs/operator.yaml") args)
# Deploy the database-cluster
deploy-database-cluster name=database_cluster_name ns=database_cluster_ns *args="--wait": \
(upgrade "database" name ns args)
# Deploy all components
deploy-all: \
(deploy-database-operator) \
(deploy-database-cluster) \
# Test the database-cluster
test-database-cluster name=database_cluster_name ns=database_cluster_ns *args: \
(test name ns args)
# Test all components
test-all: \
(test-database-cluster) \