Skip to content

Commit fda1233

Browse files
feat(builder): use cf dind (#118)
1 parent f0e5b44 commit fda1233

File tree

3 files changed

+21
-58
lines changed

3 files changed

+21
-58
lines changed

charts/builder/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
description: Helm Chart for default system/root runtime Builder (onprem)
33
name: builder
4-
version: 1.4.0
4+
version: 2.0.0
55
keywords:
66
- codefresh
77
- dind

charts/builder/README.md

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

3-
![Version: 1.4.0](https://img.shields.io/badge/Version-1.4.0-informational?style=flat-square)
3+
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square)
44

55
Helm Chart for default system/root runtime Builder (onprem)
66

@@ -23,33 +23,28 @@ Helm Chart for default system/root runtime Builder (onprem)
2323
| Key | Type | Default | Description |
2424
|-----|------|---------|-------------|
2525
| affinity | object | `{}` | |
26-
| cleaner.image.pullPolicy | string | `"IfNotPresent"` | |
27-
| cleaner.image.registry | string | `"quay.io"` | |
28-
| cleaner.image.repository | string | `"codefresh/docker-cleaner"` | |
29-
| cleaner.image.tag | string | `"24.0"` | |
3026
| configMaps.config.data."daemon.json" | string | `"{\n \"hosts\": [ \"unix:///var/run/docker.sock\",\n \"tcp://0.0.0.0:{{ .Values.service.main.ports.dind.port }}\"],\n \"storage-driver\": \"overlay2\",\n \"tlsverify\": true,\n \"tls\": true,\n \"tlscacert\": \"/etc/ssl/cf/ca.pem\",\n \"tlscert\": \"/etc/ssl/cf/cert.pem\",\n \"tlskey\": \"/etc/ssl/cf/key.pem\",\n \"insecure-registries\" : [ {{- range $i, $e := .Values.insecureRegistries }} {{- if $i }},{{ end }} {{ $e | quote }} {{- end }} ]\n}\n"` | |
31-
| configMaps.config.data.docker-cleaner | string | `"#!/bin/sh\necho \"$0 - $(date)\" | tee -a /var/log/cleaner.log\nCLEANER_IMAGE={{ include (printf \"cf-common-%s.image.name\" (index .Subcharts \"cf-common\").Chart.Version ) (dict \"image\" .Values.cleaner.image \"context\" .) }}\ndocker pull $CLEANER_IMAGE\ndocker run --rm --name rt-cleaner -v /var/run/docker.sock:/var/run/docker.sock:rw --label io.codefresh.owner=codefresh -e GRACE_PERIOD_SECONDS=86400 --cpu-shares=10 $CLEANER_IMAGE ./docker-gc >> /var/log/cleaner.log 2>&1\n"` | |
3227
| configMaps.config.data.register | string | `"#!/bin/sh\nset -e\nNODE_NAME=\"$1\"\nSUBDOMAIN=\"$2\"\nNODE_ADDRESS=\"$1.$2\"\nCONSUL={{ include (printf \"cf-common-%s.classic.calculateConsulUri\" (index .Subcharts \"cf-common\").Chart.Version ) . }}\nACCOUNT=codefresh\nROLE=builder\nPROVIDER='\n{\n \"name\": \"kube-nodes\",\n \"type\": \"internal\"\n}'\nSYSTEM_DATA='{\"os_name\": \"dind\"}'\nNODE_SERVICE='\n{\n \"Node\": \"'${NODE_NAME}'\",\n \"Address\": \"'${NODE_ADDRESS}'\",\n \"Service\": {\n \"Service\": \"docker-node\",\n \"Tags\": [\n \"dind\",\n \"noagent\",\n \"account_codefresh\",\n \"type_builder\"\n ],\n \"Address\": \"'${NODE_ADDRESS}'\",\n \"Port\": {{ .Values.service.main.ports.dind.port }}\n },\n \"Check\": {\n \"Node\": \"\",\n \"CheckID\": \"service:docker-node\",\n \"Name\": \"Remote Node Check\",\n \"Notes\": \"Check builder is up and running\",\n \"Output\": \"Builder alive and reachable\",\n \"Status\": \"passing\",\n \"ServiceID\": \"docker-node\"\n }\n}'\necho \"Registering dind node ($NODE_NAME) in consul. Configuration: ${NODE_SERVICE}\"\ncurl -X PUT -d \"${NODE_SERVICE}\" ${CONSUL}/v1/catalog/register\ncurl -X PUT -d \"${NODE_ADDRESS}\" ${CONSUL}/v1/kv/services/docker-node/${NODE_NAME}/publicAddress\ncurl -X PUT -d \"${ACCOUNT}\" ${CONSUL}/v1/kv/services/docker-node/${NODE_NAME}/account\ncurl -X PUT -d \"${ROLE}\" ${CONSUL}/v1/kv/services/docker-node/${NODE_NAME}/role\ncurl -X PUT -d \"${PROVIDER}\" ${CONSUL}/v1/kv/services/docker-node/${NODE_NAME}/systemData\ncurl -X PUT -d \"${SYSTEM_DATA}\" ${CONSUL}/v1/kv/services/docker-node/${NODE_NAME}/provider\n"` | |
3328
| configMaps.config.enabled | bool | `true` | |
3429
| container.command[0] | string | `"/bin/sh"` | |
3530
| container.command[1] | string | `"-c"` | |
36-
| container.command[2] | string | `"rm -fv /var/run/docker.pid\nmkdir -p /var/run/codefresh\n# Adding cleaner\ncp -L /opt/dind/docker-cleaner.sh /usr/local/bin/ && chmod +x /usr/local/bin/docker-cleaner.sh\nif [[ -n \"${DOCKER_CLEANER_CRON}\" ]]; then\n echo \"Set /etc/crontabs/root - ${DOCKER_CLEANER_CRON} /usr/local/bin/docker-cleaner.sh\"\n echo \"${DOCKER_CLEANER_CRON} /usr/local/bin/docker-cleaner.sh \" >> /etc/crontabs/root\n crond\nfi\ndockerd\n"` | |
31+
| container.command[2] | string | `"./run.sh\n"` | |
3732
| container.containerSecurityContext.privileged | bool | `true` | |
38-
| container.env.DOCKER_CLEANER_CRON | string | `"0 0 * * *"` | |
33+
| container.env.CLEAN_DOCKER | string | `"true"` | |
3934
| container.image.pullPolicy | string | `"IfNotPresent"` | |
40-
| container.image.registry | string | `"docker.io"` | |
41-
| container.image.repository | string | `"docker"` | |
42-
| container.image.tag | string | `"24.0-dind"` | |
35+
| container.image.registry | string | `"quay.io"` | |
36+
| container.image.repository | string | `"codefresh/dind"` | |
37+
| container.image.tag | string | `"26.1.4-1.28.8"` | |
4338
| container.resources.limits | object | `{}` | |
4439
| container.resources.requests | object | `{}` | |
4540
| container.volumeMounts.cf-certs.path[0].mountPath | string | `"/etc/ssl/cf"` | |
4641
| container.volumeMounts.cf-certs.path[0].readOnly | bool | `true` | |
4742
| container.volumeMounts.config.path[0].mountPath | string | `"/etc/docker/daemon.json"` | |
4843
| container.volumeMounts.config.path[0].readOnly | bool | `true` | |
4944
| container.volumeMounts.config.path[0].subPath | string | `"daemon.json"` | |
50-
| container.volumeMounts.config.path[1].mountPath | string | `"/opt/dind/docker-cleaner.sh"` | |
51-
| container.volumeMounts.config.path[1].subPath | string | `"docker-cleaner"` | |
52-
| controller | object | `{"enabled":true,"replicas":1,"type":"statefulset"}` | --------------------------------------------------------------------------------------------------------------------- |
45+
| controller.enabled | bool | `true` | |
46+
| controller.replicas | int | `1` | |
47+
| controller.type | string | `"statefulset"` | |
5348
| global.consulHost | string | `""` | |
5449
| global.consulHttpPort | int | `8500` | |
5550
| global.consulService | string | `"consul-headless"` | |
@@ -68,7 +63,7 @@ Helm Chart for default system/root runtime Builder (onprem)
6863
| initContainers.register.image.tag | string | `"8.4.0"` | |
6964
| initContainers.register.volumeMounts.config.path[0].mountPath | string | `"/opt/dind/register"` | |
7065
| initContainers.register.volumeMounts.config.path[0].subPath | string | `"register"` | |
71-
| insecureRegistries | list | `[]` | --------------------------------------------------------------------------------------------------------------------- Backward compatibility with values/templates in cf-helm |
66+
| insecureRegistries | list | `[]` | |
7267
| nodeSelector | object | `{}` | |
7368
| pdb | object | `{}` | |
7469
| podAnnotations.checksum/config | string | `"{{ include (print .Template.BasePath \"/configmap.yaml\") . | sha256sum }}"` | |
@@ -83,6 +78,7 @@ Helm Chart for default system/root runtime Builder (onprem)
8378
| tolerations | list | `[]` | |
8479
| topologySpreadConstraints | list | `[]` | |
8580
| varLibDockerVolume.accessMode | string | `nil` | |
81+
| varLibDockerVolume.storageClass | string | `nil` | |
8682
| varLibDockerVolume.storageSize | string | `nil` | |
8783
| volumeClaimTemplates.varlibdocker.accessMode | string | `"ReadWriteOnce"` | |
8884
| volumeClaimTemplates.varlibdocker.mountPath | string | `"/var/lib/docker"` | |

charts/builder/values.yaml

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,16 @@
22
global:
33
imageRegistry: ""
44

5-
# Backward compatibility with values/templates in cf-helm
6-
# These values are defined in cf-helm `values.yaml/secrets.yaml`. But listing them here for verbosity.
75
consulHost: ""
86
consulService: consul-headless
97
consulHttpPort: 8500
108

11-
# -----------------------------------------------------------------------------------------------------------------------
12-
# LEGACY VALUES
13-
# -----------------------------------------------------------------------------------------------------------------------
14-
15-
# Backward compatibility with values/templates in cf-helm
169
insecureRegistries: []
17-
cleaner:
18-
image:
19-
registry: quay.io
20-
repository: codefresh/docker-cleaner
21-
tag: "24.0"
22-
pullPolicy: IfNotPresent
10+
2311
varLibDockerVolume:
2412
accessMode:
2513
storageSize:
26-
27-
# -----------------------------------------------------------------------------------------------------------------------
28-
# NEW VALUES
29-
# -----------------------------------------------------------------------------------------------------------------------
14+
storageClass:
3015

3116
controller:
3217
enabled: true
@@ -61,40 +46,29 @@ rbac:
6146

6247
container:
6348
image:
64-
registry: docker.io
65-
repository: docker
66-
tag: 24.0-dind
49+
registry: quay.io
50+
repository: codefresh/dind
51+
tag: 26.1.4-1.28.8
6752
pullPolicy: IfNotPresent
6853

6954
command:
7055
- "/bin/sh"
7156
- "-c"
7257
- |
73-
rm -fv /var/run/docker.pid
74-
mkdir -p /var/run/codefresh
75-
# Adding cleaner
76-
cp -L /opt/dind/docker-cleaner.sh /usr/local/bin/ && chmod +x /usr/local/bin/docker-cleaner.sh
77-
if [[ -n "${DOCKER_CLEANER_CRON}" ]]; then
78-
echo "Set /etc/crontabs/root - ${DOCKER_CLEANER_CRON} /usr/local/bin/docker-cleaner.sh"
79-
echo "${DOCKER_CLEANER_CRON} /usr/local/bin/docker-cleaner.sh " >> /etc/crontabs/root
80-
crond
81-
fi
82-
dockerd
58+
./run.sh
59+
60+
env:
61+
CLEAN_DOCKER: "true"
8362

8463
containerSecurityContext:
8564
privileged: true
8665

87-
env:
88-
DOCKER_CLEANER_CRON: "0 0 * * *"
89-
9066
volumeMounts:
9167
config:
9268
path:
9369
- mountPath: /etc/docker/daemon.json
9470
readOnly: true
9571
subPath: daemon.json
96-
- mountPath: /opt/dind/docker-cleaner.sh
97-
subPath: docker-cleaner
9872
cf-certs:
9973
path:
10074
- mountPath: /etc/ssl/cf
@@ -138,13 +112,6 @@ configMaps:
138112
"insecure-registries" : [ {{- range $i, $e := .Values.insecureRegistries }} {{- if $i }},{{ end }} {{ $e | quote }} {{- end }} ]
139113
}
140114
141-
docker-cleaner: |
142-
#!/bin/sh
143-
echo "$0 - $(date)" | tee -a /var/log/cleaner.log
144-
CLEANER_IMAGE={{ include (printf "cf-common-%s.image.name" (index .Subcharts "cf-common").Chart.Version ) (dict "image" .Values.cleaner.image "context" .) }}
145-
docker pull $CLEANER_IMAGE
146-
docker run --rm --name rt-cleaner -v /var/run/docker.sock:/var/run/docker.sock:rw --label io.codefresh.owner=codefresh -e GRACE_PERIOD_SECONDS=86400 --cpu-shares=10 $CLEANER_IMAGE ./docker-gc >> /var/log/cleaner.log 2>&1
147-
148115
register: |
149116
#!/bin/sh
150117
set -e

0 commit comments

Comments
 (0)