Skip to content

Commit 23d4341

Browse files
authored
Merge pull request #391 from concourse/dev
Merge dev into master
2 parents eca52b8 + 752ad7d commit 23d4341

8 files changed

Lines changed: 276 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ charts
99
[._]s[a-rt-v][a-z]
1010
[._]ss[a-gi-z]
1111
[._]sw[a-p]
12+
13+
__snapshot__

.helmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
.idea/
2121
*.tmprojt
2222
tests/
23+
24+
__snapshot__/

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ The following table lists the configurable parameters of the Concourse chart and
198198
| `web.ingress.ingressClassName` | IngressClass to register to | `nil` |
199199
| `web.ingress.rulesOverride` | Concourse Web Ingress rules (override) (alternate to `web.ingress.hosts`) | `[]` |
200200
| `web.ingress.tls` | Concourse Web Ingress TLS configuration | `[]` |
201+
| `web.route.annotations` | Concourse Web HTTPRoute annotations | `{}` |
202+
| `web.route.enabled` | Enable Concourse Web HTTPRoute | `false` |
203+
| `web.route.hostnames` | Concourse Web HTTPRoutes Hostnames | `[]` |
204+
| `web.route.parentRefs` | Concourse Web HTTPRoute parentRefs (gateways) | `[]` |
205+
| `web.route.labels` | Concourse Web HTTPRoute labels | `[]` |
201206
| `web.keySecretsPath` | Specify the mount directory of the web keys secrets | `/concourse-keys` |
202207
| `web.labels`| Additional labels to be added to the web deployment `metadata.labels` | `{}` |
203208
| `web.deploymentAnnotations` | Additional annotations to be added to the web deployment `metadata.annotations` | `{}` |
@@ -289,6 +294,7 @@ The following table lists the configurable parameters of the Concourse chart and
289294
| `worker.priorityClassName` | Sets a PriorityClass for the worker pods | `nil` |
290295
| `worker.terminationGracePeriodSeconds` | Upper bound for graceful shutdown to allow the worker to drain its tasks | `60` |
291296
| `worker.tolerations` | Tolerations for the worker nodes | `[]` |
297+
| `worker.persistentVolumeClaimRetentionPolicy` | `Retain` or `Delete` (requires Kubernetes >= 1.32) | `Retain` |
292298
| `worker.updateStrategy` | `OnDelete` or `RollingUpdate` (requires Kubernetes >= 1.7) | `RollingUpdate` |
293299

294300
For configurable Concourse parameters, refer to [`values.yaml`](values.yaml)' `concourse` section. All parameters under this section are strictly mapped from the `concourse` binary commands.
@@ -769,3 +775,25 @@ Instead, you may add a comment specifying the default, such as
769775
This prevents the behaviour drifting from that of the binary in case the binary's default values change.
770776
771777
We understand that the comment stating the binary's default can become stale. The current solution is a suboptimal one. It may be improved in the future by generating a list of the default values from the binary.
778+
779+
## Helm Unit Test
780+
781+
When running unit tests for helm, from the root of the repository, you can simply run the following.
782+
783+
```bash
784+
helm unittest -f test/unittest/**/*.yaml .
785+
```
786+
787+
If you are debugging specific tests, simply target the folder or yaml file you want to run tests on.
788+
789+
`Folder`
790+
791+
```bash
792+
helm unittest -f test/unittest/gateway-apis/*.yaml .
793+
```
794+
795+
`Specific Test Suite`
796+
797+
```bash
798+
helm unittest -f test/unittest/gateway-apis/web-route-test.yaml .
799+
```

