Skip to content

Commit 3e2d1e6

Browse files
committed
pass config.yaml to gradle cache
1 parent d5a8a97 commit 3e2d1e6

6 files changed

Lines changed: 78 additions & 20 deletions

File tree

charts/gradle-cache/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: gradle-cache
33
description: |-
44
Helm chart to deploy [gradle-cache](https://docs.gradle.com/build-cache-node/).
55
type: application
6-
version: 0.0.15
7-
appVersion: "10.3"
6+
version: 0.1.0
7+
appVersion: "11.0"
88
home: https://github.com/slamdev/helm-charts/tree/master/charts/gradle-cache
99
icon: https://gradle.org/icon/favicon-32x32.png
1010
maintainers:

charts/gradle-cache/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# gradle-cache
22

3-
![Version: 0.0.15](https://img.shields.io/badge/Version-0.0.15-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.3](https://img.shields.io/badge/AppVersion-10.3-informational?style=flat-square)
3+
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 11.0](https://img.shields.io/badge/AppVersion-11.0-informational?style=flat-square)
44

55
Helm chart to deploy [gradle-cache](https://docs.gradle.com/build-cache-node/).
66

@@ -17,6 +17,10 @@ Helm chart to deploy [gradle-cache](https://docs.gradle.com/build-cache-node/).
1717
| Key | Type | Default | Description |
1818
|-----|------|---------|-------------|
1919
| affinity | object | `{}` | affinity for scheduler pod assignment |
20+
| args | list | `["start","--no-warn-anon-cache-write","--no-warn-anon-ui-access"]` | args to pass to the container |
21+
| configSecret.content | string | `"version: 4\ncache:\n accessControl:\n anonymousLevel: readwrite\n maxEntryAgeInHours: null\n freeSpaceBufferSize: 1024\n maxArtifactSize: 100\n targetSize:\n type: fixed\n size: 10000\nuiAccess:\n type: open"` | |
22+
| configSecret.create | bool | `true` | specifies whether a secret should be created |
23+
| configSecret.name | string | `nil` | the name of the secret to use; if not set and create is true, a name is generated using the fullname template |
2024
| env | list | `[]` | additional environment variables for the deployment |
2125
| fullnameOverride | string | `""` | full name of the chart. |
2226
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
@@ -43,5 +47,4 @@ Helm chart to deploy [gradle-cache](https://docs.gradle.com/build-cache-node/).
4347
| serviceAccount.create | bool | `false` | specifies whether a service account should be created |
4448
| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template |
4549
| tolerations | list | `[]` | tolerations for scheduler pod assignment |
46-
| volumeMounts | list | `[]` | additional volume mounts |
47-
| volumes | list | `[]` | additional volumes |
50+
| volumes | list | `[{"emptyDir":{},"name":"cache"}]` | volumes |

charts/gradle-cache/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ Create the name of the service account to use
6262
{{- end -}}
6363
{{- end -}}
6464

65+
{{/*
66+
Create the name of the config secret to use
67+
*/}}
68+
{{- define "gradle-cache.configSecretName" -}}
69+
{{- if .Values.configSecret.create -}}
70+
{{ default (include "gradle-cache.fullname" .) .Values.configSecret.name }}
71+
{{- else -}}
72+
{{ default "default" .Values.configSecret.name }}
73+
{{- end -}}
74+
{{- end -}}
75+
6576
{{/*
6677
Create the tag for the docker image to use
6778
*/}}

charts/gradle-cache/templates/deployment.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,24 @@ spec:
2222
serviceAccountName: {{ include "gradle-cache.serviceAccountName" . }}
2323
securityContext:
2424
{{- toYaml .Values.podSecurityContext | nindent 8 }}
25+
initContainers:
26+
- name: config-mounter
27+
image: busybox:1.33.0
28+
command:
29+
- sh
30+
- -ce
31+
- cp /tmp/config.yaml /data/conf/config.yaml
32+
volumeMounts:
33+
- name: tmp-build-cache-config-file
34+
mountPath: /tmp
35+
- name: cache
36+
mountPath: /data
2537
containers:
2638
- name: {{ .Chart.Name }}
2739
securityContext:
2840
{{- toYaml .Values.securityContext | nindent 12 }}
2941
image: "{{ .Values.image.repository }}:{{ include "gradle-cache.tag" . }}"
42+
args: {{ .Values.args | toYaml | nindent 12 }}
3043
imagePullPolicy: {{ .Values.image.pullPolicy }}
3144
ports:
3245
- name: http
@@ -42,14 +55,14 @@ spec:
4255
env:
4356
{{- toYaml . | nindent 12 }}
4457
{{- end }}
45-
{{- with .Values.volumeMounts }}
4658
volumeMounts:
47-
{{- toYaml . | nindent 12 }}
48-
{{- end }}
49-
{{- with .Values.volumes }}
59+
- name: cache
60+
mountPath: /data
5061
volumes:
51-
{{- toYaml . | nindent 8 }}
52-
{{- end }}
62+
- name: tmp-build-cache-config-file
63+
secret:
64+
secretName: {{ include "gradle-cache.configSecretName" . }}
65+
{{- .Values.volumes | toYaml | nindent 8 }}
5366
{{- with .Values.nodeSelector }}
5467
nodeSelector:
5568
{{- toYaml . | nindent 8 }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ include "gradle-cache.configSecretName" . }}
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
{{- include "gradle-cache.labels" . | nindent 4 }}
8+
data:
9+
config.yaml: |-
10+
{{ .Values.configSecret.content | nindent 4 }}

charts/gradle-cache/values.yaml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,32 @@ nameOverride: ""
1313
# fullnameOverride -- full name of the chart.
1414
fullnameOverride: ""
1515

16+
configSecret:
17+
# configSecret.create -- specifies whether a secret should be created
18+
create: true
19+
# configSecret.name -- the name of the secret to use; if not set and create is true, a name is generated using the fullname template
20+
name:
21+
# configSecret.content - content of 'config.yaml'
22+
content: |-
23+
version: 4
24+
cache:
25+
accessControl:
26+
anonymousLevel: readwrite
27+
maxEntryAgeInHours: null
28+
freeSpaceBufferSize: 1024
29+
maxArtifactSize: 100
30+
targetSize:
31+
type: fixed
32+
size: 10000
33+
uiAccess:
34+
type: open
35+
36+
# args -- args to pass to the container
37+
args:
38+
- start
39+
- --no-warn-anon-cache-write
40+
- --no-warn-anon-ui-access
41+
1642
serviceAccount:
1743
# serviceAccount.create -- specifies whether a service account should be created
1844
create: false
@@ -79,15 +105,10 @@ tolerations: []
79105
# affinity -- affinity for scheduler pod assignment
80106
affinity: {}
81107

82-
# volumeMounts -- additional volume mounts
83-
volumeMounts: []
84-
# - name: cache
85-
# mountPath: /data
86-
87-
# volumes -- additional volumes
88-
volumes: []
89-
# - name: cache
90-
# emptyDir: {}
108+
# volumes -- volumes
109+
volumes:
110+
- name: cache
111+
emptyDir: {}
91112

92113
livenessProbe:
93114
httpGet:

0 commit comments

Comments
 (0)