Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(acp) allow specifying annotations for ACP Service #1257

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/artifact-caching-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
description: artifact-caching-proxy is a Nginx caching proxy in front of repo.jenkins-ci.org
name: artifact-caching-proxy
type: application
version: 1.5.2
version: 1.6.0
4 changes: 4 additions & 0 deletions charts/artifact-caching-proxy/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: {{ include "artifact-caching-proxy.fullname" . }}
labels:
{{- include "artifact-caching-proxy.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
33 changes: 33 additions & 0 deletions charts/artifact-caching-proxy/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ templates:
- statefulset.yaml
- nginx-default-configmap.yaml
- nginx-proxy-configmap.yaml
- service.yaml
tests:
- it: Should set a custom env and envFrom when specified by values
template: statefulset.yaml
Expand Down Expand Up @@ -187,3 +188,35 @@ tests:
- equal:
path: spec.selector.matchLabels['app.kubernetes.io/name']
value: "artifact-caching-proxy"

- it: should generate a custom service with specified values
template: service.yaml
set:
service:
type: LoadBalancer
annotations:
foo.bar/something: hello
foo.bar/other: 12
asserts:
- hasDocuments:
count: 1
- isKind:
of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-artifact-caching-proxy
- equal:
path: metadata.annotations["foo.bar/something"]
value: hello
- equal:
path: metadata.annotations["foo.bar/other"]
value: 12
- equal:
path: spec.type
value: LoadBalancer
- equal:
path: spec.ports[0].port
value: 8080
- equal:
path: spec.ports[0].targetPort
value: http
25 changes: 25 additions & 0 deletions charts/artifact-caching-proxy/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ templates:
- nginx-default-configmap.yaml
- statefulset.yaml
- pdb.yaml
- service.yaml
tests:
- it: should not generate any ingress with default values
template: ingress.yaml
Expand Down Expand Up @@ -86,3 +87,27 @@ tests:
asserts:
- hasDocuments:
count: 0
- it: should generate a ClusterIP service with defaults
template: service.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Service
- equal:
path: metadata.name
value: RELEASE-NAME-artifact-caching-proxy
- equal:
path: metadata.labels["app.kubernetes.io/name"]
value: artifact-caching-proxy
- notExists:
path: metadata.annotations
- equal:
path: spec.type
value: ClusterIP
- equal:
path: spec.ports[0].port
value: 8080
- equal:
path: spec.ports[0].targetPort
value: http