-
Notifications
You must be signed in to change notification settings - Fork 1
230 lines (193 loc) · 7.48 KB
/
helm_charts_scalar.yml
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Chart Testing and Kubeval
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- "charts/**"
workflow_dispatch:
env:
HELM_VERSION: v3.11.3
jobs:
lint-chart:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: 3.11
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Add Helm repos
run: |
helm repo add scalar https://scalar-labs.github.io/helm-charts
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
with:
version: 3.10.1
- name: Run chart-testing (updated chart)
if: ${{ github.event_name != 'workflow_dispatch' }}
run: ct lint --config .github/ct.yaml
- name: Run chart-testing (all charts)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: ct lint --config .github/ct-all.yaml
kubeaudit-chart:
runs-on: ubuntu-latest
env:
KUBE_AUDIT_VERSION: 0.22.0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Set up kubeaudit
uses: supplypike/setup-bin@v3
with:
uri: "https://github.com/Shopify/kubeaudit/releases/download/v${{ env.KUBE_AUDIT_VERSION }}/kubeaudit_${{ env.KUBE_AUDIT_VERSION }}_linux_amd64.tar.gz"
name: "kubeaudit"
version: ${{ env.KUBE_AUDIT_VERSION }}
- name: Add Helm repos
run: |
helm repo add scalar https://scalar-labs.github.io/helm-charts
- name: Run kubeaudit
run: |
# TODO If more charts are supported by kubeaudit, they should be added.
# Change to `ls charts` when all charts are supported.
chart_dirs=(envoy scalardb scalardl scalardl-audit scalardb-cluster scalardb-analytics-postgresql)
for chart_dir in ${chart_dirs[@]}; do
echo "helm dependency build charts/${chart_dir} chart..."
helm dependency build charts/${chart_dir}
echo "kubeaudit charts/${chart_dir} chart..."
kubeaudit all -k .github/kube-audit.yaml -f <(helm template --generate-name "charts/${chart_dir}") -m error
done
kubeval-chart:
runs-on: ubuntu-latest
needs: lint-chart
strategy:
matrix:
k8s:
- v1.27.16
- v1.28.13
- v1.29.8
- v1.30.4
- v1.31.0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Add Helm repos
run: |
helm repo add scalar https://scalar-labs.github.io/helm-charts
- name: Install helm-kubeval plugin
run: helm plugin install https://github.com/instrumenta/helm-kubeval
- name: Run kubeval
run: |
chart_dirs=$(ls charts)
for chart_dir in ${chart_dirs}; do
echo "helm dependency build charts/${chart_dir} chart..."
helm dependency build charts/${chart_dir}
echo "kubeval(idating) charts/${chart_dir} chart..."
helm kubeval "charts/${chart_dir}" -v "${KUBERNETES_VERSION#v}"
done
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
KUBEVAL_SCHEMA_LOCATION: https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master
install-chart:
name: install-chart
runs-on: ubuntu-latest
needs:
- lint-chart
- kubeval-chart
- kubeaudit-chart
env:
DOCKER_REGISTRY_PASSWORD: ${{ secrets.CR_PAT }}
DOCKER_REGISTRY_USERNAME: scalar-git
DOCKER_REGISTRY_SERVER: ghcr.io
strategy:
matrix:
k8s:
- v1.27.16
- v1.28.13
- v1.29.8
- v1.30.4
- v1.31.0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Add Helm repos
run: |
helm repo add scalar https://scalar-labs.github.io/helm-charts
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/ct.yaml)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/[email protected]
with:
config: .github/kind-cluster.yaml
node_image: kindest/node:${{ matrix.k8s }}
kubectl_version: ${{ matrix.k8s }}
if: ${{ steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' }}
- name: Setup kubernetes (Kind) with registry, PostgreSQL and schema
run: |
kubectl cluster-info
kubectl create secret docker-registry reg-docker-secrets --docker-server=${DOCKER_REGISTRY_SERVER} --docker-username=${DOCKER_REGISTRY_USERNAME} --docker-password=${DOCKER_REGISTRY_PASSWORD}
kubectl create secret generic ledger-keys --from-file=private-key=.github/ledger-key.pem
kubectl create secret generic auditor-keys --from-file=certificate=.github/auditor-cert.pem --from-file=private-key=.github/auditor-key.pem
kubectl create secret generic scalardb-analytics-postgresql-superuser-password --from-literal=superuser-password=postgres
helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql -f .github/postgresql.yaml
helm dependency build charts/scalardb-cluster/
helm install scalardb-cluster-for-scalar-admin-for-kubernetes ./charts/scalardb-cluster/ -f ./charts/scalardb-cluster/ci/scalardb-cluster-ct-values.yaml # Create ScalarDB Cluster for Scalar Admin for Kubernetes test.
sleep 1 # Waiting for the StatefulSet creates a PostgreSQL pod.
kubectl wait --for=condition=Ready --timeout=120s pod/postgresql-0
kubectl create -f .github/schema-loading.yaml # Create schema for ScalarDB GraphQL and ScalarDB Analytics with PostgreSQL.
kubectl wait --for=condition=complete --timeout=60s job/schema-loading
kubectl wait --for=condition=available --timeout=300s deployment/scalardb-cluster-for-scalar-admin-for-kubernetes-node
kubectl get pods,svc,endpoints,nodes -o wide
- name: Run chart-testing (updated chart)
if: ${{ github.event_name != 'workflow_dispatch' }}
run: ct install --config .github/ct.yaml --helm-extra-set-args "--wait-for-jobs"
- name: Run chart-testing (all charts)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: ct install --config .github/ct-all.yaml --helm-extra-set-args "--wait-for-jobs"
verify-chart-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Verify chart docs
run: ./scripts/verify-chart-docs.sh
verify-values-schema-json:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Verify values schema json
run: ./scripts/verify-values-schema-json.sh