templates/web-route.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{- if .Values.web.enabled -}}
2+
{{- if .Values.web.route.enabled -}}
3+
{{- $route := .Values.web.route -}}
4+
{{- $releaseName := .Release.Name -}}
5+
{{- $serviceName := include "concourse.web.fullname" . -}}
6+
{{- $servicePort := .Values.concourse.web.bindPort -}}
7+
apiVersion: gateway.networking.k8s.io/v1
8+
kind: HTTPRoute
9+
metadata:
10+
name: {{ template "concourse.web.fullname" . }}
11+
labels:
12+
app: {{ template "concourse.web.fullname" . }}
13+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
14+
release: "{{ .Release.Name }}"
15+
heritage: "{{ .Release.Service }}"
16+
{{- with $route.labels }}
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
{{- with $route.annotations }}
20+
annotations:
21+
{{- toYaml . | nindent 4 }}
22+
{{- end }}
23+
spec:
24+
{{- if and $route.parentRefs (gt (len $route.parentRefs) 0) }}
25+
parentRefs:
26+
{{- toYaml $route.parentRefs | nindent 2 }}
27+
{{- end }}
28+
{{- if and $route.hostnames (gt (len $route.hostnames) 0) }}
29+
hostnames:
30+
{{- toYaml $route.hostnames | nindent 2 }}
31+
{{- end }}
32+
rules:
33+
- matches:
34+
- path:
35+
type: PathPrefix
36+
value: /
37+
backendRefs:
38+
- name: {{ $serviceName }}
39+
port: {{ $servicePort }}
40+
namespace: {{ .Release.Namespace | quote }}
41+
{{- end -}}
42+
{{- end -}}

templates/worker-policy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ spec:
1717
selector:
1818
matchLabels:
1919
app: {{ template "concourse.worker.fullname" . }}
20+
release: {{ .Release.Name }}
2021
{{- end }}

templates/worker-statefulset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ spec:
231231
{{- end }}
232232
{{- end }}
233233
{{- end }}
234+
{{ if semverCompare ">=1.32-0" .Capabilities.KubeVersion.Version -}}
235+
persistentVolumeClaimRetentionPolicy:
236+
{{ toYaml .Values.worker.persistentVolumeClaimRetentionPolicy | indent 4 }}
237+
{{- end }}
234238
{{- if semverCompare "^1.7-0" .Capabilities.KubeVersion.Version }}
235239
updateStrategy:
236240
{{ toYaml .Values.worker.updateStrategy | indent 4 }}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
suite: GatewayApis
2+
3+
tests:
4+
- it: Route Disabled
5+
set:
6+
web:
7+
route:
8+
enabled: false
9+
template: web-route.yaml
10+
asserts:
11+
- hasDocuments:
12+
count: 0
13+
14+
- it: Route Exposure
15+
set:
16+
web:
17+
route:
18+
enabled: true
19+
parentRefs:
20+
- name: test-parent
21+
namespace: test-namespace
22+
group: gateway.networking.k8s.io
23+
sectionName: test-section
24+
kind: Gateway
25+
hostnames:
26+
- concourse.example.com
27+
template: web-route.yaml
28+
asserts:
29+
- equal:
30+
path: spec.hostnames[0]
31+
value: concourse.example.com
32+
- equal:
33+
path: spec.parentRefs[0].name
34+
value: test-parent
35+
- equal:
36+
path: spec.parentRefs[0].namespace
37+
value: test-namespace
38+
- equal:
39+
path: spec.parentRefs[0].group
40+
value: gateway.networking.k8s.io
41+
- equal:
42+
path: spec.parentRefs[0].sectionName
43+
value: test-section
44+
- equal:
45+
path: spec.parentRefs[0].kind
46+
value: Gateway
47+
48+
- it: Route Extra Annotations
49+
set:
50+
web:
51+
route:
52+
enabled: true
53+
annotations:
54+
test.annotation: test-annotation
55+
parentRefs:
56+
- name: test-parent
57+
namespace: test-namespace
58+
hostnames:
59+
- concourse.example.com
60+
template: templates/web-route.yaml
61+
asserts:
62+
- equal:
63+
path: metadata.annotations["test.annotation"]
64+
value: test-annotation
65+
66+
- it: Route Extra Labels
67+
set:
68+
web:
69+
route:
70+
enabled: true
71+
labels:
72+
test.label: test-label
73+
parentRefs:
74+
- name: test-parent
75+
namespace: test-namespace
76+
hostnames:
77+
- concourse.example.com
78+
template: web-route.yaml
79+
asserts:
80+
- equal:
81+
path: metadata.labels["test.label"]
82+
value: test-label
83+
84+
- it: Route Service Exposure
85+
set:
86+
web:
87+
route:
88+
enabled: true
89+
parentRefs:
90+
- name: test-parent
91+
namespace: test-namespace
92+
hostnames:
93+
- concourse.example.com
94+
template: web-route.yaml
95+
asserts:
96+
- equal:
97+
path: spec.rules[0].backendRefs[0].name
98+
value: RELEASE-NAME-web
99+
- equal:
100+
path: spec.rules[0].matches[0].path.value
101+
value: /
102+
- equal:
103+
path: spec.rules[0].backendRefs[0].port
104+
value: 8080
105+
106+
- it: Multiple Hostnames
107+
set:
108+
web:
109+
route:
110+
enabled: true
111+
parentRefs:
112+
- name: test-parent
113+
namespace: test-namespace
114+
hostnames:
115+
- concourse.example.com
116+
- concourse.alternate.com
117+
template: web-route.yaml
118+
asserts:
119+
- equal:
120+
path: spec.hostnames[0]
121+
value: concourse.example.com
122+
- equal:
123+
path: spec.hostnames[1]
124+
value: concourse.alternate.com
125+
- lengthEqual:
126+
path: spec.hostnames
127+
count: 2
128+
129+
- it: Multiple ParentRefs
130+
set:
131+
web:
132+
route:
133+
enabled: true
134+
parentRefs:
135+
- name: test-parent-1
136+
namespace: test-namespace-1
137+
- name: test-parent-2
138+
namespace: test-namespace-2
139+
hostnames:
140+
- concourse.example.com
141+
template: web-route.yaml
142+
asserts:
143+
- equal:
144+
path: spec.parentRefs[0].name
145+
value: test-parent-1
146+
- equal:
147+
path: spec.parentRefs[1].name
148+
value: test-parent-2
149+
- lengthEqual:
150+
path: spec.parentRefs
151+
count: 2

