Skip to content

Commit

Permalink
feat(helm): Add registry-mirror configuration (#2)
Browse files Browse the repository at this point in the history
* feat(helm): Add registry-mirror configuration

* fix(values): Modify values

* feat(values): Remove XDG_CONFIG_HOME env variable

* feat(helm): Apply comments

* feat: Bump chart to 0.2.0
  • Loading branch information
Balsir authored Jan 14, 2025
1 parent aaa26a9 commit d1455cc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/bitbucket-runner-autoscaler/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Chart for deploying Bitbucket Runner Autoscaler.

type: application

version: 0.1.0
version: 0.2.0
appVersion: 3.7.0

maintainers:
Expand Down
12 changes: 10 additions & 2 deletions charts/bitbucket-runner-autoscaler/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# bitbucket-runner-autoscaler


Chart for deploying Bitbucket Runner Autoscaler.

![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: 3.7.0](https://img.shields.io/badge/AppVersion-3.7.0-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.7.0](https://img.shields.io/badge/AppVersion-3.7.0-informational?style=flat-square)

## About
bitbucket-runner-autoscaler Helm chart
Expand Down Expand Up @@ -66,10 +67,12 @@ bitbucket-runner-autoscaler Helm chart
| runner.config.groups[0].parameters.scale_up_threshold | float | `0.5` | |
| runner.config.groups[0].strategy | string | `"percentageRunnersIdle"` | |
| runner.config.groups[0].workspace | string | `""` | |
| runner.dind.daemonConfigFile | string | `"/etc/docker/daemon.json"` | |
| runner.dind.image.pullPolicy | string | `"IfNotPresent"` | |
| runner.dind.image.registry | string | `"docker.io"` | |
| runner.dind.image.repository | string | `"docker"` | |
| runner.dind.image.tag | string | `"dind"` | |
| runner.dind.registryMirrors | list | `[]` | |
| runner.image.pullPolicy | string | `"IfNotPresent"` | |
| runner.image.registry | string | `"docker-public.packages.atlassian.com"` | |
| runner.image.repository | string | `"sox/atlassian/bitbucket-pipelines-runner"` | |
Expand All @@ -79,19 +82,24 @@ bitbucket-runner-autoscaler Helm chart
| runner.serviceAccount.annotations | object | `{}` | |
| runner.serviceAccount.create | bool | `true` | |
| runner.serviceAccount.name | string | `""` | |
| runner.template.job | string | `"apiVersion: batch/v1\nkind: Job\nmetadata:\n name: runner-<%runner_uuid%> # mandatory, don't modify\nspec:\n template:\n metadata:\n labels:\n customer: shared\n account_uuid: <%account_uuid%> # mandatory, don't modify\n runner_uuid: <%runner_uuid%> # mandatory, don't modify\n {%- if repository_uuid %}\n repository_uuid: <%repository_uuid%> # mandatory, don't modify\n {%- endif %}\n runner_namespace: <%runner_namespace%> # mandatory, don't modify\n spec:\n tolerations: {{ include \"bitbucketRunnerAutoscaler.runnerTolerations\" . | nindent 16 }}\n nodeSelector: {{ include \"bitbucketRunnerAutoscaler.runnerNodeSelector\" . | nindent 16 }}\n topologySpreadConstraints: {{ .Values.runner.topologySpreadConstraints | toYaml | nindent 16 }}\n affinity: {{ .Values.runner.affinity | toYaml | nindent 16 }}\n priorityClassName: {{ .Values.runner.priorityClassName }}\n serviceAccountName: {{ include \"bitbucketRunnerAutoscaler.fullname\" . }}-runner\n containers:\n - name: runner\n image: {{ include \"bitbucketRunnerAutoscaler.runnerImage\" . }} # This autoscaler needs the runner image to run, you can use the latest or pin any version you want.\n imagePullPolicy: {{ .Values.runner.image.pullPolicy }}\n resources: # This is memory and cpu resources section that you can configure via config map settings file.\n requests:\n memory: \"<%requests_memory%>\" # mandatory, don't modify\n cpu: \"<%requests_cpu%>\" # mandatory, don't modify\n limits:\n memory: \"<%limits_memory%>\" # mandatory, don't modify\n cpu: \"<%limits_cpu%>\" # mandatory, don't modify\n env:\n - name: ACCOUNT_UUID # mandatory, don't modify\n value: \"{<%account_uuid%>}\" # mandatory, don't modify\n {%- if repository_uuid %}\n - name: REPOSITORY_UUID # mandatory, don't modify\n value: \"{<%repository_uuid%>}\" # mandatory, don't modify\n {%- endif %}\n - name: RUNNER_UUID # mandatory, don't modify\n value: \"{<%runner_uuid%>}\" # mandatory, don't modify\n - name: OAUTH_CLIENT_ID\n valueFrom:\n secretKeyRef:\n name: runner-oauth-credentials-<%runner_uuid%>\n key: oauth_client_id\n - name: OAUTH_CLIENT_SECRET\n valueFrom:\n secretKeyRef:\n name: runner-oauth-credentials-<%runner_uuid%>\n key: oauth_client_secret\n - name: WORKING_DIRECTORY\n value: \"/tmp\"\n volumeMounts:\n - name: tmp\n mountPath: /tmp\n - name: docker-containers\n mountPath: /var/lib/docker/containers\n readOnly: true\n - name: var-run\n mountPath: /var/run\n - name: docker\n image: {{ include \"bitbucketRunnerAutoscaler.dindImage\" . }}\n imagePullPolicy: {{ .Values.runner.dind.image.pullPolicy }}\n securityContext:\n privileged: true\n volumeMounts:\n - name: tmp\n mountPath: /tmp\n - name: docker-containers\n mountPath: /var/lib/docker/containers\n - name: var-run\n mountPath: /var/run\n restartPolicy: OnFailure\n volumes:\n - name: tmp\n - name: docker-containers\n - name: var-run\n backoffLimit: 6\n completions: 1\n parallelism: 1\n"` | |
| runner.template.job | string | `"apiVersion: batch/v1\nkind: Job\nmetadata:\n name: runner-<%runner_uuid%> # mandatory, don't modify\nspec:\n template:\n metadata:\n labels:\n customer: shared\n account_uuid: <%account_uuid%> # mandatory, don't modify\n runner_uuid: <%runner_uuid%> # mandatory, don't modify\n {%- if repository_uuid %}\n repository_uuid: <%repository_uuid%> # mandatory, don't modify\n {%- endif %}\n runner_namespace: <%runner_namespace%> # mandatory, don't modify\n spec:\n tolerations: {{ include \"bitbucketRunnerAutoscaler.runnerTolerations\" . | nindent 16 }}\n nodeSelector: {{ include \"bitbucketRunnerAutoscaler.runnerNodeSelector\" . | nindent 16 }}\n topologySpreadConstraints: {{ .Values.runner.topologySpreadConstraints | toYaml | nindent 16 }}\n affinity: {{ .Values.runner.affinity | toYaml | nindent 16 }}\n priorityClassName: {{ .Values.runner.priorityClassName }}\n serviceAccountName: {{ include \"bitbucketRunnerAutoscaler.fullname\" . }}-runner\n containers:\n - name: runner\n image: {{ include \"bitbucketRunnerAutoscaler.runnerImage\" . }} # This autoscaler needs the runner image to run, you can use the latest or pin any version you want.\n imagePullPolicy: {{ .Values.runner.image.pullPolicy }}\n resources: # This is memory and cpu resources section that you can configure via config map settings file.\n requests:\n memory: \"<%requests_memory%>\" # mandatory, don't modify\n cpu: \"<%requests_cpu%>\" # mandatory, don't modify\n limits:\n memory: \"<%limits_memory%>\" # mandatory, don't modify\n cpu: \"<%limits_cpu%>\" # mandatory, don't modify\n env:\n - name: ACCOUNT_UUID # mandatory, don't modify\n value: \"{<%account_uuid%>}\" # mandatory, don't modify\n {%- if repository_uuid %}\n - name: REPOSITORY_UUID # mandatory, don't modify\n value: \"{<%repository_uuid%>}\" # mandatory, don't modify\n {%- endif %}\n - name: RUNNER_UUID # mandatory, don't modify\n value: \"{<%runner_uuid%>}\" # mandatory, don't modify\n - name: OAUTH_CLIENT_ID\n valueFrom:\n secretKeyRef:\n name: runner-oauth-credentials-<%runner_uuid%>\n key: oauth_client_id\n - name: OAUTH_CLIENT_SECRET\n valueFrom:\n secretKeyRef:\n name: runner-oauth-credentials-<%runner_uuid%>\n key: oauth_client_secret\n - name: WORKING_DIRECTORY\n value: \"/tmp\"\n volumeMounts:\n - name: tmp\n mountPath: /tmp\n - name: docker-containers\n mountPath: /var/lib/docker/containers\n readOnly: true\n - name: var-run\n mountPath: /var/run\n - name: docker\n image: {{ include \"bitbucketRunnerAutoscaler.dindImage\" . }}\n imagePullPolicy: {{ .Values.runner.dind.image.pullPolicy }}\n securityContext:\n privileged: true\n volumeMounts:\n - name: tmp\n mountPath: /tmp\n - name: docker-containers\n mountPath: /var/lib/docker/containers\n - name: var-run\n mountPath: /var/run\n {{- if .Values.runner.dind.registryMirrors }}\n - name: dind\n mountPath: {{ .Values.runner.dind.daemonConfigFile }}\n subPath: daemon.json\n {{- end }}\n restartPolicy: OnFailure\n volumes:\n - name: tmp\n - name: docker-containers\n - name: var-run\n {{- if .Values.runner.dind.registryMirrors }}\n - name: dind\n configMap:\n name: {{ include \"bitbucketRunnerAutoscaler.fullname\" . }}-dind\n {{- end }}\n backoffLimit: 6\n completions: 1\n parallelism: 1\n"` | |
| runner.template.secret | string | `"apiVersion: v1\nkind: Secret\nmetadata:\n name: runner-oauth-credentials-<%runner_uuid%> # mandatory, don't modify\n labels:\n account_uuid: <%account_uuid%> # mandatory, don't modify\n{%- if repository_uuid %}\n repository_uuid: <%repository_uuid%> # mandatory, don't modify\n{%- endif %}\n runner_uuid: <%runner_uuid%> # mandatory, don't modify\n runner_namespace: <%runner_namespace%> # mandatory, don't modify\ndata:\n oauth_client_id: <%oauth_client_id_base64%>\n oauth_client_secret: <%oauth_client_secret_base64%>\n"` | |
| runner.tolerations | list | `[]` | |
| runner.topologySpreadConstraints | list | `[]` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |





## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Labyrinth Labs | <[email protected]> | <https://lablabs.io> |


----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
18 changes: 18 additions & 0 deletions charts/bitbucket-runner-autoscaler/templates/configmap-dind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.runner.dind.registryMirrors }}
{{- include "bitbucketRunnerAutoscaler.runnerNamespaces" . }}
{{- range $namespace := .RunnerNamespaces }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "bitbucketRunnerAutoscaler.fullname" $ }}-dind
namespace: {{ $namespace }}
labels:
{{- include "bitbucketRunnerAutoscaler.labels" $ | nindent 4 }}
data:
daemon.json: |
{
"registry-mirrors": {{ $.Values.runner.dind.registryMirrors | toJson }}
}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/bitbucket-runner-autoscaler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ runner:
repository: docker
tag: dind
pullPolicy: IfNotPresent
registryMirrors: [] # e.g. registryMirrors: ["https://mirror.gcr.io"]
daemonConfigFile: /etc/docker/daemon.json

tolerations: []
# only amd64 is supported for Kubernetes deployments, docs: https://bitbucket.org/bitbucketpipelines/runners-autoscaler/src/master/
Expand Down Expand Up @@ -177,11 +179,21 @@ runner:
mountPath: /var/lib/docker/containers
- name: var-run
mountPath: /var/run
{{- if .Values.runner.dind.registryMirrors }}
- name: dind
mountPath: {{ .Values.runner.dind.daemonConfigFile }}
subPath: daemon.json
{{- end }}
restartPolicy: OnFailure
volumes:
- name: tmp
- name: docker-containers
- name: var-run
{{- if .Values.runner.dind.registryMirrors }}
- name: dind
configMap:
name: {{ include "bitbucketRunnerAutoscaler.fullname" . }}-dind
{{- end }}
backoffLimit: 6
completions: 1
parallelism: 1
Expand Down

0 comments on commit d1455cc

Please sign in to comment.