-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathTaskfile.yaml
181 lines (161 loc) · 5.82 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
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
generate:
desc: "Run all file generation tasks"
cmds:
# Generate chart README.md's
- nix develop -c helm-docs -c ./charts/
# Ensure go deps are up to date
- go mod tidy
# Ensure flake.nix has been formatted.
- nix fmt
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}}
sync:charts:
vars:
OPERATOR_TMP_PATH:
sh: mktemp --directory --tmpdir "operator-XXXXXXXXXX"
OPERATOR_SHA: 1388ec6c6b63ea2637b6c34c17d9e2c87d41e624 # redpanda v5.9.20
cmds:
- defer: rm -r {{.OPERATOR_TMP_PATH}}
- curl -Lo {{.OPERATOR_TMP_PATH}}operator.zip https://github.com/redpanda-data/redpanda-operator/archive/{{.OPERATOR_SHA}}.zip
- unzip {{.OPERATOR_TMP_PATH}}operator.zip -d {{.OPERATOR_TMP_PATH}}
- rsync -avz
{{.OPERATOR_TMP_PATH}}/redpanda-operator-{{.OPERATOR_SHA}}/charts/connectors
{{.OPERATOR_TMP_PATH}}/redpanda-operator-{{.OPERATOR_SHA}}/charts/console
{{.OPERATOR_TMP_PATH}}/redpanda-operator-{{.OPERATOR_SHA}}/charts/operator
{{.OPERATOR_TMP_PATH}}/redpanda-operator-{{.OPERATOR_SHA}}/charts/redpanda
charts/
# Clear out all go files, we just want the templates, Chart.yaml's, etc.
# Task's globbing is unreliable.
- bash -O globstar -c "rm charts/{connectors,console,operator,redpanda}/**/*.{go,txtar}"
- bash -O globstar -c "rm charts/{connectors,console,operator,redpanda}/go.{mod,sum}"