values.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,41 @@ web:
24712471
##
24722472
tls:
24732473

2474+
## Route configuration
2475+
## Ref: https://gateway-api.sigs.k8s.io/api-types/httproute/
2476+
##
2477+
route:
2478+
2479+
## Enable HTTPRoutes
2480+
##
2481+
enabled: false
2482+
2483+
## Label to be added to the web route.
2484+
## Example:
2485+
## my.label: my-label-value
2486+
##
2487+
labels: {}
2488+
2489+
## Annotations to be added to the web route.
2490+
## Example:
2491+
## my.annotation: my-annotation-value
2492+
##
2493+
annotations: {}
2494+
2495+
## Gateway API Parent Refs
2496+
## Example
2497+
## - name: envoy
2498+
## namespace: networking
2499+
## sectionName: https
2500+
## group: gateway.networking.k8s.io
2501+
## kind: Gateway
2502+
parentRefs: []
2503+
2504+
## Hosts to attach to the HTTPRoute
2505+
## Example:
2506+
## - "concourse.example.com"
2507+
hostnames: []
2508+
24742509
## Configuration values for Concourse Worker components.
24752510
## For more information regarding the characteristics of
24762511
## Concourse Workers, see https://concourse-ci.org/concourse-worker.html
@@ -2697,6 +2732,17 @@ worker:
26972732
##
26982733
terminationGracePeriodSeconds: 60
26992734

2735+
## Controls how PVCs are deleted during the lifecycle of a StatefulSet (requires Kubernetes 1.32+)
2736+
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
2737+
##
2738+
## "Retain" is default functionality.
2739+
## "Delete" whenDeleted - all PVCs are deleted after their Pods have been deleted
2740+
## "Delete" whenScaled - only PVCs are deleted when corresponding pod being scaled down is deleted
2741+
##
2742+
persistentVolumeClaimRetentionPolicy:
2743+
whenDeleted: Retain
2744+
whenScaled: Retain
2745+
27002746
## Strategy for StatefulSet updates (requires Kubernetes 1.6+)
27012747
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset
27022748
##

0 commit comments

Comments
 (0)