-
Notifications
You must be signed in to change notification settings - Fork 98
/
Taskfile.yaml
203 lines (180 loc) · 6.74 KB
/
Taskfile.yaml
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
version: '3'
# NOTE: Task doesn't allow to override environment variables. Thus, when an
# environment variable is referenced in a taskfile, it is because we expect it
# to be defined by the environment where Task is being invoked or in a task's
# `env:` attribute.
dotenv: []
vars:
BINDIR: .local/bin
# Configuration Defaults
NAMESPACE: rn
RELEASE: rp
KIND_CLUSTERNAME: rp-helm
CLUSTER_NAME: '{{.CLUSTER_NAME | default "capi"}}'
CLUSTER_NAMESPACE: '{{.CLUSTER_NAMESPACE | default "default"}}'
# Overridable task vars
HELM_OPTIONS: ""
KIND_FLAGS: "--config .github/kind.yaml"
SRC_DIR:
sh: realpath {{default "." .SRC_DIR}}
# if a task is referenced multiple times, only run it once
run: once
# Try to follow "THING:ACTION:SPECIFIER" for specific actions.
# Examples:
# - chart:lint:redpanda # Lint the redpanda chart
# - helm:add-repo:jetstack # Add the jetstack repo to helm
# - helm:install:cert-manager # Install cert-manager using helm
# When this files becomes too long, all of THING can be extracted into it's own
# file.
# For CI or running many types of similar ACTIONs, have a top level task named
# just ACTION. For example, "lint" would run tasks that match *:lint:*. (Though
# there's no matching in taskile AFAIK so this is done by hand).
#
# Feel free to change this format provided there's a general flow to the new
# format, all existing tasks are changed, and backwards compatibility is
# maintained via aliases.
tasks:
shell:
desc: "Launch a development shell"
cmds:
- nix develop --impure
ci:lint:
cmds:
- task: generate
- gofumpt -w .
# Fail on any generated diffs.
- git diff --exit-code
# Actually run linters.
- actionlint
- ct lint --chart-dirs ./charts --check-version-increment=false --github-groups --all
- .github/check-ci-files.sh charts/connectors/ci
- .github/check-ci-files.sh charts/kminion/ci
- .github/check-ci-files.sh charts/operator/ci
- .github/check-ci-files.sh charts/redpanda/ci
- staticcheck ./...
generate:
desc: "Run all file generation tasks"
cmds:
# Generate chart README.md's
- nix develop -c helm-docs -c ./charts/
- task: chart:generate:console
- task: chart:generate:operator
- task: chart:generate:redpanda
- task: chart:generate:connectors
# Ensure go deps are up to date
- go mod tidy
- go work sync
# Ensure flake.nix has been formatted.
- nix fmt
chart:generate:console:
desc: "Generate files for the console Helm chart"
cmds:
# Generate a "partial" version of the Values struct.
- go run ./cmd/genpartial -out charts/console/values_partial.gen.go -struct Values ./charts/console
# Generate helm templates from Go definitions
- go run ./cmd/gotohelm -write ./charts/console/templates ./charts/console
chart:generate:operator:
desc: "Generate files for the operator Helm chart"
cmds:
# Generate a "partial" version of the Values struct.
- go run ./cmd/genpartial -out charts/operator/values_partial.gen.go -struct Values ./charts/operator
# Generate the values JSON schema from the Values struct
- go run ./cmd/genschema operator > charts/operator/values.schema.json
# Generate helm templates from Go definitions
- go run ./cmd/gotohelm -write ./charts/operator/templates ./charts/operator
chart:generate:redpanda:
desc: "Generate files for the redpanda Helm chart"
cmds:
# Generate a "partial" version of the Values struct.
- go run ./cmd/genpartial -out charts/redpanda/values_partial.gen.go -struct Values ./charts/redpanda
# Generate the values JSON schema from the Values struct
- go run ./cmd/genschema redpanda > charts/redpanda/values.schema.json
# Generate helm templates from Go definitions
- go run ./cmd/gotohelm -write ./charts/redpanda/templates ./charts/redpanda ./charts/...
chart:generate:connectors:
desc: "Generate files for the connectors Helm chart"
cmds:
# Generate a "partial" version of the Values struct.
- go run ./cmd/genpartial -out charts/connectors/values_partial.gen.go -struct Values ./charts/connectors
# Generate helm templates from Go definitions
- go run ./cmd/gotohelm -write ./charts/connectors/templates ./charts/connectors
helm:add-repo:jetstack:
aliases:
- add-jetstack-repo
cmds:
- helm repo add jetstack https://charts.jetstack.io
- helm repo update
status:
- helm search repo -r '\vjetstack/cert-manager\v' | grep cert-manager
helm:add-repo:prometheus-community:
aliases:
- add-prometheus-community-repo
cmds:
- helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- helm repo update
status:
- helm search repo -r '\vprometheus-community/kube-prometheus-stack\v' | grep metallb
helm:add-repo:metallb:
aliases:
- add-metallb-repo
cmds:
- helm repo add metallb https://metallb.github.io/metallb
- helm repo update
status:
- helm search repo -r '\vmetallb/metallb\v' | grep metallb
helm:install:metallb:
aliases:
- install-metallb
deps:
- helm:add-repo:metallb
cmds:
- |
helm install metallb metallb/metallb \
--create-namespace \
--namespace metallb-system \
--version 0.13.10 \
--wait \
--wait-for-jobs
- kubectl --namespace metallb-system apply -f .github/metallb-config.yaml
helm:install:cert-manager:
aliases:
- install-cert-manager
deps:
- helm:add-repo:jetstack
cmds:
- |
helm install cert-manager jetstack/cert-manager \
--create-namespace \
--namespace cert-manager \
--set installCRDs=true \
--version v1.11.0 \
--wait \
--wait-for-jobs
helm:install:kube-prometheus-stack:
aliases:
- install-kube-prometheus-stack
deps:
- helm:add-repo:prometheus-community
cmds:
- |
helm install prometheus prometheus-community/kube-prometheus-stack \
--namespace prometheus \
--create-namespace \
--set alertmanager.enabled=false \
--set grafana.enabled=false \
--set kubeStateMetrics.enabled=false \
--set nodeExporter.enabled=false \
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false \
--wait \
--wait-for-jobs
kind-create:
cmds:
- kind create cluster --name {{.KIND_CLUSTERNAME}} {{.KIND_FLAGS}}
- task: install-cert-manager
- task: install-metallb
- task: install-kube-prometheus-stack
status:
- "kind get clusters | grep {{.KIND_CLUSTERNAME}}"
kind-delete:
cmds:
- kind delete cluster --name {{.KIND_CLUSTERNAME}}