-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from lablabs/dev
feat(helm): add helm chart for bitbucket runners
- Loading branch information
Showing
25 changed files
with
811 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
8 changes: 3 additions & 5 deletions
8
charts/chart-name/Chart.yaml → ...ts/bitbucket-runner-autoscaler/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# 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) | ||
|
||
## About | ||
bitbucket-runner-autoscaler Helm chart | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| cleaner.affinity | object | `{}` | | | ||
| cleaner.create | bool | `true` | | | ||
| cleaner.image.pullPolicy | string | `"IfNotPresent"` | | | ||
| cleaner.image.registry | string | `"docker.io"` | | | ||
| cleaner.image.repository | string | `"bitbucketpipelines/runners-autoscaler"` | | | ||
| cleaner.image.tag | string | `"3.7.0"` | | | ||
| cleaner.nodeSelector | object | `{}` | | | ||
| cleaner.pdb.enabled | bool | `false` | | | ||
| cleaner.pdb.minAvailable | int | `1` | | | ||
| cleaner.podLabels | object | `{}` | | | ||
| cleaner.priorityClassName | string | `""` | | | ||
| cleaner.replicas | int | `1` | | | ||
| cleaner.tolerations | list | `[]` | | | ||
| cleaner.topologySpreadConstraints | list | `[]` | | | ||
| controller.affinity | object | `{}` | | | ||
| controller.create | bool | `true` | | | ||
| controller.image.pullPolicy | string | `"IfNotPresent"` | | | ||
| controller.image.registry | string | `"docker.io"` | | | ||
| controller.image.repository | string | `"bitbucketpipelines/runners-autoscaler"` | | | ||
| controller.image.tag | string | `"3.7.0"` | | | ||
| controller.nodeSelector | object | `{}` | | | ||
| controller.pdb.enabled | bool | `false` | | | ||
| controller.pdb.minAvailable | int | `1` | | | ||
| controller.podLabels | object | `{}` | | | ||
| controller.priorityClassName | string | `""` | | | ||
| controller.replicas | int | `1` | | | ||
| controller.tolerations | list | `[]` | | | ||
| controller.topologySpreadConstraints | list | `[]` | | | ||
| credentialsSecret.bitbucketAppPassword | string | `""` | | | ||
| credentialsSecret.bitbucketUsername | string | `""` | | | ||
| credentialsSecret.create | bool | `true` | | | ||
| credentialsSecret.name | string | `""` | | | ||
| extraManifests | list | `[]` | | | ||
| fullnameOverride | string | `""` | | | ||
| global.commonLabels | object | `{}` | | | ||
| global.nodeSelector | object | `{}` | | | ||
| global.tolerations | list | `[]` | | | ||
| nameOverride | string | `""` | | | ||
| rbac.create | bool | `true` | | | ||
| runner.affinity | object | `{}` | | | ||
| runner.config.constants.default_sleep_time_runner_delete | int | `5` | | | ||
| runner.config.constants.default_sleep_time_runner_setup | int | `10` | | | ||
| runner.config.constants.runner_api_polling_interval | int | `600` | | | ||
| runner.config.constants.runner_cool_down_period | int | `300` | | | ||
| runner.config.groups[0].labels[0] | string | `"my.group"` | | | ||
| runner.config.groups[0].name | string | `"default"` | | | ||
| runner.config.groups[0].namespace | string | `"bitbucket-runner"` | | | ||
| runner.config.groups[0].parameters.max | int | `10` | | | ||
| runner.config.groups[0].parameters.min | int | `1` | | | ||
| runner.config.groups[0].parameters.scale_down_multiplier | float | `0.5` | | | ||
| runner.config.groups[0].parameters.scale_down_threshold | float | `0.2` | | | ||
| runner.config.groups[0].parameters.scale_up_multiplier | float | `1.5` | | | ||
| 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.image.pullPolicy | string | `"IfNotPresent"` | | | ||
| runner.dind.image.registry | string | `"docker.io"` | | | ||
| runner.dind.image.repository | string | `"docker"` | | | ||
| runner.dind.image.tag | string | `"dind"` | | | ||
| runner.image.pullPolicy | string | `"IfNotPresent"` | | | ||
| runner.image.registry | string | `"docker-public.packages.atlassian.com"` | | | ||
| runner.image.repository | string | `"sox/atlassian/bitbucket-pipelines-runner"` | | | ||
| runner.image.tag | string | `"1"` | | | ||
| runner.nodeSelector | object | `{}` | | | ||
| runner.priorityClassName | string | `""` | | | ||
| 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.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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
196 changes: 196 additions & 0 deletions
196
charts/bitbucket-runner-autoscaler/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{- define "bitbucketRunnerAutoscaler.labels" -}} | ||
{{- $name := include "bitbucketRunnerAutoscaler.name" . -}} | ||
{{- $labels := dict -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/name" $name) -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/instance" .Release.Name) -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/managed-by" .Release.Service) -}} | ||
{{- if .Chart.AppVersion }} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/version" .Chart.AppVersion) -}} | ||
{{- end }} | ||
{{- if .Values.global.commonLabels }} | ||
{{- $labels = merge $labels .Values.global.commonLabels -}} | ||
{{- end }} | ||
{{- toYaml $labels -}} | ||
{{- end }} | ||
|
||
{{- define "bitbucketRunnerAutoscaler.podLabels" -}} | ||
{{- $component := .component -}} | ||
{{- $context := .context -}} | ||
{{- $labels := include "bitbucketRunnerAutoscaler.labels" $context | fromYaml -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/component" $component) -}} | ||
{{- $componentValues := index $context.Values $component -}} | ||
{{- if $componentValues.podLabels }} | ||
{{- $labels = merge $labels $componentValues.podLabels -}} | ||
{{- end }} | ||
{{- toYaml $labels }} | ||
{{- end }} | ||
|
||
{{- define "bitbucketRunnerAutoscaler.selectorLabels" -}} | ||
{{- $component := .component -}} | ||
{{- $context := .context -}} | ||
{{- $labels := dict -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/name" (include "bitbucketRunnerAutoscaler.name" $context)) -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/instance" $context.Release.Name) -}} | ||
{{- $labels = merge $labels (dict "app.kubernetes.io/component" $component) -}} | ||
{{- toYaml $labels -}} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "bitbucketRunnerAutoscaler.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the bitbucket secret to use | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.secretName" -}} | ||
{{- if .Values.credentialsSecret.create }} | ||
{{- default (include "bitbucketRunnerAutoscaler.fullname" .) .Values.credentialsSecret.name }} | ||
{{- else }} | ||
{{- default "default" .Values.credentialsSecret.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define tolerations to be used for cleaner service | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.cleanerTolerations" -}} | ||
{{- $tolerations := .Values.cleaner.tolerations | default .Values.global.tolerations | default (list) }} | ||
{{- toYaml $tolerations }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define node selector for cleanup service | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.cleanerNodeSelector" -}} | ||
{{- $nodeSelector := .Values.cleaner.nodeSelector | default .Values.global.nodeSelector | default (dict) }} | ||
{{- toYaml $nodeSelector }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define tolerations to be used for controller service | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.controllerTolerations" -}} | ||
{{- $tolerations := .Values.controller.tolerations | default .Values.global.tolerations | default (list) }} | ||
{{- toYaml $tolerations }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define node selector for controller service | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.controllerNodeSelector" -}} | ||
{{- $nodeSelector := .Values.controller.nodeSelector | default .Values.global.nodeSelector | default (dict) }} | ||
{{- toYaml $nodeSelector }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define runner tolerations | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.runnerTolerations" -}} | ||
{{- $tolerations := .Values.runner.tolerations | default (list) }} | ||
{{- toYaml $tolerations }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define runner node selector | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.runnerNodeSelector" -}} | ||
{{- $nodeSelector := .Values.runner.nodeSelector | default (dict) }} | ||
{{- toYaml $nodeSelector }} | ||
{{- end }} | ||
|
||
{{/* | ||
Return the controller image name | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.controllerImage" -}} | ||
{{- $registryName := .Values.controller.image.registry -}} | ||
{{- $repositoryName := .Values.controller.image.repository -}} | ||
{{- $tag := .Values.controller.image.tag | toString -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the cleaner image name | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.cleanerImage" -}} | ||
{{- $registryName := .Values.cleaner.image.registry -}} | ||
{{- $repositoryName := .Values.cleaner.image.repository -}} | ||
{{- $tag := .Values.cleaner.image.tag | toString -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the runner image name | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.runnerImage" -}} | ||
{{- $registryName := .Values.runner.image.registry -}} | ||
{{- $repositoryName := .Values.runner.image.repository -}} | ||
{{- $tag := .Values.runner.image.tag | toString -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the dind image name | ||
*/}} | ||
{{- define "bitbucketRunnerAutoscaler.dindImage" -}} | ||
{{- $registryName := .Values.runner.dind.image.registry -}} | ||
{{- $repositoryName := .Values.runner.dind.image.repository -}} | ||
{{- $tag := .Values.runner.dind.image.tag | toString -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
|
||
{{- define "bitbucketRunnerAutoscaler.pdbName" -}} | ||
{{- $component := .component -}} | ||
{{- $context := .context -}} | ||
{{- printf "%s-%s-pdb" (include "bitbucketRunnerAutoscaler.fullname" $context) $component -}} | ||
{{- end }} | ||
|
||
{{- define "bitbucketRunnerAutoscaler.runnerNamespaces" -}} | ||
{{- $allNamespaces := list }} | ||
{{- range .Values.runner.config.groups }} | ||
{{- if eq .namespace $.Release.Namespace }} | ||
{{- fail (printf "Runner namespace '%s' cannot be the same as the operator namespace '%s'" .namespace $.Release.Namespace) }} | ||
{{- end }} | ||
{{- $allNamespaces = append $allNamespaces .namespace -}} | ||
{{- end }} | ||
{{- $uniqueNamespaces := uniq $allNamespaces }} | ||
{{- $_ := set . "RunnerNamespaces" $uniqueNamespaces }} | ||
{{- end }} |
Oops, something went wrong.