diff --git a/.github/actions/e2e-arc-test/action.yaml b/.github/actions/e2e-arc-test/action.yaml index 568a9f25..13f35861 100644 --- a/.github/actions/e2e-arc-test/action.yaml +++ b/.github/actions/e2e-arc-test/action.yaml @@ -13,7 +13,7 @@ runs: using: "composite" steps: - name: Install ARC - run: helm install arc --namespace "arc-systems" --create-namespace ./charts/actions-runner-controller-2 + run: helm install arc --namespace "arc-systems" --create-namespace ./charts/gha-runner-scale-set-controller shell: bash - name: Get datetime # We are using this value further in the runner installation to avoid runner name collision that are a risk with hard coded values. @@ -27,7 +27,7 @@ runs: --create-namespace \ --set githubConfigUrl="${{ inputs.config-url }}" \ --set githubConfigSecret.github_token="${{ inputs.github-token }}" \ - ./charts/auto-scaling-runner-set \ + ./charts/gha-runner-scale-set \ --debug kubectl get pods -A shell: bash diff --git a/.github/workflows/publish-chart.yaml b/.github/workflows/publish-chart.yaml index 69646136..aaae2828 100644 --- a/.github/workflows/publish-chart.yaml +++ b/.github/workflows/publish-chart.yaml @@ -10,8 +10,8 @@ on: - 'charts/**' - '.github/workflows/publish-chart.yaml' - '!charts/actions-runner-controller/docs/**' - - '!charts/actions-runner-controller-2/**' - - '!charts/auto-scaling-runner-set/**' + - '!charts/gha-runner-scale-set-controller/**' + - '!charts/gha-runner-scale-set/**' - '!**.md' workflow_dispatch: diff --git a/.github/workflows/publish-arc2.yaml b/.github/workflows/publish-runner-scale-set.yaml similarity index 67% rename from .github/workflows/publish-arc2.yaml rename to .github/workflows/publish-runner-scale-set.yaml index 0b87ccd4..d32a3c03 100644 --- a/.github/workflows/publish-arc2.yaml +++ b/.github/workflows/publish-runner-scale-set.yaml @@ -1,4 +1,4 @@ -name: Publish ARC 2 +name: Publish Runner Scale Set Controller Charts on: workflow_dispatch: @@ -18,13 +18,13 @@ on: required: true type: boolean default: false - publish_actions_runner_controller_2_chart: - description: 'Publish new helm chart for actions-runner-controller-2' + publish_gha_runner_scale_set_controller_chart: + description: 'Publish new helm chart for gha-runner-scale-set-controller' required: true type: boolean default: false - publish_auto_scaling_runner_set_chart: - description: 'Publish new helm chart for auto-scaling-runner-set' + publish_gha_runner_scale_set_chart: + description: 'Publish new helm chart for gha-runner-scale-set' required: true type: boolean default: false @@ -87,14 +87,14 @@ jobs: build-args: VERSION=${{ inputs.release_tag_name }} push: ${{ inputs.push_to_registries }} tags: | - ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-2:${{ inputs.release_tag_name }} - ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-2:${{ inputs.release_tag_name }}-${{ steps.resolve_parameters.outputs.short_sha }} + ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/gha-runner-scale-set-controller:${{ inputs.release_tag_name }} + ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/gha-runner-scale-set-controller:${{ inputs.release_tag_name }}-${{ steps.resolve_parameters.outputs.short_sha }} cache-from: type=gha cache-to: type=gha,mode=max - name: Job summary run: | - echo "The [publish-arc2](https://github.com/actions/actions-runner-controller/blob/main/.github/workflows/publish-arc2.yaml) workflow run was completed successfully!" >> $GITHUB_STEP_SUMMARY + echo "The [publish-runner-scale-set.yaml](https://github.com/actions/actions-runner-controller/blob/main/.github/workflows/publish-runner-scale-set.yaml) workflow run was completed successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY @@ -103,10 +103,10 @@ jobs: echo "- Push to registries: ${{ inputs.push_to_registries }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - publish-helm-chart-arc-2: - if: ${{ inputs.publish_actions_runner_controller_2_chart == true }} + publish-helm-chart-gha-runner-scale-set-controller: + if: ${{ inputs.publish_gha_runner_scale_set_controller_chart == true }} needs: build-push-image - name: Publish Helm chart for actions-runner-controller-2 + name: Publish Helm chart for gha-runner-scale-set-controller runs-on: ubuntu-latest steps: - name: Checkout @@ -133,27 +133,27 @@ jobs: with: version: ${{ env.HELM_VERSION }} - - name: Publish new helm chart for actions-runner-controller-2 + - name: Publish new helm chart for gha-runner-scale-set-controller run: | echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin - ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG=$(cat charts/actions-runner-controller-2/Chart.yaml | grep version: | cut -d " " -f 2) - echo "ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG=${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}" >> $GITHUB_ENV - helm package charts/actions-runner-controller-2/ --version="${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}" - helm push actions-runner-controller-2-"${ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts + GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG=$(cat charts/gha-runner-scale-set-controller/Chart.yaml | grep version: | cut -d " " -f 2) + echo "GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG=${GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG}" >> $GITHUB_ENV + helm package charts/gha-runner-scale-set-controller/ --version="${GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG}" + helm push gha-runner-scale-set-controller-"${GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts - name: Job summary run: | - echo "New helm chart for actions-runner-controller-2 published successfully!" >> $GITHUB_STEP_SUMMARY + echo "New helm chart for gha-runner-scale-set-controller published successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY - echo "- Actions-Runner-Controller-2 Chart version: ${{ env.ACTIONS_RUNNER_CONTROLLER_2_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY + echo "- gha-runner-scale-set-controller Chart version: ${{ env.GHA_RUNNER_SCALE_SET_CONTROLLER_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY - publish-helm-chart-auto-scaling-runner-set: - if: ${{ inputs.publish_auto_scaling_runner_set_chart == true }} + publish-helm-chart-gha-runner-scale-set: + if: ${{ inputs.publish_gha_runner_scale_set_chart == true }} needs: build-push-image - name: Publish Helm chart for auto-scaling-runner-set + name: Publish Helm chart for gha-runner-scale-set runs-on: ubuntu-latest steps: - name: Checkout @@ -180,20 +180,20 @@ jobs: with: version: ${{ env.HELM_VERSION }} - - name: Publish new helm chart for auto-scaling-runner-set + - name: Publish new helm chart for gha-runner-scale-set run: | echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin - AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG=$(cat charts/auto-scaling-runner-set/Chart.yaml | grep version: | cut -d " " -f 2) - echo "AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG=${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}" >> $GITHUB_ENV - helm package charts/auto-scaling-runner-set/ --version="${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}" - helm push auto-scaling-runner-set-"${AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts + GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG=$(cat charts/gha-runner-scale-set/Chart.yaml | grep version: | cut -d " " -f 2) + echo "GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG=${GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG}" >> $GITHUB_ENV + helm package charts/gha-runner-scale-set/ --version="${GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG}" + helm push gha-runner-scale-set-"${GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG}".tgz oci://ghcr.io/${{ steps.resolve_parameters.outputs.repository_owner }}/actions-runner-controller-charts - name: Job summary run: | - echo "New helm chart for auto-scaling-runner-set published successfully!" >> $GITHUB_STEP_SUMMARY + echo "New helm chart for gha-runner-scale-set published successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Parameters:**" >> $GITHUB_STEP_SUMMARY echo "- Ref: ${{ steps.resolve_parameters.outputs.resolvedRef }}" >> $GITHUB_STEP_SUMMARY echo "- Short SHA: ${{ steps.resolve_parameters.outputs.short_sha }}" >> $GITHUB_STEP_SUMMARY - echo "- Auto-Scaling-Runner-Set Chart version: ${{ env.AUTO_SCALING_RUNNER_SET_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY + echo "- gha-runner-scale-set Chart version: ${{ env.GHA_RUNNER_SCALE_SET_CHART_VERSION_TAG }}" >> $GITHUB_STEP_SUMMARY diff --git a/Makefile b/Makefile index 2902d82f..7bb20d42 100644 --- a/Makefile +++ b/Makefile @@ -174,10 +174,10 @@ manifests-gen-crds-fix: chart-crds: cp config/crd/bases/*.yaml charts/actions-runner-controller/crds/ - cp config/crd/bases/actions.github.com_autoscalingrunnersets.yaml charts/actions-runner-controller-2/crds/ - cp config/crd/bases/actions.github.com_autoscalinglisteners.yaml charts/actions-runner-controller-2/crds/ - cp config/crd/bases/actions.github.com_ephemeralrunnersets.yaml charts/actions-runner-controller-2/crds/ - cp config/crd/bases/actions.github.com_ephemeralrunners.yaml charts/actions-runner-controller-2/crds/ + cp config/crd/bases/actions.github.com_autoscalingrunnersets.yaml charts/gha-runner-scale-set-controller/crds/ + cp config/crd/bases/actions.github.com_autoscalinglisteners.yaml charts/gha-runner-scale-set-controller/crds/ + cp config/crd/bases/actions.github.com_ephemeralrunnersets.yaml charts/gha-runner-scale-set-controller/crds/ + cp config/crd/bases/actions.github.com_ephemeralrunners.yaml charts/gha-runner-scale-set-controller/crds/ rm charts/actions-runner-controller/crds/actions.github.com_autoscalingrunnersets.yaml rm charts/actions-runner-controller/crds/actions.github.com_autoscalinglisteners.yaml rm charts/actions-runner-controller/crds/actions.github.com_ephemeralrunnersets.yaml diff --git a/charts/actions-runner-controller-2/templates/manager_role_binding.yaml b/charts/actions-runner-controller-2/templates/manager_role_binding.yaml deleted file mode 100644 index cf8d6696..00000000 --- a/charts/actions-runner-controller-2/templates/manager_role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "actions-runner-controller-2.managerRoleBinding" . }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ include "actions-runner-controller-2.managerRoleName" . }} -subjects: -- kind: ServiceAccount - name: {{ include "actions-runner-controller-2.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} \ No newline at end of file diff --git a/charts/actions-runner-controller-2/.helmignore b/charts/gha-runner-scale-set-controller/.helmignore similarity index 100% rename from charts/actions-runner-controller-2/.helmignore rename to charts/gha-runner-scale-set-controller/.helmignore diff --git a/charts/actions-runner-controller-2/Chart.yaml b/charts/gha-runner-scale-set-controller/Chart.yaml similarity index 94% rename from charts/actions-runner-controller-2/Chart.yaml rename to charts/gha-runner-scale-set-controller/Chart.yaml index 5e7984a0..7016e650 100644 --- a/charts/actions-runner-controller-2/Chart.yaml +++ b/charts/gha-runner-scale-set-controller/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: actions-runner-controller-2 +name: gha-runner-scale-set-controller description: A Helm chart for install actions-runner-controller CRD # A chart can be either an 'application' or a 'library' chart. diff --git a/charts/actions-runner-controller-2/crds/actions.github.com_autoscalinglisteners.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalinglisteners.yaml similarity index 100% rename from charts/actions-runner-controller-2/crds/actions.github.com_autoscalinglisteners.yaml rename to charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalinglisteners.yaml diff --git a/charts/actions-runner-controller-2/crds/actions.github.com_autoscalingrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml similarity index 100% rename from charts/actions-runner-controller-2/crds/actions.github.com_autoscalingrunnersets.yaml rename to charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml diff --git a/charts/actions-runner-controller-2/crds/actions.github.com_ephemeralrunners.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml similarity index 100% rename from charts/actions-runner-controller-2/crds/actions.github.com_ephemeralrunners.yaml rename to charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml diff --git a/charts/actions-runner-controller-2/crds/actions.github.com_ephemeralrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml similarity index 100% rename from charts/actions-runner-controller-2/crds/actions.github.com_ephemeralrunnersets.yaml rename to charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml diff --git a/charts/actions-runner-controller-2/templates/NOTES.txt b/charts/gha-runner-scale-set-controller/templates/NOTES.txt similarity index 100% rename from charts/actions-runner-controller-2/templates/NOTES.txt rename to charts/gha-runner-scale-set-controller/templates/NOTES.txt diff --git a/charts/actions-runner-controller-2/templates/_helpers.tpl b/charts/gha-runner-scale-set-controller/templates/_helpers.tpl similarity index 58% rename from charts/actions-runner-controller-2/templates/_helpers.tpl rename to charts/gha-runner-scale-set-controller/templates/_helpers.tpl index 4b5ffaed..ce3409fa 100644 --- a/charts/actions-runner-controller-2/templates/_helpers.tpl +++ b/charts/gha-runner-scale-set-controller/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "actions-runner-controller-2.name" -}} +{{- define "gha-runner-scale-set-controller.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "actions-runner-controller-2.fullname" -}} +{{- define "gha-runner-scale-set-controller.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "actions-runner-controller-2.chart" -}} +{{- define "gha-runner-scale-set-controller.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "actions-runner-controller-2.labels" -}} -helm.sh/chart: {{ include "actions-runner-controller-2.chart" . }} -{{ include "actions-runner-controller-2.selectorLabels" . }} +{{- define "gha-runner-scale-set-controller.labels" -}} +helm.sh/chart: {{ include "gha-runner-scale-set-controller.chart" . }} +{{ include "gha-runner-scale-set-controller.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -49,20 +49,20 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "actions-runner-controller-2.selectorLabels" -}} -app.kubernetes.io/name: {{ include "actions-runner-controller-2.name" . }} +{{- define "gha-runner-scale-set-controller.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gha-runner-scale-set-controller.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "actions-runner-controller-2.serviceAccountName" -}} +{{- define "gha-runner-scale-set-controller.serviceAccountName" -}} {{- if eq .Values.serviceAccount.name "default"}} {{- fail "serviceAccount.name cannot be set to 'default'" }} {{- end }} {{- if .Values.serviceAccount.create }} -{{- default (include "actions-runner-controller-2.fullname" .) .Values.serviceAccount.name }} +{{- default (include "gha-runner-scale-set-controller.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- if not .Values.serviceAccount.name }} {{- fail "serviceAccount.name must be set if serviceAccount.create is false" }} @@ -72,23 +72,23 @@ Create the name of the service account to use {{- end }} {{- end }} -{{- define "actions-runner-controller-2.managerRoleName" -}} -{{- include "actions-runner-controller-2.fullname" . }}-manager-role +{{- define "gha-runner-scale-set-controller.managerRoleName" -}} +{{- include "gha-runner-scale-set-controller.fullname" . }}-manager-role {{- end }} -{{- define "actions-runner-controller-2.managerRoleBinding" -}} -{{- include "actions-runner-controller-2.fullname" . }}-manager-rolebinding +{{- define "gha-runner-scale-set-controller.managerRoleBinding" -}} +{{- include "gha-runner-scale-set-controller.fullname" . }}-manager-rolebinding {{- end }} -{{- define "actions-runner-controller-2.leaderElectionRoleName" -}} -{{- include "actions-runner-controller-2.fullname" . }}-leader-election-role +{{- define "gha-runner-scale-set-controller.leaderElectionRoleName" -}} +{{- include "gha-runner-scale-set-controller.fullname" . }}-leader-election-role {{- end }} -{{- define "actions-runner-controller-2.leaderElectionRoleBinding" -}} -{{- include "actions-runner-controller-2.fullname" . }}-leader-election-rolebinding +{{- define "gha-runner-scale-set-controller.leaderElectionRoleBinding" -}} +{{- include "gha-runner-scale-set-controller.fullname" . }}-leader-election-rolebinding {{- end }} -{{- define "actions-runner-controller-2.imagePullSecretsNames" -}} +{{- define "gha-runner-scale-set-controller.imagePullSecretsNames" -}} {{- $names := list }} {{- range $k, $v := . }} {{- $names = append $names $v.name }} diff --git a/charts/actions-runner-controller-2/templates/deployment.yaml b/charts/gha-runner-scale-set-controller/templates/deployment.yaml similarity index 81% rename from charts/actions-runner-controller-2/templates/deployment.yaml rename to charts/gha-runner-scale-set-controller/templates/deployment.yaml index 0813f355..a35dc784 100644 --- a/charts/actions-runner-controller-2/templates/deployment.yaml +++ b/charts/gha-runner-scale-set-controller/templates/deployment.yaml @@ -1,15 +1,15 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "actions-runner-controller-2.fullname" . }} + name: {{ include "gha-runner-scale-set-controller.fullname" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "actions-runner-controller-2.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set-controller.labels" . | nindent 4 }} spec: replicas: {{ default 1 .Values.replicaCount }} selector: matchLabels: - {{- include "actions-runner-controller-2.selectorLabels" . | nindent 6 }} + {{- include "gha-runner-scale-set-controller.selectorLabels" . | nindent 6 }} template: metadata: annotations: @@ -21,13 +21,13 @@ spec: app.kubernetes.io/part-of: actions-runner-controller app.kubernetes.io/component: controller-manager app.kubernetes.io/version: {{ .Chart.Version }} - {{- include "actions-runner-controller-2.selectorLabels" . | nindent 8 }} + {{- include "gha-runner-scale-set-controller.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "actions-runner-controller-2.serviceAccountName" . }} + serviceAccountName: {{ include "gha-runner-scale-set-controller.serviceAccountName" . }} {{- with .Values.podSecurityContext }} securityContext: {{- toYaml . | nindent 8 }} @@ -43,10 +43,10 @@ spec: - "--auto-scaling-runner-set-only" {{- if gt (int (default 1 .Values.replicaCount)) 1 }} - "--enable-leader-election" - - "--leader-election-id={{ include "actions-runner-controller-2.fullname" . }}" + - "--leader-election-id={{ include "gha-runner-scale-set-controller.fullname" . }}" {{- end }} {{- with .Values.imagePullSecrets }} - - "--auto-scaler-image-pull-secrets={{ include "actions-runner-controller-2.imagePullSecretsNames" . }}" + - "--auto-scaler-image-pull-secrets={{ include "gha-runner-scale-set-controller.imagePullSecretsNames" . }}" {{- end }} {{- with .Values.flags.logLevel }} - "--log-level={{ . }}" diff --git a/charts/actions-runner-controller-2/templates/leader_election_role.yaml b/charts/gha-runner-scale-set-controller/templates/leader_election_role.yaml similarity index 78% rename from charts/actions-runner-controller-2/templates/leader_election_role.yaml rename to charts/gha-runner-scale-set-controller/templates/leader_election_role.yaml index 72c18189..a64906d3 100644 --- a/charts/actions-runner-controller-2/templates/leader_election_role.yaml +++ b/charts/gha-runner-scale-set-controller/templates/leader_election_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ include "actions-runner-controller-2.leaderElectionRoleName" . }} + name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleName" . }} namespace: {{ .Release.Namespace }} rules: - apiGroups: ["coordination.k8s.io"] diff --git a/charts/actions-runner-controller-2/templates/leader_election_role_binding.yaml b/charts/gha-runner-scale-set-controller/templates/leader_election_role_binding.yaml similarity index 53% rename from charts/actions-runner-controller-2/templates/leader_election_role_binding.yaml rename to charts/gha-runner-scale-set-controller/templates/leader_election_role_binding.yaml index 3ab4d9ee..b33dda68 100644 --- a/charts/actions-runner-controller-2/templates/leader_election_role_binding.yaml +++ b/charts/gha-runner-scale-set-controller/templates/leader_election_role_binding.yaml @@ -2,14 +2,14 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ include "actions-runner-controller-2.leaderElectionRoleBinding" . }} + name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleBinding" . }} namespace: {{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: {{ include "actions-runner-controller-2.leaderElectionRoleName" . }} + name: {{ include "gha-runner-scale-set-controller.leaderElectionRoleName" . }} subjects: - kind: ServiceAccount - name: {{ include "actions-runner-controller-2.serviceAccountName" . }} + name: {{ include "gha-runner-scale-set-controller.serviceAccountName" . }} namespace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file diff --git a/charts/actions-runner-controller-2/templates/manager_role.yaml b/charts/gha-runner-scale-set-controller/templates/manager_role.yaml similarity index 96% rename from charts/actions-runner-controller-2/templates/manager_role.yaml rename to charts/gha-runner-scale-set-controller/templates/manager_role.yaml index 34639b9a..f51b47c4 100644 --- a/charts/actions-runner-controller-2/templates/manager_role.yaml +++ b/charts/gha-runner-scale-set-controller/templates/manager_role.yaml @@ -1,7 +1,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: {{ include "actions-runner-controller-2.managerRoleName" . }} + name: {{ include "gha-runner-scale-set-controller.managerRoleName" . }} rules: - apiGroups: - actions.github.com diff --git a/charts/gha-runner-scale-set-controller/templates/manager_role_binding.yaml b/charts/gha-runner-scale-set-controller/templates/manager_role_binding.yaml new file mode 100644 index 00000000..72549d6a --- /dev/null +++ b/charts/gha-runner-scale-set-controller/templates/manager_role_binding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "gha-runner-scale-set-controller.managerRoleBinding" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "gha-runner-scale-set-controller.managerRoleName" . }} +subjects: +- kind: ServiceAccount + name: {{ include "gha-runner-scale-set-controller.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} \ No newline at end of file diff --git a/charts/actions-runner-controller-2/templates/serviceaccount.yaml b/charts/gha-runner-scale-set-controller/templates/serviceaccount.yaml similarity index 60% rename from charts/actions-runner-controller-2/templates/serviceaccount.yaml rename to charts/gha-runner-scale-set-controller/templates/serviceaccount.yaml index 00320393..090d3a44 100644 --- a/charts/actions-runner-controller-2/templates/serviceaccount.yaml +++ b/charts/gha-runner-scale-set-controller/templates/serviceaccount.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "actions-runner-controller-2.serviceAccountName" . }} + name: {{ include "gha-runner-scale-set-controller.serviceAccountName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "actions-runner-controller-2.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set-controller.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/actions-runner-controller-2/tests/template_test.go b/charts/gha-runner-scale-set-controller/tests/template_test.go similarity index 82% rename from charts/actions-runner-controller-2/tests/template_test.go rename to charts/gha-runner-scale-set-controller/tests/template_test.go index 6c77fa36..6f9c47d6 100644 --- a/charts/actions-runner-controller-2/tests/template_test.go +++ b/charts/gha-runner-scale-set-controller/tests/template_test.go @@ -26,7 +26,7 @@ func TestTemplate_CreateServiceAccount(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -46,7 +46,7 @@ func TestTemplate_CreateServiceAccount(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &serviceAccount) assert.Equal(t, namespaceName, serviceAccount.Namespace) - assert.Equal(t, "test-arc-actions-runner-controller-2", serviceAccount.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", serviceAccount.Name) assert.Equal(t, "bar", string(serviceAccount.Annotations["foo"])) } @@ -54,7 +54,7 @@ func TestTemplate_CreateServiceAccount_OverwriteName(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -83,7 +83,7 @@ func TestTemplate_CreateServiceAccount_CannotUseDefaultServiceAccount(t *testing t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -106,7 +106,7 @@ func TestTemplate_NotCreateServiceAccount(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -129,7 +129,7 @@ func TestTemplate_NotCreateServiceAccount_ServiceAccountNotSet(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -151,7 +151,7 @@ func TestTemplate_CreateManagerRole(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -168,7 +168,7 @@ func TestTemplate_CreateManagerRole(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &managerRole) assert.Empty(t, managerRole.Namespace, "ClusterRole should not have a namespace") - assert.Equal(t, "test-arc-actions-runner-controller-2-manager-role", managerRole.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-role", managerRole.Name) assert.Equal(t, 17, len(managerRole.Rules)) } @@ -176,7 +176,7 @@ func TestTemplate_ManagerRoleBinding(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -195,9 +195,9 @@ func TestTemplate_ManagerRoleBinding(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &managerRoleBinding) assert.Empty(t, managerRoleBinding.Namespace, "ClusterRoleBinding should not have a namespace") - assert.Equal(t, "test-arc-actions-runner-controller-2-manager-rolebinding", managerRoleBinding.Name) - assert.Equal(t, "test-arc-actions-runner-controller-2-manager-role", managerRoleBinding.RoleRef.Name) - assert.Equal(t, "test-arc-actions-runner-controller-2", managerRoleBinding.Subjects[0].Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-rolebinding", managerRoleBinding.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-role", managerRoleBinding.RoleRef.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", managerRoleBinding.Subjects[0].Name) assert.Equal(t, namespaceName, managerRoleBinding.Subjects[0].Namespace) } @@ -205,7 +205,7 @@ func TestTemplate_ControllerDeployment_Defaults(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) chartContent, err := os.ReadFile(filepath.Join(helmChartPath, "Chart.yaml")) @@ -231,25 +231,25 @@ func TestTemplate_ControllerDeployment_Defaults(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &deployment) assert.Equal(t, namespaceName, deployment.Namespace) - assert.Equal(t, "test-arc-actions-runner-controller-2", deployment.Name) - assert.Equal(t, "actions-runner-controller-2-"+chart.Version, deployment.Labels["helm.sh/chart"]) - assert.Equal(t, "actions-runner-controller-2", deployment.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", deployment.Name) + assert.Equal(t, "gha-runner-scale-set-controller-"+chart.Version, deployment.Labels["helm.sh/chart"]) + assert.Equal(t, "gha-runner-scale-set-controller", deployment.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Labels["app.kubernetes.io/instance"]) assert.Equal(t, chart.AppVersion, deployment.Labels["app.kubernetes.io/version"]) assert.Equal(t, "Helm", deployment.Labels["app.kubernetes.io/managed-by"]) assert.Equal(t, int32(1), *deployment.Spec.Replicas) - assert.Equal(t, "actions-runner-controller-2", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set-controller", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/instance"]) - assert.Equal(t, "actions-runner-controller-2", deployment.Spec.Template.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set-controller", deployment.Spec.Template.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Spec.Template.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "manager", deployment.Spec.Template.Annotations["kubectl.kubernetes.io/default-container"]) assert.Len(t, deployment.Spec.Template.Spec.ImagePullSecrets, 0) - assert.Equal(t, "test-arc-actions-runner-controller-2", deployment.Spec.Template.Spec.ServiceAccountName) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", deployment.Spec.Template.Spec.ServiceAccountName) assert.Nil(t, deployment.Spec.Template.Spec.SecurityContext) assert.Empty(t, deployment.Spec.Template.Spec.PriorityClassName) assert.Equal(t, int64(10), *deployment.Spec.Template.Spec.TerminationGracePeriodSeconds) @@ -263,7 +263,7 @@ func TestTemplate_ControllerDeployment_Defaults(t *testing.T) { assert.Len(t, deployment.Spec.Template.Spec.Containers, 1) assert.Equal(t, "manager", deployment.Spec.Template.Spec.Containers[0].Name) - assert.Equal(t, "ghcr.io/actions/actions-runner-controller-2:dev", deployment.Spec.Template.Spec.Containers[0].Image) + assert.Equal(t, "ghcr.io/actions/gha-runner-scale-set-controller:dev", deployment.Spec.Template.Spec.Containers[0].Image) assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy) assert.Len(t, deployment.Spec.Template.Spec.Containers[0].Command, 1) @@ -291,7 +291,7 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) chartContent, err := os.ReadFile(filepath.Join(helmChartPath, "Chart.yaml")) @@ -312,9 +312,9 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { "image.pullPolicy": "Always", "image.tag": "dev", "imagePullSecrets[0].name": "dockerhub", - "nameOverride": "actions-runner-controller-2-override", - "fullnameOverride": "actions-runner-controller-2-fullname-override", - "serviceAccount.name": "actions-runner-controller-2-sa", + "nameOverride": "gha-runner-scale-set-controller-override", + "fullnameOverride": "gha-runner-scale-set-controller-fullname-override", + "serviceAccount.name": "gha-runner-scale-set-controller-sa", "podAnnotations.foo": "bar", "podSecurityContext.fsGroup": "1000", "securityContext.runAsUser": "1000", @@ -335,9 +335,9 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &deployment) assert.Equal(t, namespaceName, deployment.Namespace) - assert.Equal(t, "actions-runner-controller-2-fullname-override", deployment.Name) - assert.Equal(t, "actions-runner-controller-2-"+chart.Version, deployment.Labels["helm.sh/chart"]) - assert.Equal(t, "actions-runner-controller-2-override", deployment.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set-controller-fullname-override", deployment.Name) + assert.Equal(t, "gha-runner-scale-set-controller-"+chart.Version, deployment.Labels["helm.sh/chart"]) + assert.Equal(t, "gha-runner-scale-set-controller-override", deployment.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Labels["app.kubernetes.io/instance"]) assert.Equal(t, chart.AppVersion, deployment.Labels["app.kubernetes.io/version"]) assert.Equal(t, "Helm", deployment.Labels["app.kubernetes.io/managed-by"]) @@ -346,10 +346,10 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { assert.Equal(t, int32(1), *deployment.Spec.Replicas) - assert.Equal(t, "actions-runner-controller-2-override", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set-controller-override", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Spec.Selector.MatchLabels["app.kubernetes.io/instance"]) - assert.Equal(t, "actions-runner-controller-2-override", deployment.Spec.Template.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set-controller-override", deployment.Spec.Template.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-arc", deployment.Spec.Template.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "bar", deployment.Spec.Template.Annotations["foo"]) @@ -357,7 +357,7 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { assert.Len(t, deployment.Spec.Template.Spec.ImagePullSecrets, 1) assert.Equal(t, "dockerhub", deployment.Spec.Template.Spec.ImagePullSecrets[0].Name) - assert.Equal(t, "actions-runner-controller-2-sa", deployment.Spec.Template.Spec.ServiceAccountName) + assert.Equal(t, "gha-runner-scale-set-controller-sa", deployment.Spec.Template.Spec.ServiceAccountName) assert.Equal(t, int64(1000), *deployment.Spec.Template.Spec.SecurityContext.FSGroup) assert.Equal(t, "test-priority-class", deployment.Spec.Template.Spec.PriorityClassName) assert.Equal(t, int64(10), *deployment.Spec.Template.Spec.TerminationGracePeriodSeconds) @@ -377,7 +377,7 @@ func TestTemplate_ControllerDeployment_Customize(t *testing.T) { assert.Len(t, deployment.Spec.Template.Spec.Containers, 1) assert.Equal(t, "manager", deployment.Spec.Template.Spec.Containers[0].Name) - assert.Equal(t, "ghcr.io/actions/actions-runner-controller-2:dev", deployment.Spec.Template.Spec.Containers[0].Image) + assert.Equal(t, "ghcr.io/actions/gha-runner-scale-set-controller:dev", deployment.Spec.Template.Spec.Containers[0].Image) assert.Equal(t, corev1.PullAlways, deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy) assert.Len(t, deployment.Spec.Template.Spec.Containers[0].Command, 1) @@ -408,7 +408,7 @@ func TestTemplate_EnableLeaderElectionRole(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -426,7 +426,7 @@ func TestTemplate_EnableLeaderElectionRole(t *testing.T) { var leaderRole rbacv1.Role helm.UnmarshalK8SYaml(t, output, &leaderRole) - assert.Equal(t, "test-arc-actions-runner-controller-2-leader-election-role", leaderRole.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-leader-election-role", leaderRole.Name) assert.Equal(t, namespaceName, leaderRole.Namespace) } @@ -434,7 +434,7 @@ func TestTemplate_EnableLeaderElectionRoleBinding(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -452,17 +452,17 @@ func TestTemplate_EnableLeaderElectionRoleBinding(t *testing.T) { var leaderRoleBinding rbacv1.RoleBinding helm.UnmarshalK8SYaml(t, output, &leaderRoleBinding) - assert.Equal(t, "test-arc-actions-runner-controller-2-leader-election-rolebinding", leaderRoleBinding.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-leader-election-rolebinding", leaderRoleBinding.Name) assert.Equal(t, namespaceName, leaderRoleBinding.Namespace) - assert.Equal(t, "test-arc-actions-runner-controller-2-leader-election-role", leaderRoleBinding.RoleRef.Name) - assert.Equal(t, "test-arc-actions-runner-controller-2", leaderRoleBinding.Subjects[0].Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller-leader-election-role", leaderRoleBinding.RoleRef.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", leaderRoleBinding.Subjects[0].Name) } func TestTemplate_EnableLeaderElection(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" @@ -482,13 +482,13 @@ func TestTemplate_EnableLeaderElection(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &deployment) assert.Equal(t, namespaceName, deployment.Namespace) - assert.Equal(t, "test-arc-actions-runner-controller-2", deployment.Name) + assert.Equal(t, "test-arc-gha-runner-scale-set-controller", deployment.Name) assert.Equal(t, int32(2), *deployment.Spec.Replicas) assert.Len(t, deployment.Spec.Template.Spec.Containers, 1) assert.Equal(t, "manager", deployment.Spec.Template.Spec.Containers[0].Name) - assert.Equal(t, "ghcr.io/actions/actions-runner-controller-2:dev", deployment.Spec.Template.Spec.Containers[0].Image) + assert.Equal(t, "ghcr.io/actions/gha-runner-scale-set-controller:dev", deployment.Spec.Template.Spec.Containers[0].Image) assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy) assert.Len(t, deployment.Spec.Template.Spec.Containers[0].Command, 1) @@ -497,7 +497,7 @@ func TestTemplate_EnableLeaderElection(t *testing.T) { assert.Len(t, deployment.Spec.Template.Spec.Containers[0].Args, 4) assert.Equal(t, "--auto-scaling-runner-set-only", deployment.Spec.Template.Spec.Containers[0].Args[0]) assert.Equal(t, "--enable-leader-election", deployment.Spec.Template.Spec.Containers[0].Args[1]) - assert.Equal(t, "--leader-election-id=test-arc-actions-runner-controller-2", deployment.Spec.Template.Spec.Containers[0].Args[2]) + assert.Equal(t, "--leader-election-id=test-arc-gha-runner-scale-set-controller", deployment.Spec.Template.Spec.Containers[0].Args[2]) assert.Equal(t, "--log-level=debug", deployment.Spec.Template.Spec.Containers[0].Args[3]) } @@ -505,7 +505,7 @@ func TestTemplate_ControllerDeployment_ForwardImagePullSecrets(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../actions-runner-controller-2") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set-controller") require.NoError(t, err) releaseName := "test-arc" diff --git a/charts/actions-runner-controller-2/values.yaml b/charts/gha-runner-scale-set-controller/values.yaml similarity index 90% rename from charts/actions-runner-controller-2/values.yaml rename to charts/gha-runner-scale-set-controller/values.yaml index 2dfaa273..4e232944 100644 --- a/charts/actions-runner-controller-2/values.yaml +++ b/charts/gha-runner-scale-set-controller/values.yaml @@ -1,15 +1,15 @@ -# Default values for actions-runner-controller-2. +# Default values for gha-runner-scale-set-controller. # This is a YAML-formatted file. # Declare variables to be passed into your templates. labels: {} # leaderElection will be enabled when replicaCount>1, # So, only one replica will in charge of reconciliation at a given time -# leaderElectionId will be set to {{ define actions-runner-controller-2.fullname }}. +# leaderElectionId will be set to {{ define gha-runner-scale-set-controller.fullname }}. replicaCount: 1 image: - repository: "ghcr.io/actions/actions-runner-controller-2" + repository: "ghcr.io/actions/gha-runner-scale-set-controller" pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" diff --git a/charts/auto-scaling-runner-set/.helmignore b/charts/gha-runner-scale-set/.helmignore similarity index 100% rename from charts/auto-scaling-runner-set/.helmignore rename to charts/gha-runner-scale-set/.helmignore diff --git a/charts/auto-scaling-runner-set/Chart.yaml b/charts/gha-runner-scale-set/Chart.yaml similarity index 95% rename from charts/auto-scaling-runner-set/Chart.yaml rename to charts/gha-runner-scale-set/Chart.yaml index 0de19888..0349000d 100644 --- a/charts/auto-scaling-runner-set/Chart.yaml +++ b/charts/gha-runner-scale-set/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: auto-scaling-runner-set +name: gha-runner-scale-set description: A Helm chart for deploying an AutoScalingRunnerSet # A chart can be either an 'application' or a 'library' chart. diff --git a/charts/auto-scaling-runner-set/ci/ci-values.yaml b/charts/gha-runner-scale-set/ci/ci-values.yaml similarity index 100% rename from charts/auto-scaling-runner-set/ci/ci-values.yaml rename to charts/gha-runner-scale-set/ci/ci-values.yaml diff --git a/charts/auto-scaling-runner-set/templates/NOTES.txt b/charts/gha-runner-scale-set/templates/NOTES.txt similarity index 100% rename from charts/auto-scaling-runner-set/templates/NOTES.txt rename to charts/gha-runner-scale-set/templates/NOTES.txt diff --git a/charts/auto-scaling-runner-set/templates/_helpers.tpl b/charts/gha-runner-scale-set/templates/_helpers.tpl similarity index 84% rename from charts/auto-scaling-runner-set/templates/_helpers.tpl rename to charts/gha-runner-scale-set/templates/_helpers.tpl index 3b51df2a..944bf979 100644 --- a/charts/auto-scaling-runner-set/templates/_helpers.tpl +++ b/charts/gha-runner-scale-set/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "auto-scaling-runner-set.name" -}} +{{- define "gha-runner-scale-set.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "auto-scaling-runner-set.fullname" -}} +{{- define "gha-runner-scale-set.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "auto-scaling-runner-set.chart" -}} +{{- define "gha-runner-scale-set.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "auto-scaling-runner-set.labels" -}} -helm.sh/chart: {{ include "auto-scaling-runner-set.chart" . }} -{{ include "auto-scaling-runner-set.selectorLabels" . }} +{{- define "gha-runner-scale-set.labels" -}} +helm.sh/chart: {{ include "gha-runner-scale-set.chart" . }} +{{ include "gha-runner-scale-set.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,12 +45,12 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "auto-scaling-runner-set.selectorLabels" -}} -app.kubernetes.io/name: {{ include "auto-scaling-runner-set.name" . }} +{{- define "gha-runner-scale-set.selectorLabels" -}} +app.kubernetes.io/name: {{ include "gha-runner-scale-set.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} -{{- define "auto-scaling-runner-set.githubsecret" -}} +{{- define "gha-runner-scale-set.githubsecret" -}} {{- if kindIs "string" .Values.githubConfigSecret }} {{- if not (empty .Values.githubConfigSecret) }} {{- .Values.githubConfigSecret }} @@ -58,23 +58,23 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- fail "Values.githubConfigSecret is required for setting auth with GitHub server." }} {{- end }} {{- else }} -{{- include "auto-scaling-runner-set.fullname" . }}-github-secret +{{- include "gha-runner-scale-set.fullname" . }}-github-secret {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.noPermissionServiceAccountName" -}} -{{- include "auto-scaling-runner-set.fullname" . }}-no-permission-service-account +{{- define "gha-runner-scale-set.noPermissionServiceAccountName" -}} +{{- include "gha-runner-scale-set.fullname" . }}-no-permission-service-account {{- end }} -{{- define "auto-scaling-runner-set.kubeModeRoleName" -}} -{{- include "auto-scaling-runner-set.fullname" . }}-kube-mode-role +{{- define "gha-runner-scale-set.kubeModeRoleName" -}} +{{- include "gha-runner-scale-set.fullname" . }}-kube-mode-role {{- end }} -{{- define "auto-scaling-runner-set.kubeModeServiceAccountName" -}} -{{- include "auto-scaling-runner-set.fullname" . }}-kube-mode-service-account +{{- define "gha-runner-scale-set.kubeModeServiceAccountName" -}} +{{- include "gha-runner-scale-set.fullname" . }}-kube-mode-service-account {{- end }} -{{- define "auto-scaling-runner-set.dind-init-container" -}} +{{- define "gha-runner-scale-set.dind-init-container" -}} {{- range $i, $val := .Values.template.spec.containers -}} {{- if eq $val.name "runner" -}} image: {{ $val.image }} @@ -91,7 +91,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.dind-container" -}} +{{- define "gha-runner-scale-set.dind-container" -}} image: docker:dind securityContext: privileged: true @@ -104,14 +104,14 @@ volumeMounts: mountPath: /actions-runner/externals {{- end }} -{{- define "auto-scaling-runner-set.dind-volume" -}} +{{- define "gha-runner-scale-set.dind-volume" -}} - name: dind-cert emptyDir: {} - name: dind-externals emptyDir: {} {{- end }} -{{- define "auto-scaling-runner-set.dind-work-volume" -}} +{{- define "gha-runner-scale-set.dind-work-volume" -}} {{- $createWorkVolume := 1 }} {{- range $i, $volume := .Values.template.spec.volumes }} {{- if eq $volume.name "work" }} @@ -130,7 +130,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.kubernetes-mode-work-volume" -}} +{{- define "gha-runner-scale-set.kubernetes-mode-work-volume" -}} {{- $createWorkVolume := 1 }} {{- range $i, $volume := .Values.template.spec.volumes }} {{- if eq $volume.name "work" }} @@ -152,7 +152,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.non-work-volumes" -}} +{{- define "gha-runner-scale-set.non-work-volumes" -}} {{- range $i, $volume := .Values.template.spec.volumes }} {{- if ne $volume.name "work" }} - name: {{ $volume.name }} @@ -165,7 +165,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.non-runner-containers" -}} +{{- define "gha-runner-scale-set.non-runner-containers" -}} {{- range $i, $container := .Values.template.spec.containers -}} {{- if ne $container.name "runner" -}} - name: {{ $container.name }} @@ -178,7 +178,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.dind-runner-container" -}} +{{- define "gha-runner-scale-set.dind-runner-container" -}} {{- range $i, $container := .Values.template.spec.containers -}} {{- if eq $container.name "runner" -}} {{- range $key, $val := $container }} @@ -261,7 +261,7 @@ volumeMounts: {{- end }} {{- end }} -{{- define "auto-scaling-runner-set.kubernetes-mode-runner-container" -}} +{{- define "gha-runner-scale-set.kubernetes-mode-runner-container" -}} {{- range $i, $container := .Values.template.spec.containers -}} {{- if eq $container.name "runner" -}} {{- range $key, $val := $container }} diff --git a/charts/auto-scaling-runner-set/templates/autoscalingrunnerset.yaml b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml similarity index 72% rename from charts/auto-scaling-runner-set/templates/autoscalingrunnerset.yaml rename to charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml index d12c886a..d01f8cd9 100644 --- a/charts/auto-scaling-runner-set/templates/autoscalingrunnerset.yaml +++ b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml @@ -4,10 +4,10 @@ metadata: name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} labels: - {{- include "auto-scaling-runner-set.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set.labels" . | nindent 4 }} spec: githubConfigUrl: {{ required ".Values.githubConfigUrl is required" .Values.githubConfigUrl }} - githubConfigSecret: {{ include "auto-scaling-runner-set.githubsecret" . }} + githubConfigSecret: {{ include "gha-runner-scale-set.githubsecret" . }} {{- with .Values.runnerGroup }} runnerGroup: {{ . }} {{- end }} @@ -68,15 +68,15 @@ spec: {{- end }} {{- end }} {{- if eq .Values.containerMode.type "kubernetes" }} - serviceAccountName: {{ default (include "auto-scaling-runner-set.kubeModeServiceAccountName" .) .Values.template.spec.serviceAccountName }} + serviceAccountName: {{ default (include "gha-runner-scale-set.kubeModeServiceAccountName" .) .Values.template.spec.serviceAccountName }} {{- else }} - serviceAccountName: {{ default (include "auto-scaling-runner-set.noPermissionServiceAccountName" .) .Values.template.spec.serviceAccountName }} + serviceAccountName: {{ default (include "gha-runner-scale-set.noPermissionServiceAccountName" .) .Values.template.spec.serviceAccountName }} {{- end }} {{- if or .Values.template.spec.initContainers (eq .Values.containerMode.type "dind") }} initContainers: {{- if eq .Values.containerMode.type "dind" }} - name: init-dind-externals - {{- include "auto-scaling-runner-set.dind-init-container" . | nindent 8 }} + {{- include "gha-runner-scale-set.dind-init-container" . | nindent 8 }} {{- end }} {{- with .Values.template.spec.initContainers }} {{- toYaml . | nindent 8 }} @@ -85,24 +85,24 @@ spec: containers: {{- if eq .Values.containerMode.type "dind" }} - name: runner - {{- include "auto-scaling-runner-set.dind-runner-container" . | nindent 8 }} + {{- include "gha-runner-scale-set.dind-runner-container" . | nindent 8 }} - name: dind - {{- include "auto-scaling-runner-set.dind-container" . | nindent 8 }} - {{- include "auto-scaling-runner-set.non-runner-containers" . | nindent 6 }} + {{- include "gha-runner-scale-set.dind-container" . | nindent 8 }} + {{- include "gha-runner-scale-set.non-runner-containers" . | nindent 6 }} {{- else if eq .Values.containerMode.type "kubernetes" }} - name: runner - {{- include "auto-scaling-runner-set.kubernetes-mode-runner-container" . | nindent 8 }} - {{- include "auto-scaling-runner-set.non-runner-containers" . | nindent 6 }} + {{- include "gha-runner-scale-set.kubernetes-mode-runner-container" . | nindent 8 }} + {{- include "gha-runner-scale-set.non-runner-containers" . | nindent 6 }} {{- else }} {{ .Values.template.spec.containers | toYaml | nindent 6 }} {{- end }} {{- if or .Values.template.spec.volumes (eq .Values.containerMode.type "dind") (eq .Values.containerMode.type "kubernetes") }} volumes: {{- if eq .Values.containerMode.type "dind" }} - {{- include "auto-scaling-runner-set.dind-volume" . | nindent 6 }} - {{- include "auto-scaling-runner-set.dind-work-volume" . | nindent 6 }} + {{- include "gha-runner-scale-set.dind-volume" . | nindent 6 }} + {{- include "gha-runner-scale-set.dind-work-volume" . | nindent 6 }} {{- else if eq .Values.containerMode.type "kubernetes" }} - {{- include "auto-scaling-runner-set.kubernetes-mode-work-volume" . | nindent 6 }} + {{- include "gha-runner-scale-set.kubernetes-mode-work-volume" . | nindent 6 }} {{- end }} - {{- include "auto-scaling-runner-set.non-work-volumes" . | nindent 6 }} + {{- include "gha-runner-scale-set.non-work-volumes" . | nindent 6 }} {{- end }} \ No newline at end of file diff --git a/charts/auto-scaling-runner-set/templates/githubsecret.yaml b/charts/gha-runner-scale-set/templates/githubsecret.yaml similarity index 92% rename from charts/auto-scaling-runner-set/templates/githubsecret.yaml rename to charts/gha-runner-scale-set/templates/githubsecret.yaml index 4374f833..03411486 100644 --- a/charts/auto-scaling-runner-set/templates/githubsecret.yaml +++ b/charts/gha-runner-scale-set/templates/githubsecret.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: Secret metadata: - name: {{ include "auto-scaling-runner-set.githubsecret" . }} + name: {{ include "gha-runner-scale-set.githubsecret" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "auto-scaling-runner-set.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set.labels" . | nindent 4 }} finalizers: - actions.github.com/secret-protection data: diff --git a/charts/auto-scaling-runner-set/templates/kube_mode_role.yaml b/charts/gha-runner-scale-set/templates/kube_mode_role.yaml similarity index 90% rename from charts/auto-scaling-runner-set/templates/kube_mode_role.yaml rename to charts/gha-runner-scale-set/templates/kube_mode_role.yaml index a12d02d5..ffc0c68e 100644 --- a/charts/auto-scaling-runner-set/templates/kube_mode_role.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_role.yaml @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{ include "auto-scaling-runner-set.kubeModeRoleName" . }} + name: {{ include "gha-runner-scale-set.kubeModeRoleName" . }} namespace: {{ .Release.Namespace }} rules: - apiGroups: [""] diff --git a/charts/auto-scaling-runner-set/templates/kube_mode_role_binding.yaml b/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml similarity index 60% rename from charts/auto-scaling-runner-set/templates/kube_mode_role_binding.yaml rename to charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml index eafdda5e..bd1c634d 100644 --- a/charts/auto-scaling-runner-set/templates/kube_mode_role_binding.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml @@ -2,14 +2,14 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{ include "auto-scaling-runner-set.kubeModeRoleName" . }} + name: {{ include "gha-runner-scale-set.kubeModeRoleName" . }} namespace: {{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: {{ include "auto-scaling-runner-set.kubeModeRoleName" . }} + name: {{ include "gha-runner-scale-set.kubeModeRoleName" . }} subjects: - kind: ServiceAccount - name: {{ include "auto-scaling-runner-set.kubeModeServiceAccountName" . }} + name: {{ include "gha-runner-scale-set.kubeModeServiceAccountName" . }} namespace: {{ .Release.Namespace }} {{- end }} \ No newline at end of file diff --git a/charts/auto-scaling-runner-set/templates/kube_mode_serviceaccount.yaml b/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml similarity index 56% rename from charts/auto-scaling-runner-set/templates/kube_mode_serviceaccount.yaml rename to charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml index 60dc0a97..8f180f71 100644 --- a/charts/auto-scaling-runner-set/templates/kube_mode_serviceaccount.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "auto-scaling-runner-set.kubeModeServiceAccountName" . }} + name: {{ include "gha-runner-scale-set.kubeModeServiceAccountName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "auto-scaling-runner-set.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set.labels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/charts/auto-scaling-runner-set/templates/no_permission_serviceaccount.yaml b/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml similarity index 56% rename from charts/auto-scaling-runner-set/templates/no_permission_serviceaccount.yaml rename to charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml index 07608bc9..3aa2d0e2 100644 --- a/charts/auto-scaling-runner-set/templates/no_permission_serviceaccount.yaml +++ b/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "auto-scaling-runner-set.noPermissionServiceAccountName" . }} + name: {{ include "gha-runner-scale-set.noPermissionServiceAccountName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "auto-scaling-runner-set.labels" . | nindent 4 }} + {{- include "gha-runner-scale-set.labels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/charts/auto-scaling-runner-set/tests/template_test.go b/charts/gha-runner-scale-set/tests/template_test.go similarity index 90% rename from charts/auto-scaling-runner-set/tests/template_test.go rename to charts/gha-runner-scale-set/tests/template_test.go index 96a8e894..a26e571a 100644 --- a/charts/auto-scaling-runner-set/tests/template_test.go +++ b/charts/gha-runner-scale-set/tests/template_test.go @@ -19,7 +19,7 @@ func TestTemplateRenderedGitHubSecretWithGitHubToken(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -39,7 +39,7 @@ func TestTemplateRenderedGitHubSecretWithGitHubToken(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &githubSecret) assert.Equal(t, namespaceName, githubSecret.Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-github-secret", githubSecret.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-github-secret", githubSecret.Name) assert.Equal(t, "gh_token12345", string(githubSecret.Data["github_token"])) assert.Equal(t, "actions.github.com/secret-protection", githubSecret.Finalizers[0]) } @@ -48,7 +48,7 @@ func TestTemplateRenderedGitHubSecretWithGitHubApp(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -79,7 +79,7 @@ func TestTemplateRenderedGitHubSecretErrorWithMissingAuthInput(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -104,7 +104,7 @@ func TestTemplateRenderedGitHubSecretErrorWithMissingAppInput(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -128,7 +128,7 @@ func TestTemplateNotRenderedGitHubSecretWithPredefinedSecret(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -150,7 +150,7 @@ func TestTemplateRenderedSetServiceAccountToNoPermission(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -169,20 +169,20 @@ func TestTemplateRenderedSetServiceAccountToNoPermission(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &serviceAccount) assert.Equal(t, namespaceName, serviceAccount.Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-no-permission-service-account", serviceAccount.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-no-permission-service-account", serviceAccount.Name) output = helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/autoscalingrunnerset.yaml"}) var ars v1alpha1.AutoscalingRunnerSet helm.UnmarshalK8SYaml(t, output, &ars) - assert.Equal(t, "test-runners-auto-scaling-runner-set-no-permission-service-account", ars.Spec.Template.Spec.ServiceAccountName) + assert.Equal(t, "test-runners-gha-runner-scale-set-no-permission-service-account", ars.Spec.Template.Spec.ServiceAccountName) } func TestTemplateRenderedSetServiceAccountToKubeMode(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -202,14 +202,14 @@ func TestTemplateRenderedSetServiceAccountToKubeMode(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &serviceAccount) assert.Equal(t, namespaceName, serviceAccount.Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-service-account", serviceAccount.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-service-account", serviceAccount.Name) output = helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/kube_mode_role.yaml"}) var role rbacv1.Role helm.UnmarshalK8SYaml(t, output, &role) assert.Equal(t, namespaceName, role.Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-role", role.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-role", role.Name) assert.Len(t, role.Rules, 5, "kube mode role should have 5 rules") assert.Equal(t, "pods", role.Rules[0].Resources[0]) assert.Equal(t, "pods/exec", role.Rules[1].Resources[0]) @@ -222,25 +222,25 @@ func TestTemplateRenderedSetServiceAccountToKubeMode(t *testing.T) { helm.UnmarshalK8SYaml(t, output, &roleBinding) assert.Equal(t, namespaceName, roleBinding.Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-role", roleBinding.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-role", roleBinding.Name) assert.Len(t, roleBinding.Subjects, 1) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-service-account", roleBinding.Subjects[0].Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-service-account", roleBinding.Subjects[0].Name) assert.Equal(t, namespaceName, roleBinding.Subjects[0].Namespace) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-role", roleBinding.RoleRef.Name) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-role", roleBinding.RoleRef.Name) assert.Equal(t, "Role", roleBinding.RoleRef.Kind) output = helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/autoscalingrunnerset.yaml"}) var ars v1alpha1.AutoscalingRunnerSet helm.UnmarshalK8SYaml(t, output, &ars) - assert.Equal(t, "test-runners-auto-scaling-runner-set-kube-mode-service-account", ars.Spec.Template.Spec.ServiceAccountName) + assert.Equal(t, "test-runners-gha-runner-scale-set-kube-mode-service-account", ars.Spec.Template.Spec.ServiceAccountName) } func TestTemplateRenderedUserProvideSetServiceAccount(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -269,7 +269,7 @@ func TestTemplateRenderedAutoScalingRunnerSet(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -291,10 +291,10 @@ func TestTemplateRenderedAutoScalingRunnerSet(t *testing.T) { assert.Equal(t, namespaceName, ars.Namespace) assert.Equal(t, "test-runners", ars.Name) - assert.Equal(t, "auto-scaling-runner-set", ars.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set", ars.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl) - assert.Equal(t, "test-runners-auto-scaling-runner-set-github-secret", ars.Spec.GitHubConfigSecret) + assert.Equal(t, "test-runners-gha-runner-scale-set-github-secret", ars.Spec.GitHubConfigSecret) assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty") @@ -314,7 +314,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_ProvideMetadata(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -359,7 +359,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MaxRunnersValidationError(t *testi t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -384,7 +384,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinRunnersValidationError(t *testi t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -410,7 +410,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunnersValidationError(t *te t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -436,7 +436,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunnersValidationSameValue(t t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -465,7 +465,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunnersValidation_OnlyMin(t t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -493,7 +493,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunnersValidation_OnlyMax(t t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -521,7 +521,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_MinMaxRunners_FromValuesFile(t *te t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) testValuesPath, err := filepath.Abs("../tests/values.yaml") @@ -548,7 +548,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -571,10 +571,10 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) { assert.Equal(t, namespaceName, ars.Namespace) assert.Equal(t, "test-runners", ars.Name) - assert.Equal(t, "auto-scaling-runner-set", ars.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set", ars.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl) - assert.Equal(t, "test-runners-auto-scaling-runner-set-github-secret", ars.Spec.GitHubConfigSecret) + assert.Equal(t, "test-runners-gha-runner-scale-set-github-secret", ars.Spec.GitHubConfigSecret) assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty") @@ -631,7 +631,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesMode(t *testing.T) t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -654,10 +654,10 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesMode(t *testing.T) assert.Equal(t, namespaceName, ars.Namespace) assert.Equal(t, "test-runners", ars.Name) - assert.Equal(t, "auto-scaling-runner-set", ars.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set", ars.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl) - assert.Equal(t, "test-runners-auto-scaling-runner-set-github-secret", ars.Spec.GitHubConfigSecret) + assert.Equal(t, "test-runners-gha-runner-scale-set-github-secret", ars.Spec.GitHubConfigSecret) assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty") assert.Nil(t, ars.Spec.MinRunners, "MinRunners should be nil") @@ -686,7 +686,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_UsePredefinedSecret(t *testing.T) t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -708,7 +708,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_UsePredefinedSecret(t *testing.T) assert.Equal(t, namespaceName, ars.Namespace) assert.Equal(t, "test-runners", ars.Name) - assert.Equal(t, "auto-scaling-runner-set", ars.Labels["app.kubernetes.io/name"]) + assert.Equal(t, "gha-runner-scale-set", ars.Labels["app.kubernetes.io/name"]) assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"]) assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl) assert.Equal(t, "pre-defined-secrets", ars.Spec.GitHubConfigSecret) @@ -718,7 +718,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_ErrorOnEmptyPredefinedSecret(t *te t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" @@ -742,7 +742,7 @@ func TestTemplateRenderedWithProxy(t *testing.T) { t.Parallel() // Path to the helm chart we will test - helmChartPath, err := filepath.Abs("../../auto-scaling-runner-set") + helmChartPath, err := filepath.Abs("../../gha-runner-scale-set") require.NoError(t, err) releaseName := "test-runners" diff --git a/charts/auto-scaling-runner-set/tests/values.yaml b/charts/gha-runner-scale-set/tests/values.yaml similarity index 100% rename from charts/auto-scaling-runner-set/tests/values.yaml rename to charts/gha-runner-scale-set/tests/values.yaml diff --git a/charts/auto-scaling-runner-set/values.yaml b/charts/gha-runner-scale-set/values.yaml similarity index 98% rename from charts/auto-scaling-runner-set/values.yaml rename to charts/gha-runner-scale-set/values.yaml index 0e3b10be..f3bbc214 100644 --- a/charts/auto-scaling-runner-set/values.yaml +++ b/charts/gha-runner-scale-set/values.yaml @@ -13,7 +13,7 @@ githubConfigSecret: ### GitHub PAT Configuration github_token: "" -## If you have a pre-define Kubernetes secret in the same namespace the auto-scaling-runner-set is going to deploy, +## If you have a pre-define Kubernetes secret in the same namespace the gha-runner-scale-set is going to deploy, ## you can also reference it via `githubConfigSecret: pre-defined-secret`. ## You need to make sure your predefined secret has all the required secret data set properly. ## For a pre-defined secret using GitHub PAT, the secret needs to be created like this: diff --git a/docs/preview/actions-runner-controller-2/README.md b/docs/preview/actions-runner-controller-2/README.md index ec74acbd..9e192df0 100644 --- a/docs/preview/actions-runner-controller-2/README.md +++ b/docs/preview/actions-runner-controller-2/README.md @@ -1,211 +1 @@ -# Autoscaling Runner Scale Sets mode - -**⚠️ This mode is currently only available for a limited number of organizations.** - -This new autoscaling mode brings numerous enhancements (described in the following sections) that will make your experience more reliable and secure. - -## How it works - -![arc_hld_v1 drawio (1)](https://user-images.githubusercontent.com/568794/212665433-2d1f3d6e-0ba8-4f02-9d1b-27d00c49abd1.png) - -In addition to the increased reliability of the automatic scaling, we have worked on these improvements: - -- No longer require cert-manager as a prerequisite for installing actions-runner-controller -- Reliable scale-up based on job demands and scale-down to zero runner pods -- Reduce API requests to `api.github.com`, no more API rate-limiting problems -- The GitHub Personal Access Token (PAT) or the GitHub App installation token is no longer passed to the runner pod for runner registration -- Maximum flexibility for customizing your runner pod template - -### Demo - -https://user-images.githubusercontent.com/568794/212668313-8946ddc5-60c1-461f-a73e-27f5e8c75720.mp4 - -## Setup - -### Prerequisites - -1. Create a K8s cluster, if not available. - - If you don't have a K8s cluster, you can install a local environment using minikube. See [installing minikube](https://minikube.sigs.k8s.io/docs/start/). -1. Install helm 3, if not available. See [installing Helm](https://helm.sh/docs/intro/install/). - -### Install actions-runner-controller - -1. Install actions-runner-controller using helm 3. For additional configuration options, see [values.yaml](https://github.com/actions/actions-runner-controller/blob/master/charts/actions-runner-controller-2/values.yaml) - - ```bash - NAMESPACE="arc-systems" - helm install arc \ - --namespace "${NAMESPACE}" \ - --create-namespace \ - oci://ghcr.io/actions/actions-runner-controller-charts/actions-runner-controller-2 \ - --version 0.2.0 - ``` - -1. Generate a Personal Access Token (PAT) or create and install a GitHub App. See [Creating a personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) and [Creating a GitHub App](https://docs.github.com/en/developers/apps/creating-a-github-app). - - ℹ For the list of required permissions, see [Authenticating to the GitHub API](https://github.com/actions/actions-runner-controller/blob/master/docs/authenticating-to-the-github-api.md#authenticating-to-the-github-api). - -1. You're ready to install the autoscaling runner set. For additional configuration options, see [values.yaml](https://github.com/actions/actions-runner-controller/blob/master/charts/auto-scaling-runner-set/values.yaml) - - ℹ **Choose your installation name carefully**, you will use it as the value of `runs-on` in your workflow. - - ℹ **We recommend you choose a unique namespace in the following steps**. As a good security measure, it's best to have your runner pods created in a different namespace than the one containing the manager and listener pods. - - ```bash - # Using a Personal Access Token (PAT) - INSTALLATION_NAME="arc-runner-set" - NAMESPACE="arc-runners" - GITHUB_CONFIG_URL="https://github.com/" - GITHUB_PAT="" - helm install "${INSTALLATION_NAME}" \ - --namespace "${NAMESPACE}" \ - --create-namespace \ - --set githubConfigUrl="${GITHUB_CONFIG_URL}" \ - --set githubConfigSecret.github_token="${GITHUB_PAT}" \ - oci://ghcr.io/actions/actions-runner-controller-charts/auto-scaling-runner-set --version 0.2.0 - ``` - - ```bash - # Using a GitHub App - INSTALLATION_NAME="arc-runner-set" - NAMESPACE="arc-runners" - GITHUB_CONFIG_URL="https://github.com/" - GITHUB_APP_ID="" - GITHUB_APP_INSTALLATION_ID="" - GITHUB_APP_PRIVATE_KEY="" - helm install arc-runner-set \ - --namespace "${NAMESPACE}" \ - --create-namespace \ - --set githubConfigUrl="${GITHUB_CONFIG_URL}" \ - --set githubConfigSecret.github_app_id="${GITHUB_APP_ID}" \ - --set githubConfigSecret.github_app_installation_id="${GITHUB_APP_INSTALLATION_ID}" \ - --set githubConfigSecret.github_app_private_key="${GITHUB_APP_PRIVATE_KEY}" \ - oci://ghcr.io/actions/actions-runner-controller-charts/auto-scaling-runner-set --version 0.2.0 - ``` - -1. Check your installation. If everything went well, you should see the following: - - ```bash - $ helm list -n "${NAMESPACE}" - - NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION - arc arc-systems 1 2023-01-18 10:03:36.610534934 +0000 UTC deployed actions-runner-controller-2-0.2.0 preview - arc-runner-set arc-systems 1 2023-01-18 10:20:14.795285645 +0000 UTC deployed auto-scaling-runner-set-0.2.0 0.2.0 - ``` - - ```bash - $ kubectl get pods -n "${NAMESPACE}" - - NAME READY STATUS RESTARTS AGE - arc-actions-runner-controller-2-8c74b6f95-gr7zr 1/1 Running 0 20m - arc-runner-set-6cd58d58-listener 1/1 Running 0 21s - ``` - -1. In a repository, create a simple test workflow as follows. The `runs-on` value should match the helm installation name you used in the previous step. - - ```yaml - name: Test workflow - on: - workflow_dispatch: - - jobs: - test: - runs-on: arc-runner-set - steps: - - name: Hello world - run: echo "Hello world" - ``` - -1. Run the workflow. You should see the runner pod being created and the workflow being executed. - - ```bash - $ kubectl get pods -A - - NAMESPACE NAME READY STATUS RESTARTS AGE - arc-systems arc-actions-runner-controller-2-8c74b6f95-gr7zr 1/1 Running 0 27m - arc-systems arc-runner-set-6cd58d58-listener 1/1 Running 0 7m52s - arc-runners arc-runner-set-rmrgw-runner-p9p5n 1/1 Running 0 21s - ``` - -## Troubleshooting - -### Check the logs - -You can check the logs of the controller pod using the following command: - -```bash -# Controller logs -$ kubectl logs -n "${NAMESPACE}" -l app.kubernetes.io/name=actions-runner-controller-2 - -# Runner set listener logs -kubectl logs -n "${NAMESPACE}" -l runner-scale-set-listener=arc-systems-arc-runner-set -``` - -### If you installed the autoscaling runner set, but the listener pod is not created - -Verify that the secret you provided is correct and that the `githubConfigUrl` you provided is accurate. - -## Changelog - -### v0.2.0 - -#### Major changes - -1. Added proxy support for the controller and the runner pods, see the new helm chart fields [#2286](https://github.com/actions/actions-runner-controller/pull/2286) -1. Added the abiilty to provide a pre-defined kubernetes secret for the auto scaling runner set helm chart [#2234](https://github.com/actions/actions-runner-controller/pull/2234) -1. Enhanced security posture by removing un-required permissions for the manager-role [#2260](https://github.com/actions/actions-runner-controller/pull/2260) -1. Enhanced our logging by returning an error when a runner group is defined in the values file but it's not created in GitHub [#2215](https://github.com/actions/actions-runner-controller/pull/2215) -1. Fixed helm charts issues that were preventing the use of DinD [#2291](https://github.com/actions/actions-runner-controller/pull/2291) -1. Fixed a bug that was preventing runner scale from being removed from the backend when they were deleted from the cluster [#2255](https://github.com/actions/actions-runner-controller/pull/2255) [#2223](https://github.com/actions/actions-runner-controller/pull/2223) -1. Fixed bugs with the helm chart definitions preventing certain values from being set [#2222](https://github.com/actions/actions-runner-controller/pull/2222) -1. Fixed a bug that prevented the configuration of a runner group for a runner scale set [#2216](https://github.com/actions/actions-runner-controller/pull/2216) - -#### Log - -- [1c7b7f4](https://github.com/actions/actions-runner-controller/commit/1c7b7f4) Bump arc-2 chart version and prepare 0.2.0 release [#2313](https://github.com/actions/actions-runner-controller/pull/2313) -- [73e22a1](https://github.com/actions/actions-runner-controller/commit/73e22a1) Disable metrics serving in proxy tests [#2307](https://github.com/actions/actions-runner-controller/pull/2307) -- [9b44f00](https://github.com/actions/actions-runner-controller/commit/9b44f00) Documentation corrections [#2116](https://github.com/actions/actions-runner-controller/pull/2116) -- [6b4250c](https://github.com/actions/actions-runner-controller/commit/6b4250c) Add support for proxy [#2286](https://github.com/actions/actions-runner-controller/pull/2286) -- [ced8822](https://github.com/actions/actions-runner-controller/commit/ced8822) Resolves the erroneous webhook scale down due to check runs [#2119](https://github.com/actions/actions-runner-controller/pull/2119) -- [44c06c2](https://github.com/actions/actions-runner-controller/commit/44c06c2) fix: case-insensitive webhook label matching [#2302](https://github.com/actions/actions-runner-controller/pull/2302) -- [4103fe3](https://github.com/actions/actions-runner-controller/commit/4103fe3) Use DOCKER_IMAGE_NAME instead of NAME to avoid conflict. [#2303](https://github.com/actions/actions-runner-controller/pull/2303) -- [a44fe04](https://github.com/actions/actions-runner-controller/commit/a44fe04) Fix manager crashloopback for ARC deployments without scaleset-related controllers [#2293](https://github.com/actions/actions-runner-controller/pull/2293) -- [274d0c8](https://github.com/actions/actions-runner-controller/commit/274d0c8) Added ability to configure log level from chart values [#2252](https://github.com/actions/actions-runner-controller/pull/2252) -- [256e08e](https://github.com/actions/actions-runner-controller/commit/256e08e) Ask runner to wait for docker daemon from DinD. [#2292](https://github.com/actions/actions-runner-controller/pull/2292) -- [f677fd5](https://github.com/actions/actions-runner-controller/commit/f677fd5) doc: Fix chart name for helm commands in docs [#2287](https://github.com/actions/actions-runner-controller/pull/2287) -- [d962714](https://github.com/actions/actions-runner-controller/commit/d962714) Fix helm chart when containerMode.type=dind. [#2291](https://github.com/actions/actions-runner-controller/pull/2291) -- [3886f28](https://github.com/actions/actions-runner-controller/commit/3886f28) Add EKS test environment Terraform templates [#2290](https://github.com/actions/actions-runner-controller/pull/2290) -- [dab9004](https://github.com/actions/actions-runner-controller/commit/dab9004) Added workflow to be triggered via rest api dispatch in e2e test [#2283](https://github.com/actions/actions-runner-controller/pull/2283) -- [dd8ec1a](https://github.com/actions/actions-runner-controller/commit/dd8ec1a) Add testserver package [#2281](https://github.com/actions/actions-runner-controller/pull/2281) -- [8e52a6d](https://github.com/actions/actions-runner-controller/commit/8e52a6d) EphemeralRunner: On cleanup, if pod is pending, delete from service [#2255](https://github.com/actions/actions-runner-controller/pull/2255) -- [9990243](https://github.com/actions/actions-runner-controller/commit/9990243) Early return if finalizer does not exist to make it more readable [#2262](https://github.com/actions/actions-runner-controller/pull/2262) -- [0891981](https://github.com/actions/actions-runner-controller/commit/0891981) Port ADRs from internal repo [#2267](https://github.com/actions/actions-runner-controller/pull/2267) -- [facae69](https://github.com/actions/actions-runner-controller/commit/facae69) Remove un-required permissions for the manager-role of the new `AutoScalingRunnerSet` [#2260](https://github.com/actions/actions-runner-controller/pull/2260) -- [8f62e35](https://github.com/actions/actions-runner-controller/commit/8f62e35) Add options to multi client [#2257](https://github.com/actions/actions-runner-controller/pull/2257) -- [55951c2](https://github.com/actions/actions-runner-controller/commit/55951c2) Add new workflow to automate runner updates [#2247](https://github.com/actions/actions-runner-controller/pull/2247) -- [c4297d2](https://github.com/actions/actions-runner-controller/commit/c4297d2) Avoid deleting scale set if annotation is not parsable or if it does not exist [#2239](https://github.com/actions/actions-runner-controller/pull/2239) -- [0774f06](https://github.com/actions/actions-runner-controller/commit/0774f06) ADR: automate runner updates [#2244](https://github.com/actions/actions-runner-controller/pull/2244) -- [92ab11b](https://github.com/actions/actions-runner-controller/commit/92ab11b) Use UUID v5 for client identifiers [#2241](https://github.com/actions/actions-runner-controller/pull/2241) -- [7414dc6](https://github.com/actions/actions-runner-controller/commit/7414dc6) Add Identifier to actions.Client [#2237](https://github.com/actions/actions-runner-controller/pull/2237) -- [34efb9d](https://github.com/actions/actions-runner-controller/commit/34efb9d) Add documentation to update ARC with prometheus CRDs needed by actions metrics server [#2209](https://github.com/actions/actions-runner-controller/pull/2209) -- [fbad561](https://github.com/actions/actions-runner-controller/commit/fbad561) Allow provide pre-defined kubernetes secret when helm-install AutoScalingRunnerSet [#2234](https://github.com/actions/actions-runner-controller/pull/2234) -- [a5cef7e](https://github.com/actions/actions-runner-controller/commit/a5cef7e) Resolve CI break due to bad merge. [#2236](https://github.com/actions/actions-runner-controller/pull/2236) -- [1f4fe46](https://github.com/actions/actions-runner-controller/commit/1f4fe46) Delete RunnerScaleSet on service when AutoScalingRunnerSet is deleted. [#2223](https://github.com/actions/actions-runner-controller/pull/2223) -- [067686c](https://github.com/actions/actions-runner-controller/commit/067686c) Fix typos and markdown structure in troubleshooting guide [#2148](https://github.com/actions/actions-runner-controller/pull/2148) -- [df12e00](https://github.com/actions/actions-runner-controller/commit/df12e00) Remove network requests from actions.NewClient [#2219](https://github.com/actions/actions-runner-controller/pull/2219) -- [cc26593](https://github.com/actions/actions-runner-controller/commit/cc26593) Skip CT when list-changed=false. [#2228](https://github.com/actions/actions-runner-controller/pull/2228) -- [835eac7](https://github.com/actions/actions-runner-controller/commit/835eac7) Fix helm charts when pass values file. [#2222](https://github.com/actions/actions-runner-controller/pull/2222) -- [01e9dd3](https://github.com/actions/actions-runner-controller/commit/01e9dd3) Update Validate ARC workflow to go 1.19 [#2220](https://github.com/actions/actions-runner-controller/pull/2220) -- [8038181](https://github.com/actions/actions-runner-controller/commit/8038181) Allow update runner group for AutoScalingRunnerSet [#2216](https://github.com/actions/actions-runner-controller/pull/2216) -- [219ba5b](https://github.com/actions/actions-runner-controller/commit/219ba5b) chore(deps): bump sigs.k8s.io/controller-runtime from 0.13.1 to 0.14.1 [#2132](https://github.com/actions/actions-runner-controller/pull/2132) -- [b09e3a2](https://github.com/actions/actions-runner-controller/commit/b09e3a2) Return error for non-existing runner group. [#2215](https://github.com/actions/actions-runner-controller/pull/2215) -- [7ea60e4](https://github.com/actions/actions-runner-controller/commit/7ea60e4) Fix intermittent image push failures to GHCR [#2214](https://github.com/actions/actions-runner-controller/pull/2214) -- [c8918f5](https://github.com/actions/actions-runner-controller/commit/c8918f5) Fix URL for authenticating using a GitHub app [#2206](https://github.com/actions/actions-runner-controller/pull/2206) -- [d57d17f](https://github.com/actions/actions-runner-controller/commit/d57d17f) Add support for custom CA in actions.Client [#2199](https://github.com/actions/actions-runner-controller/pull/2199) -- [6e69c75](https://github.com/actions/actions-runner-controller/commit/6e69c75) chore(deps): bump github.com/hashicorp/go-retryablehttp from 0.7.1 to 0.7.2 [#2203](https://github.com/actions/actions-runner-controller/pull/2203) -- [882bfab](https://github.com/actions/actions-runner-controller/commit/882bfab) Renaming autoScaling to autoscaling in tests matching the convention [#2201](https://github.com/actions/actions-runner-controller/pull/2201) -- [3327f62](https://github.com/actions/actions-runner-controller/commit/3327f62) Refactor actions.Client with options to help extensibility [#2193](https://github.com/actions/actions-runner-controller/pull/2193) -- [282f2dd](https://github.com/actions/actions-runner-controller/commit/282f2dd) chore(deps): bump github.com/onsi/gomega from 1.20.2 to 1.25.0 [#2169](https://github.com/actions/actions-runner-controller/pull/2169) -- [d67f808](https://github.com/actions/actions-runner-controller/commit/d67f808) Include nikola-jokic in CODEOWNERS file [#2184](https://github.com/actions/actions-runner-controller/pull/2184) -- [4932412](https://github.com/actions/actions-runner-controller/commit/4932412) Fix L0 test to make it more reliable. [#2178](https://github.com/actions/actions-runner-controller/pull/2178) -- [6da1cde](https://github.com/actions/actions-runner-controller/commit/6da1cde) Update runner version to 2.301.1 [#2182](https://github.com/actions/actions-runner-controller/pull/2182) -- [f9bae70](https://github.com/actions/actions-runner-controller/commit/f9bae70) Add distinct namespace best practice note [#2181](https://github.com/actions/actions-runner-controller/pull/2181) -- [05a3908](https://github.com/actions/actions-runner-controller/commit/05a3908) Add arc-2 quickstart guide [#2180](https://github.com/actions/actions-runner-controller/pull/2180) -- [606ed1b](https://github.com/actions/actions-runner-controller/commit/606ed1b) Add Repository information to Runner Status [#2093](https://github.com/actions/actions-runner-controller/pull/2093) +301 - MOVED TO [../gha-runner-scale-set-controller/README.md](../gha-runner-scale-set-controller/README.md) \ No newline at end of file diff --git a/docs/preview/gha-runner-scale-set-controller/README.md b/docs/preview/gha-runner-scale-set-controller/README.md new file mode 100644 index 00000000..791d33cc --- /dev/null +++ b/docs/preview/gha-runner-scale-set-controller/README.md @@ -0,0 +1,211 @@ +# Autoscaling Runner Scale Sets mode + +**⚠️ This mode is currently only available for a limited number of organizations.** + +This new autoscaling mode brings numerous enhancements (described in the following sections) that will make your experience more reliable and secure. + +## How it works + +![arc_hld_v1 drawio (1)](https://user-images.githubusercontent.com/568794/212665433-2d1f3d6e-0ba8-4f02-9d1b-27d00c49abd1.png) + +In addition to the increased reliability of the automatic scaling, we have worked on these improvements: + +- No longer require cert-manager as a prerequisite for installing actions-runner-controller +- Reliable scale-up based on job demands and scale-down to zero runner pods +- Reduce API requests to `api.github.com`, no more API rate-limiting problems +- The GitHub Personal Access Token (PAT) or the GitHub App installation token is no longer passed to the runner pod for runner registration +- Maximum flexibility for customizing your runner pod template + +### Demo + +https://user-images.githubusercontent.com/568794/212668313-8946ddc5-60c1-461f-a73e-27f5e8c75720.mp4 + +## Setup + +### Prerequisites + +1. Create a K8s cluster, if not available. + - If you don't have a K8s cluster, you can install a local environment using minikube. See [installing minikube](https://minikube.sigs.k8s.io/docs/start/). +1. Install helm 3, if not available. See [installing Helm](https://helm.sh/docs/intro/install/). + +### Install actions-runner-controller + +1. Install actions-runner-controller using helm 3. For additional configuration options, see [values.yaml](https://github.com/actions/actions-runner-controller/blob/master/charts/gha-runner-scale-set-controller/values.yaml) + + ```bash + NAMESPACE="arc-systems" + helm install arc \ + --namespace "${NAMESPACE}" \ + --create-namespace \ + oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller \ + --version 0.2.0 + ``` + +1. Generate a Personal Access Token (PAT) or create and install a GitHub App. See [Creating a personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) and [Creating a GitHub App](https://docs.github.com/en/developers/apps/creating-a-github-app). + - ℹ For the list of required permissions, see [Authenticating to the GitHub API](https://github.com/actions/actions-runner-controller/blob/master/docs/authenticating-to-the-github-api.md#authenticating-to-the-github-api). + +1. You're ready to install the autoscaling runner set. For additional configuration options, see [values.yaml](https://github.com/actions/actions-runner-controller/blob/master/charts/gha-runner-scale-set/values.yaml) + - ℹ **Choose your installation name carefully**, you will use it as the value of `runs-on` in your workflow. + - ℹ **We recommend you choose a unique namespace in the following steps**. As a good security measure, it's best to have your runner pods created in a different namespace than the one containing the manager and listener pods. + + ```bash + # Using a Personal Access Token (PAT) + INSTALLATION_NAME="arc-runner-set" + NAMESPACE="arc-runners" + GITHUB_CONFIG_URL="https://github.com/" + GITHUB_PAT="" + helm install "${INSTALLATION_NAME}" \ + --namespace "${NAMESPACE}" \ + --create-namespace \ + --set githubConfigUrl="${GITHUB_CONFIG_URL}" \ + --set githubConfigSecret.github_token="${GITHUB_PAT}" \ + oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set --version 0.2.0 + ``` + + ```bash + # Using a GitHub App + INSTALLATION_NAME="arc-runner-set" + NAMESPACE="arc-runners" + GITHUB_CONFIG_URL="https://github.com/" + GITHUB_APP_ID="" + GITHUB_APP_INSTALLATION_ID="" + GITHUB_APP_PRIVATE_KEY="" + helm install arc-runner-set \ + --namespace "${NAMESPACE}" \ + --create-namespace \ + --set githubConfigUrl="${GITHUB_CONFIG_URL}" \ + --set githubConfigSecret.github_app_id="${GITHUB_APP_ID}" \ + --set githubConfigSecret.github_app_installation_id="${GITHUB_APP_INSTALLATION_ID}" \ + --set githubConfigSecret.github_app_private_key="${GITHUB_APP_PRIVATE_KEY}" \ + oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set --version 0.2.0 + ``` + +1. Check your installation. If everything went well, you should see the following: + + ```bash + $ helm list -n "${NAMESPACE}" + + NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION + arc arc-systems 1 2023-01-18 10:03:36.610534934 +0000 UTC deployed gha-runner-scale-set-controller-0.2.0 preview + arc-runner-set arc-systems 1 2023-01-18 10:20:14.795285645 +0000 UTC deployed gha-runner-scale-set-0.2.0 0.2.0 + ``` + + ```bash + $ kubectl get pods -n "${NAMESPACE}" + + NAME READY STATUS RESTARTS AGE + arc-gha-runner-scale-set-controller-8c74b6f95-gr7zr 1/1 Running 0 20m + arc-runner-set-6cd58d58-listener 1/1 Running 0 21s + ``` + +1. In a repository, create a simple test workflow as follows. The `runs-on` value should match the helm installation name you used in the previous step. + + ```yaml + name: Test workflow + on: + workflow_dispatch: + + jobs: + test: + runs-on: arc-runner-set + steps: + - name: Hello world + run: echo "Hello world" + ``` + +1. Run the workflow. You should see the runner pod being created and the workflow being executed. + + ```bash + $ kubectl get pods -A + + NAMESPACE NAME READY STATUS RESTARTS AGE + arc-systems arc-gha-runner-scale-set-controller-8c74b6f95-gr7zr 1/1 Running 0 27m + arc-systems arc-runner-set-6cd58d58-listener 1/1 Running 0 7m52s + arc-runners arc-runner-set-rmrgw-runner-p9p5n 1/1 Running 0 21s + ``` + +## Troubleshooting + +### Check the logs + +You can check the logs of the controller pod using the following command: + +```bash +# Controller logs +$ kubectl logs -n "${NAMESPACE}" -l app.kubernetes.io/name=gha-runner-scale-set-controller + +# Runner set listener logs +kubectl logs -n "${NAMESPACE}" -l runner-scale-set-listener=arc-systems-arc-runner-set +``` + +### If you installed the autoscaling runner set, but the listener pod is not created + +Verify that the secret you provided is correct and that the `githubConfigUrl` you provided is accurate. + +## Changelog + +### v0.2.0 + +#### Major changes + +1. Added proxy support for the controller and the runner pods, see the new helm chart fields [#2286](https://github.com/actions/actions-runner-controller/pull/2286) +1. Added the abiilty to provide a pre-defined kubernetes secret for the auto scaling runner set helm chart [#2234](https://github.com/actions/actions-runner-controller/pull/2234) +1. Enhanced security posture by removing un-required permissions for the manager-role [#2260](https://github.com/actions/actions-runner-controller/pull/2260) +1. Enhanced our logging by returning an error when a runner group is defined in the values file but it's not created in GitHub [#2215](https://github.com/actions/actions-runner-controller/pull/2215) +1. Fixed helm charts issues that were preventing the use of DinD [#2291](https://github.com/actions/actions-runner-controller/pull/2291) +1. Fixed a bug that was preventing runner scale from being removed from the backend when they were deleted from the cluster [#2255](https://github.com/actions/actions-runner-controller/pull/2255) [#2223](https://github.com/actions/actions-runner-controller/pull/2223) +1. Fixed bugs with the helm chart definitions preventing certain values from being set [#2222](https://github.com/actions/actions-runner-controller/pull/2222) +1. Fixed a bug that prevented the configuration of a runner group for a runner scale set [#2216](https://github.com/actions/actions-runner-controller/pull/2216) + +#### Log + +- [1c7b7f4](https://github.com/actions/actions-runner-controller/commit/1c7b7f4) Bump arc-2 chart version and prepare 0.2.0 release [#2313](https://github.com/actions/actions-runner-controller/pull/2313) +- [73e22a1](https://github.com/actions/actions-runner-controller/commit/73e22a1) Disable metrics serving in proxy tests [#2307](https://github.com/actions/actions-runner-controller/pull/2307) +- [9b44f00](https://github.com/actions/actions-runner-controller/commit/9b44f00) Documentation corrections [#2116](https://github.com/actions/actions-runner-controller/pull/2116) +- [6b4250c](https://github.com/actions/actions-runner-controller/commit/6b4250c) Add support for proxy [#2286](https://github.com/actions/actions-runner-controller/pull/2286) +- [ced8822](https://github.com/actions/actions-runner-controller/commit/ced8822) Resolves the erroneous webhook scale down due to check runs [#2119](https://github.com/actions/actions-runner-controller/pull/2119) +- [44c06c2](https://github.com/actions/actions-runner-controller/commit/44c06c2) fix: case-insensitive webhook label matching [#2302](https://github.com/actions/actions-runner-controller/pull/2302) +- [4103fe3](https://github.com/actions/actions-runner-controller/commit/4103fe3) Use DOCKER_IMAGE_NAME instead of NAME to avoid conflict. [#2303](https://github.com/actions/actions-runner-controller/pull/2303) +- [a44fe04](https://github.com/actions/actions-runner-controller/commit/a44fe04) Fix manager crashloopback for ARC deployments without scaleset-related controllers [#2293](https://github.com/actions/actions-runner-controller/pull/2293) +- [274d0c8](https://github.com/actions/actions-runner-controller/commit/274d0c8) Added ability to configure log level from chart values [#2252](https://github.com/actions/actions-runner-controller/pull/2252) +- [256e08e](https://github.com/actions/actions-runner-controller/commit/256e08e) Ask runner to wait for docker daemon from DinD. [#2292](https://github.com/actions/actions-runner-controller/pull/2292) +- [f677fd5](https://github.com/actions/actions-runner-controller/commit/f677fd5) doc: Fix chart name for helm commands in docs [#2287](https://github.com/actions/actions-runner-controller/pull/2287) +- [d962714](https://github.com/actions/actions-runner-controller/commit/d962714) Fix helm chart when containerMode.type=dind. [#2291](https://github.com/actions/actions-runner-controller/pull/2291) +- [3886f28](https://github.com/actions/actions-runner-controller/commit/3886f28) Add EKS test environment Terraform templates [#2290](https://github.com/actions/actions-runner-controller/pull/2290) +- [dab9004](https://github.com/actions/actions-runner-controller/commit/dab9004) Added workflow to be triggered via rest api dispatch in e2e test [#2283](https://github.com/actions/actions-runner-controller/pull/2283) +- [dd8ec1a](https://github.com/actions/actions-runner-controller/commit/dd8ec1a) Add testserver package [#2281](https://github.com/actions/actions-runner-controller/pull/2281) +- [8e52a6d](https://github.com/actions/actions-runner-controller/commit/8e52a6d) EphemeralRunner: On cleanup, if pod is pending, delete from service [#2255](https://github.com/actions/actions-runner-controller/pull/2255) +- [9990243](https://github.com/actions/actions-runner-controller/commit/9990243) Early return if finalizer does not exist to make it more readable [#2262](https://github.com/actions/actions-runner-controller/pull/2262) +- [0891981](https://github.com/actions/actions-runner-controller/commit/0891981) Port ADRs from internal repo [#2267](https://github.com/actions/actions-runner-controller/pull/2267) +- [facae69](https://github.com/actions/actions-runner-controller/commit/facae69) Remove un-required permissions for the manager-role of the new `AutoScalingRunnerSet` [#2260](https://github.com/actions/actions-runner-controller/pull/2260) +- [8f62e35](https://github.com/actions/actions-runner-controller/commit/8f62e35) Add options to multi client [#2257](https://github.com/actions/actions-runner-controller/pull/2257) +- [55951c2](https://github.com/actions/actions-runner-controller/commit/55951c2) Add new workflow to automate runner updates [#2247](https://github.com/actions/actions-runner-controller/pull/2247) +- [c4297d2](https://github.com/actions/actions-runner-controller/commit/c4297d2) Avoid deleting scale set if annotation is not parsable or if it does not exist [#2239](https://github.com/actions/actions-runner-controller/pull/2239) +- [0774f06](https://github.com/actions/actions-runner-controller/commit/0774f06) ADR: automate runner updates [#2244](https://github.com/actions/actions-runner-controller/pull/2244) +- [92ab11b](https://github.com/actions/actions-runner-controller/commit/92ab11b) Use UUID v5 for client identifiers [#2241](https://github.com/actions/actions-runner-controller/pull/2241) +- [7414dc6](https://github.com/actions/actions-runner-controller/commit/7414dc6) Add Identifier to actions.Client [#2237](https://github.com/actions/actions-runner-controller/pull/2237) +- [34efb9d](https://github.com/actions/actions-runner-controller/commit/34efb9d) Add documentation to update ARC with prometheus CRDs needed by actions metrics server [#2209](https://github.com/actions/actions-runner-controller/pull/2209) +- [fbad561](https://github.com/actions/actions-runner-controller/commit/fbad561) Allow provide pre-defined kubernetes secret when helm-install AutoScalingRunnerSet [#2234](https://github.com/actions/actions-runner-controller/pull/2234) +- [a5cef7e](https://github.com/actions/actions-runner-controller/commit/a5cef7e) Resolve CI break due to bad merge. [#2236](https://github.com/actions/actions-runner-controller/pull/2236) +- [1f4fe46](https://github.com/actions/actions-runner-controller/commit/1f4fe46) Delete RunnerScaleSet on service when AutoScalingRunnerSet is deleted. [#2223](https://github.com/actions/actions-runner-controller/pull/2223) +- [067686c](https://github.com/actions/actions-runner-controller/commit/067686c) Fix typos and markdown structure in troubleshooting guide [#2148](https://github.com/actions/actions-runner-controller/pull/2148) +- [df12e00](https://github.com/actions/actions-runner-controller/commit/df12e00) Remove network requests from actions.NewClient [#2219](https://github.com/actions/actions-runner-controller/pull/2219) +- [cc26593](https://github.com/actions/actions-runner-controller/commit/cc26593) Skip CT when list-changed=false. [#2228](https://github.com/actions/actions-runner-controller/pull/2228) +- [835eac7](https://github.com/actions/actions-runner-controller/commit/835eac7) Fix helm charts when pass values file. [#2222](https://github.com/actions/actions-runner-controller/pull/2222) +- [01e9dd3](https://github.com/actions/actions-runner-controller/commit/01e9dd3) Update Validate ARC workflow to go 1.19 [#2220](https://github.com/actions/actions-runner-controller/pull/2220) +- [8038181](https://github.com/actions/actions-runner-controller/commit/8038181) Allow update runner group for AutoScalingRunnerSet [#2216](https://github.com/actions/actions-runner-controller/pull/2216) +- [219ba5b](https://github.com/actions/actions-runner-controller/commit/219ba5b) chore(deps): bump sigs.k8s.io/controller-runtime from 0.13.1 to 0.14.1 [#2132](https://github.com/actions/actions-runner-controller/pull/2132) +- [b09e3a2](https://github.com/actions/actions-runner-controller/commit/b09e3a2) Return error for non-existing runner group. [#2215](https://github.com/actions/actions-runner-controller/pull/2215) +- [7ea60e4](https://github.com/actions/actions-runner-controller/commit/7ea60e4) Fix intermittent image push failures to GHCR [#2214](https://github.com/actions/actions-runner-controller/pull/2214) +- [c8918f5](https://github.com/actions/actions-runner-controller/commit/c8918f5) Fix URL for authenticating using a GitHub app [#2206](https://github.com/actions/actions-runner-controller/pull/2206) +- [d57d17f](https://github.com/actions/actions-runner-controller/commit/d57d17f) Add support for custom CA in actions.Client [#2199](https://github.com/actions/actions-runner-controller/pull/2199) +- [6e69c75](https://github.com/actions/actions-runner-controller/commit/6e69c75) chore(deps): bump github.com/hashicorp/go-retryablehttp from 0.7.1 to 0.7.2 [#2203](https://github.com/actions/actions-runner-controller/pull/2203) +- [882bfab](https://github.com/actions/actions-runner-controller/commit/882bfab) Renaming autoScaling to autoscaling in tests matching the convention [#2201](https://github.com/actions/actions-runner-controller/pull/2201) +- [3327f62](https://github.com/actions/actions-runner-controller/commit/3327f62) Refactor actions.Client with options to help extensibility [#2193](https://github.com/actions/actions-runner-controller/pull/2193) +- [282f2dd](https://github.com/actions/actions-runner-controller/commit/282f2dd) chore(deps): bump github.com/onsi/gomega from 1.20.2 to 1.25.0 [#2169](https://github.com/actions/actions-runner-controller/pull/2169) +- [d67f808](https://github.com/actions/actions-runner-controller/commit/d67f808) Include nikola-jokic in CODEOWNERS file [#2184](https://github.com/actions/actions-runner-controller/pull/2184) +- [4932412](https://github.com/actions/actions-runner-controller/commit/4932412) Fix L0 test to make it more reliable. [#2178](https://github.com/actions/actions-runner-controller/pull/2178) +- [6da1cde](https://github.com/actions/actions-runner-controller/commit/6da1cde) Update runner version to 2.301.1 [#2182](https://github.com/actions/actions-runner-controller/pull/2182) +- [f9bae70](https://github.com/actions/actions-runner-controller/commit/f9bae70) Add distinct namespace best practice note [#2181](https://github.com/actions/actions-runner-controller/pull/2181) +- [05a3908](https://github.com/actions/actions-runner-controller/commit/05a3908) Add arc-2 quickstart guide [#2180](https://github.com/actions/actions-runner-controller/pull/2180) +- [606ed1b](https://github.com/actions/actions-runner-controller/commit/606ed1b) Add Repository information to Runner Status [#2093](https://github.com/actions/actions-runner-controller/pull/2093) diff --git a/test/platforms/aws-eks/README.md b/test/platforms/aws-eks/README.md index 354d1df8..a1165dd1 100644 --- a/test/platforms/aws-eks/README.md +++ b/test/platforms/aws-eks/README.md @@ -64,7 +64,7 @@ aws eks --region "${AWS_REGION}" update-kubeconfig \ kubectl cluster-info ``` -Setup ARC by following [this quick-start guide](https://github.com/actions/actions-runner-controller/tree/master/docs/preview/actions-runner-controller-2). +Setup ARC by following [this quick-start guide](https://github.com/actions/actions-runner-controller/tree/master/docs/preview/gha-runner-scale-set-controller). ### Troubleshooting