diff --git a/.github/workflows/bundle-push.yaml b/.github/workflows/bundle-push.yaml index a69aeec..3f8f21a 100644 --- a/.github/workflows/bundle-push.yaml +++ b/.github/workflows/bundle-push.yaml @@ -33,6 +33,7 @@ jobs: echo "IMG=ghcr.io/${GITHUB_REPOSITORY,,}:$TAG" >> $GITHUB_ENV echo "BUNDLE_IMG=ghcr.io/${GITHUB_REPOSITORY,,}-bundle:$TAG" >> $GITHUB_ENV echo "CATALOG_IMG=ghcr.io/${GITHUB_REPOSITORY,,}-catalog:$TAG" >> $GITHUB_ENV + echo "IMAGE_TAG_BASE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV - name: Install operator-sdk run: | @@ -52,5 +53,6 @@ jobs: - name: Build and Push Images shell: bash run: | + cd simple-arc-operator/ make docker-build docker-push make bundle bundle-build bundle-push catalog-build catalog-push diff --git a/.github/workflows/generate-operator.yaml b/.github/workflows/generate-operator.yaml new file mode 100644 index 0000000..633303d --- /dev/null +++ b/.github/workflows/generate-operator.yaml @@ -0,0 +1,47 @@ +name: GitHub Actions Demo +on: + push: + branches: + - codify-changes + workflow_dispatch: + +jobs: + containers: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install operator-sdk + run: | + export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac) + export OS=$(uname | awk '{print tolower($0)}') + export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0 + curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH} + chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk + + - name: Initialize Operator + run: | + rm -rf simple-arc-operator + mkdir simple-arc-operator + cd simple-arc-operator + operator-sdk init \ + --plugins helm \ + --domain boxboat.com \ + --group github-practice \ + --helm-chart actions-runner-controller \ + --helm-chart-repo https://actions-runner-controller.github.io/actions-runner-controller + + - name: Configure Operator Manifests + run: | + ./chart-patch.sh + cat overlays/resource_limits.yaml >> simple-arc-operator/config/manager/kustomization.yaml + cat overlays/role_permissions.yaml >> simple-arc-operator/config/rbac/kustomization.yaml + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + branch: new-release + title: Regenerated operator with new chart version + diff --git a/chart-patch.sh b/chart-patch.sh new file mode 100755 index 0000000..56dfee9 --- /dev/null +++ b/chart-patch.sh @@ -0,0 +1,6 @@ +filepath="simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role.yaml" +headStart=$(grep -n "rules:" $filepath | awk -F':' '{print $1}') +tailStart=$(($headStart + 1)) +head -n${headStart} $filepath > head +tail -n+${tailStart} $filepath > tail +cat head overlays/patch.yaml tail > $filepath \ No newline at end of file diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml deleted file mode 100644 index 6c40015..0000000 --- a/config/default/manager_config_patch.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system -spec: - template: - spec: - containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml deleted file mode 100644 index 9c8157a..0000000 --- a/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 - -leaderElection: - leaderElect: true - resourceName: 811c9dc5.example.com -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml deleted file mode 100644 index a09f958..0000000 --- a/config/manager/kustomization.yaml +++ /dev/null @@ -1,16 +0,0 @@ -resources: -- manager.yaml - -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: -- files: - - controller_manager_config.yaml - name: manager-config -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -images: -- name: controller - newName: ghcr.io/boxboat-github-practice/simple-arc-operator - newTag: "20230103.2" diff --git a/config/rbac/actionsrunnercontroller_viewer_role.yaml b/config/rbac/actionsrunnercontroller_viewer_role.yaml deleted file mode 100644 index e0ce8db..0000000 --- a/config/rbac/actionsrunnercontroller_viewer_role.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# permissions for end users to view actionsrunnercontrollers. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: actionsrunnercontroller-viewer-role -rules: -- apiGroups: - - charts.example.com - resources: - - actionsrunnercontrollers - verbs: - - get - - list - - watch -- apiGroups: - - charts.example.com - resources: - - actionsrunnercontrollers/status - verbs: - - get diff --git a/config/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml deleted file mode 100644 index 51a75db..0000000 --- a/config/rbac/auth_proxy_client_clusterrole.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: metrics-reader -rules: -- nonResourceURLs: - - "/metrics" - verbs: - - get diff --git a/config/rbac/auth_proxy_role.yaml b/config/rbac/auth_proxy_role.yaml deleted file mode 100644 index 80e1857..0000000 --- a/config/rbac/auth_proxy_role.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: proxy-role -rules: -- apiGroups: - - authentication.k8s.io - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - authorization.k8s.io - resources: - - subjectaccessreviews - verbs: - - create diff --git a/config/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml deleted file mode 100644 index ec7acc0..0000000 --- a/config/rbac/auth_proxy_role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: proxy-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: proxy-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/config/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml deleted file mode 100644 index 71f1797..0000000 --- a/config/rbac/auth_proxy_service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - control-plane: controller-manager - name: controller-manager-metrics-service - namespace: system -spec: - ports: - - name: https - port: 8443 - protocol: TCP - targetPort: https - selector: - control-plane: controller-manager diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml deleted file mode 100644 index 1d1321e..0000000 --- a/config/rbac/leader_election_role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: leader-election-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: leader-election-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml deleted file mode 100644 index 2070ede..0000000 --- a/config/rbac/role_binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: manager-rolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: manager-role -subjects: -- kind: ServiceAccount - name: controller-manager - namespace: system diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml deleted file mode 100644 index 7cd6025..0000000 --- a/config/rbac/service_account.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: controller-manager - namespace: system diff --git a/config/samples/multiple-sample-1.yaml b/config/samples/multiple-sample-1.yaml deleted file mode 100644 index ff91d31..0000000 --- a/config/samples/multiple-sample-1.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: charts.example.com/v1alpha1 -kind: ActionsRunnerController -metadata: - name: actionsrunnercontroller-sample-1 - namespace: arc-controllers -spec: - leaderElectionId: 1 - authSecret: - name: arc-secret-1 - create: true - github_token: - scope: - singleNamespace: true - watchNamespace: test1 diff --git a/config/samples/multiple-sample-2.yaml b/config/samples/multiple-sample-2.yaml deleted file mode 100644 index 6e0fb95..0000000 --- a/config/samples/multiple-sample-2.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: charts.example.com/v1alpha1 -kind: ActionsRunnerController -metadata: - name: actionsrunnercontroller-sample-2 - namespace: arc-controllers -spec: - leaderElectionId: 2 - authSecret: - name: arc-secret-2 - create: true - github_token: - scope: - singleNamespace: true - watchNamespace: test2 diff --git a/config/samples/runner-deployment.yaml b/config/samples/runner-deployment.yaml deleted file mode 100644 index fd2fcbc..0000000 --- a/config/samples/runner-deployment.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: actions.summerwind.dev/v1alpha1 -kind: RunnerDeployment -metadata: - name: example-runnerdeploy -spec: - replicas: 1 - template: - spec: - repository: boxboat-github-practice/simple-arc-operator diff --git a/config/samples/simple-sample.yaml b/config/samples/simple-sample.yaml deleted file mode 100644 index 4a9e196..0000000 --- a/config/samples/simple-sample.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: charts.example.com/v1alpha1 -kind: ActionsRunnerController -metadata: - name: actionsrunnercontroller-sample-1 -spec: - authSecret: - create: true - github_token: \ No newline at end of file diff --git a/head b/head new file mode 100644 index 0000000..d8e179a --- /dev/null +++ b/head @@ -0,0 +1,6 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: {{ include "actions-runner-controller.managerRoleName" . }} +rules: diff --git a/helm-charts/actions-runner-controller/README.md b/helm-charts/actions-runner-controller/README.md deleted file mode 100644 index ddcab5d..0000000 --- a/helm-charts/actions-runner-controller/README.md +++ /dev/null @@ -1,112 +0,0 @@ -## Docs - -All additional docs are kept in the `docs/` folder, this README is solely for documenting the values.yaml keys and values - -## Values - -**_The values are documented as of HEAD, to review the configuration options for your chart version ensure you view this file at the relevant [tag](https://github.com/actions-runner-controller/actions-runner-controller/tags)_** - -> _Default values are the defaults set in the charts `values.yaml`, some properties have default configurations in the code for when the property is omitted or invalid_ - -| Key | Description | Default | -|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| -| `labels` | Set labels to apply to all resources in the chart | | -| `replicaCount` | Set the number of controller pods | 1 | -| `webhookPort` | Set the containerPort for the webhook Pod | 9443 | -| `syncPeriod` | Set the period in which the controller reconciles the desired runners count | 1m | -| `enableLeaderElection` | Enable election configuration | true | -| `leaderElectionId` | Set the election ID for the controller group | | -| `githubEnterpriseServerURL` | Set the URL for a self-hosted GitHub Enterprise Server | | -| `githubURL` | Override GitHub URL to be used for GitHub API calls | | -| `githubUploadURL` | Override GitHub Upload URL to be used for GitHub API calls | | -| `runnerGithubURL` | Override GitHub URL to be used by runners during registration | | -| `logLevel` | Set the log level of the controller container | | -| `additionalVolumes` | Set additional volumes to add to the manager container | | -| `additionalVolumeMounts` | Set additional volume mounts to add to the manager container | | -| `authSecret.create` | Deploy the controller auth secret | false | -| `authSecret.name` | Set the name of the auth secret | controller-manager | -| `authSecret.annotations` | Set annotations for the auth Secret | | -| `authSecret.github_app_id` | The ID of your GitHub App. **This can't be set at the same time as `authSecret.github_token`** | | -| `authSecret.github_app_installation_id` | The ID of your GitHub App installation. **This can't be set at the same time as `authSecret.github_token`** | | -| `authSecret.github_app_private_key` | The multiline string of your GitHub App's private key. **This can't be set at the same time as `authSecret.github_token`** | | -| `authSecret.github_token` | Your chosen GitHub PAT token. **This can't be set at the same time as the `authSecret.github_app_*`** | | -| `authSecret.github_basicauth_username` | Username for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API | | -| `authSecret.github_basicauth_password` | Password for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API | | -| `dockerRegistryMirror` | The default Docker Registry Mirror used by runners. | | -| `hostNetwork` | The "hostNetwork" of the controller container | false | -| `image.repository` | The "repository/image" of the controller container | summerwind/actions-runner-controller | -| `image.tag` | The tag of the controller container | | -| `image.actionsRunnerRepositoryAndTag` | The "repository/image" of the actions runner container | summerwind/actions-runner:latest | -| `image.actionsRunnerImagePullSecrets` | Optional image pull secrets to be included in the runner pod's ImagePullSecrets | | -| `image.dindSidecarRepositoryAndTag` | The "repository/image" of the dind sidecar container | docker:dind | -| `image.pullPolicy` | The pull policy of the controller image | IfNotPresent | -| `metrics.serviceMonitor` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | -| `metrics.serviceAnnotations` | Set annotations for the provisioned metrics service resource | | -| `metrics.port` | Set port of metrics service | 8443 | -| `metrics.proxy.enabled` | Deploy kube-rbac-proxy container in controller pod | true | -| `metrics.proxy.image.repository` | The "repository/image" of the kube-proxy container | quay.io/brancz/kube-rbac-proxy | -| `metrics.proxy.image.tag` | The tag of the kube-proxy image to use when pulling the container | v0.10.0 | -| `metrics.serviceMonitorLabels` | Set labels to apply to ServiceMonitor resources | | -| `imagePullSecrets` | Specifies the secret to be used when pulling the controller pod containers | | -| `fullnameOverride` | Override the full resource names | | -| `nameOverride` | Override the resource name prefix | | -| `serviceAccount.annotations` | Set annotations to the service account | | -| `serviceAccount.create` | Deploy the controller pod under a service account | true | -| `podAnnotations` | Set annotations for the controller pod | | -| `podLabels` | Set labels for the controller pod | | -| `serviceAccount.name` | Set the name of the service account | | -| `securityContext` | Set the security context for each container in the controller pod | | -| `podSecurityContext` | Set the security context to controller pod | | -| `service.annotations` | Set annotations for the provisioned webhook service resource | | -| `service.port` | Set controller service ports | | -| `service.type` | Set controller service type | | -| `topologySpreadConstraints` | Set the controller pod topologySpreadConstraints | | -| `nodeSelector` | Set the controller pod nodeSelector | | -| `resources` | Set the controller pod resources | | -| `affinity` | Set the controller pod affinity rules | | -| `podDisruptionBudget.enabled` | Enables a PDB to ensure HA of controller pods | false | -| `podDisruptionBudget.minAvailable` | Minimum number of pods that must be available after eviction | | -| `podDisruptionBudget.maxUnavailable` | Maximum number of pods that can be unavailable after eviction. Kubernetes 1.7+ required. | | -| `tolerations` | Set the controller pod tolerations | | -| `env` | Set environment variables for the controller container | | -| `priorityClassName` | Set the controller pod priorityClassName | | -| `scope.watchNamespace` | Tells the controller and the github webhook server which namespace to watch if `scope.singleNamespace` is true | `Release.Namespace` (the default namespace of the helm chart). | -| `scope.singleNamespace` | Limit the controller to watch a single namespace | false | -| `certManagerEnabled` | Enable cert-manager. If disabled you must set admissionWebHooks.caBundle and create TLS secrets manually | true | -| `runner.statusUpdateHook.enabled` | Use custom RBAC for runners (role, role binding and service account), this will enable reporting runner statuses | false | -| `admissionWebHooks.caBundle` | Base64-encoded PEM bundle containing the CA that signed the webhook's serving certificate | | -| `githubWebhookServer.logLevel` | Set the log level of the githubWebhookServer container | | -| `githubWebhookServer.replicaCount` | Set the number of webhook server pods | 1 | -| `githubWebhookServer.useRunnerGroupsVisibility` | Enable supporting runner groups with custom visibility. This will incur in extra API calls and may blow up your budget. Currently, you also need to set `githubWebhookServer.secret.enabled` to enable this feature. | false | -| `githubWebhookServer.enabled` | Deploy the webhook server pod | false | -| `githubWebhookServer.queueLimit` | Set the queue size limit in the githubWebhookServer | | -| `githubWebhookServer.secret.enabled` | Passes the webhook hook secret to the github-webhook-server | false | -| `githubWebhookServer.secret.create` | Deploy the webhook hook secret | false | -| `githubWebhookServer.secret.name` | Set the name of the webhook hook secret | github-webhook-server | -| `githubWebhookServer.secret.github_webhook_secret_token` | Set the webhook secret token value | | -| `githubWebhookServer.imagePullSecrets` | Specifies the secret to be used when pulling the githubWebhookServer pod containers | | -| `githubWebhookServer.nameOverride` | Override the resource name prefix | | -| `githubWebhookServer.fullnameOverride` | Override the full resource names | | -| `githubWebhookServer.serviceAccount.create` | Deploy the githubWebhookServer under a service account | true | -| `githubWebhookServer.serviceAccount.annotations` | Set annotations for the service account | | -| `githubWebhookServer.serviceAccount.name` | Set the service account name | | -| `githubWebhookServer.podAnnotations` | Set annotations for the githubWebhookServer pod | | -| `githubWebhookServer.podLabels` | Set labels for the githubWebhookServer pod | | -| `githubWebhookServer.podSecurityContext` | Set the security context to githubWebhookServer pod | | -| `githubWebhookServer.securityContext` | Set the security context for each container in the githubWebhookServer pod | | -| `githubWebhookServer.resources` | Set the githubWebhookServer pod resources | | -| `githubWebhookServer.topologySpreadConstraints` | Set the githubWebhookServer pod topologySpreadConstraints | | -| `githubWebhookServer.nodeSelector` | Set the githubWebhookServer pod nodeSelector | | -| `githubWebhookServer.tolerations` | Set the githubWebhookServer pod tolerations | | -| `githubWebhookServer.affinity` | Set the githubWebhookServer pod affinity rules | | -| `githubWebhookServer.priorityClassName` | Set the githubWebhookServer pod priorityClassName | | -| `githubWebhookServer.service.type` | Set githubWebhookServer service type | | -| `githubWebhookServer.service.ports` | Set githubWebhookServer service ports | `[{"port":80, "targetPort:"http", "protocol":"TCP", "name":"http"}]` | -| `githubWebhookServer.ingress.enabled` | Deploy an ingress kind for the githubWebhookServer | false | -| `githubWebhookServer.ingress.annotations` | Set annotations for the ingress kind | | -| `githubWebhookServer.ingress.hosts` | Set hosts configuration for ingress | `[{"host": "chart-example.local", "paths": []}]` | -| `githubWebhookServer.ingress.tls` | Set tls configuration for ingress | | -| `githubWebhookServer.ingress.ingressClassName` | Set ingress class name | | -| `githubWebhookServer.podDisruptionBudget.enabled` | Enables a PDB to ensure HA of githubwebhook pods | false | -| `githubWebhookServer.podDisruptionBudget.minAvailable` | Minimum number of pods that must be available after eviction | | -| `githubWebhookServer.podDisruptionBudget.maxUnavailable` | Maximum number of pods that can be unavailable after eviction. Kubernetes 1.7+ required. | | diff --git a/overlays/patch.yaml b/overlays/patch.yaml new file mode 100644 index 0000000..024de21 --- /dev/null +++ b/overlays/patch.yaml @@ -0,0 +1,12 @@ +- apiGroups: + - actions.summerwind.dev + resources: + - horizontalrunnerautoscalers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/overlays/resource_limits.yaml b/overlays/resource_limits.yaml new file mode 100644 index 0000000..c6e2294 --- /dev/null +++ b/overlays/resource_limits.yaml @@ -0,0 +1,9 @@ + +patchesJson6902: +- target: + kind: Deployment + name: controller-manager + patch: |- + - op: replace + path: /spec/template/spec/containers/0/resources/limits/memory + value: 500mi diff --git a/overlays/role_permissions.yaml b/overlays/role_permissions.yaml new file mode 100644 index 0000000..4b61dd8 --- /dev/null +++ b/overlays/role_permissions.yaml @@ -0,0 +1,25 @@ + +patchesJson6902: +- target: + kind: ClusterRole + name: manager-role + patch: |- + - op: add + path: /rules/0 + value: + verbs: + - "*" + apiGroups: + - "apiextensions.k8s.io" + resources: + - customresourcedefinitions + - op: add + path: /rules/0 + value: + verbs: + - "*" + apiGroups: + - cert-manager.io + resources: + - certificates + - issuers \ No newline at end of file diff --git a/simple-arc-operator/.gitignore b/simple-arc-operator/.gitignore new file mode 100644 index 0000000..62fd3e3 --- /dev/null +++ b/simple-arc-operator/.gitignore @@ -0,0 +1,14 @@ + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +bin + +# editor and IDE paraphernalia +.idea +*.swp +*.swo +*~ diff --git a/Dockerfile b/simple-arc-operator/Dockerfile similarity index 72% rename from Dockerfile rename to simple-arc-operator/Dockerfile index 9ba0967..691f879 100644 --- a/Dockerfile +++ b/simple-arc-operator/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM quay.io/operator-framework/helm-operator:v1.23.0 +FROM quay.io/operator-framework/helm-operator:v1.26.0 ENV HOME=/opt/helm COPY watches.yaml ${HOME}/watches.yaml diff --git a/Makefile b/simple-arc-operator/Makefile similarity index 81% rename from Makefile rename to simple-arc-operator/Makefile index 85653e2..83fb0c7 100644 --- a/Makefile +++ b/simple-arc-operator/Makefile @@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) # This variable is used to construct full image tags for bundle and catalog images. # # For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both -# example.com/simple-arc-operator-bundle:$VERSION and example.com/simple-arc-operator-catalog:$VERSION. -IMAGE_TAG_BASE ?= ghcr.io/boxboat-github-practice/simple-arc-operator +# boxboat.com/simple-arc-operator-bundle:$VERSION and boxboat.com/simple-arc-operator-catalog:$VERSION. +IMAGE_TAG_BASE ?= boxboat.com/simple-arc-operator # BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) @@ -52,10 +52,6 @@ IMG ?= controller:latest .PHONY: all all: docker-build -.PHONY: tag-test -tag-test: - echo $(IMG) - ##@ General # The help target prints out all targets with their descriptions organized @@ -87,6 +83,23 @@ docker-build: ## Build docker image with the manager. docker-push: ## Push docker image with the manager. docker push ${IMG} +# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple +# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: +# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/ +# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/ +# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=> than the export will fail) +# To properly provided solutions that supports more than one platform you should use this option. +PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le +.PHONY: docker-buildx +docker-buildx: test ## Build and push docker image for the manager for cross-platform support + # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile + sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross + - docker buildx create --name project-v3-builder + docker buildx use project-v3-builder + - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . + - docker buildx rm project-v3-builder + rm Dockerfile.cross + ##@ Deployment .PHONY: install @@ -107,7 +120,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi $(KUSTOMIZE) build config/default | kubectl delete -f - OS := $(shell uname -s | tr '[:upper:]' '[:lower:]') -ARCH := $(shell uname -m | sed 's/x86_64/amd64/') +ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') .PHONY: kustomize KUSTOMIZE = $(shell pwd)/bin/kustomize @@ -117,7 +130,7 @@ ifeq (,$(shell which kustomize 2>/dev/null)) @{ \ set -e ;\ mkdir -p $(dir $(KUSTOMIZE)) ;\ - curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.5/kustomize_v4.5.5_$(OS)_$(ARCH).tar.gz | \ + curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCH).tar.gz | \ tar xzf - -C bin/ ;\ } else @@ -133,7 +146,7 @@ ifeq (,$(shell which helm-operator 2>/dev/null)) @{ \ set -e ;\ mkdir -p $(dir $(HELM_OPERATOR)) ;\ - curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.23.0/helm-operator_$(OS)_$(ARCH) ;\ + curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0/helm-operator_$(OS)_$(ARCH) ;\ chmod +x $(HELM_OPERATOR) ;\ } else @@ -143,9 +156,9 @@ endif .PHONY: bundle bundle: kustomize ## Generate bundle manifests and metadata, then validate generated files. - operator-sdk generate kustomize manifests -q --interactive=false + operator-sdk generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) - $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) + $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS) operator-sdk bundle validate ./bundle .PHONY: bundle-build diff --git a/PROJECT b/simple-arc-operator/PROJECT similarity index 81% rename from PROJECT rename to simple-arc-operator/PROJECT index cc682c8..4aa96c4 100644 --- a/PROJECT +++ b/simple-arc-operator/PROJECT @@ -1,4 +1,4 @@ -domain: example.com +domain: boxboat.com layout: - helm.sdk.operatorframework.io/v1 plugins: @@ -9,8 +9,8 @@ resources: - api: crdVersion: v1 namespaced: true - domain: example.com - group: charts + domain: boxboat.com + group: github-practice kind: ActionsRunnerController version: v1alpha1 version: "3" diff --git a/config/crd/bases/charts.example.com_actionsrunnercontrollers.yaml b/simple-arc-operator/config/crd/bases/github-practice.boxboat.com_actionsrunnercontrollers.yaml similarity index 94% rename from config/crd/bases/charts.example.com_actionsrunnercontrollers.yaml rename to simple-arc-operator/config/crd/bases/github-practice.boxboat.com_actionsrunnercontrollers.yaml index ffc1504..b9dfb59 100644 --- a/config/crd/bases/charts.example.com_actionsrunnercontrollers.yaml +++ b/simple-arc-operator/config/crd/bases/github-practice.boxboat.com_actionsrunnercontrollers.yaml @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: actionsrunnercontrollers.charts.example.com + name: actionsrunnercontrollers.github-practice.boxboat.com spec: - group: charts.example.com + group: github-practice.boxboat.com names: kind: ActionsRunnerController listKind: ActionsRunnerControllerList diff --git a/config/crd/kustomization.yaml b/simple-arc-operator/config/crd/kustomization.yaml similarity index 78% rename from config/crd/kustomization.yaml rename to simple-arc-operator/config/crd/kustomization.yaml index a95e565..76db4cb 100644 --- a/config/crd/kustomization.yaml +++ b/simple-arc-operator/config/crd/kustomization.yaml @@ -2,5 +2,5 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/charts.example.com_actionsrunnercontrollers.yaml +- bases/github-practice.boxboat.com_actionsrunnercontrollers.yaml #+kubebuilder:scaffold:crdkustomizeresource diff --git a/config/default/kustomization.yaml b/simple-arc-operator/config/default/kustomization.yaml similarity index 86% rename from config/default/kustomization.yaml rename to simple-arc-operator/config/default/kustomization.yaml index 7f4445b..0c9b1d1 100644 --- a/config/default/kustomization.yaml +++ b/simple-arc-operator/config/default/kustomization.yaml @@ -27,6 +27,4 @@ patchesStrategicMerge: # endpoint w/o any authn/z, please comment the following line. - manager_auth_proxy_patch.yaml -# Mount the controller config file for loading manager configurations -# through a ComponentConfig type -#- manager_config_patch.yaml + diff --git a/config/default/manager_auth_proxy_patch.yaml b/simple-arc-operator/config/default/manager_auth_proxy_patch.yaml similarity index 69% rename from config/default/manager_auth_proxy_patch.yaml rename to simple-arc-operator/config/default/manager_auth_proxy_patch.yaml index 6990c53..6e6cb9a 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/simple-arc-operator/config/default/manager_auth_proxy_patch.yaml @@ -8,6 +8,22 @@ metadata: spec: template: spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - arm64 + - ppc64le + - s390x + - key: kubernetes.io/os + operator: In + values: + - linux containers: - name: kube-rbac-proxy securityContext: diff --git a/simple-arc-operator/config/default/manager_config_patch.yaml b/simple-arc-operator/config/default/manager_config_patch.yaml new file mode 100644 index 0000000..f6f5891 --- /dev/null +++ b/simple-arc-operator/config/default/manager_config_patch.yaml @@ -0,0 +1,10 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: controller-manager + namespace: system +spec: + template: + spec: + containers: + - name: manager diff --git a/simple-arc-operator/config/manager/kustomization.yaml b/simple-arc-operator/config/manager/kustomization.yaml new file mode 100644 index 0000000..5b90f29 --- /dev/null +++ b/simple-arc-operator/config/manager/kustomization.yaml @@ -0,0 +1,11 @@ +resources: +- manager.yaml + +patchesJson6902: +- target: + kind: Deployment + name: controller-manager + patch: |- + - op: replace + path: /spec/template/spec/containers/0/resources/limits/memory + value: 500mi diff --git a/config/manager/manager.yaml b/simple-arc-operator/config/manager/manager.yaml similarity index 59% rename from config/manager/manager.yaml rename to simple-arc-operator/config/manager/manager.yaml index a75514d..b074f16 100644 --- a/config/manager/manager.yaml +++ b/simple-arc-operator/config/manager/manager.yaml @@ -3,6 +3,12 @@ kind: Namespace metadata: labels: control-plane: controller-manager + app.kubernetes.io/name: namespace + app.kubernetes.io/instance: system + app.kubernetes.io/component: manager + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize name: system --- apiVersion: apps/v1 @@ -12,6 +18,12 @@ metadata: namespace: system labels: control-plane: controller-manager + app.kubernetes.io/name: deployment + app.kubernetes.io/instance: controller-manager + app.kubernetes.io/component: manager + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize spec: selector: matchLabels: @@ -24,6 +36,26 @@ spec: labels: control-plane: controller-manager spec: + # TODO(user): Uncomment the following code to configure the nodeAffinity expression + # according to the platforms which are supported by your solution. + # It is considered best practice to support multiple architectures. You can + # build your manager image using the makefile target docker-buildx. + # affinity: + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/arch + # operator: In + # values: + # - amd64 + # - arm64 + # - ppc64le + # - s390x + # - key: kubernetes.io/os + # operator: In + # values: + # - linux securityContext: runAsNonRoot: true # TODO(user): For common cases that do not require escalating privileges @@ -61,7 +93,7 @@ spec: resources: limits: cpu: 500m - memory: 500Mi + memory: 128Mi requests: cpu: 10m memory: 64Mi diff --git a/config/manifests/kustomization.yaml b/simple-arc-operator/config/manifests/kustomization.yaml similarity index 100% rename from config/manifests/kustomization.yaml rename to simple-arc-operator/config/manifests/kustomization.yaml diff --git a/config/prometheus/kustomization.yaml b/simple-arc-operator/config/prometheus/kustomization.yaml similarity index 100% rename from config/prometheus/kustomization.yaml rename to simple-arc-operator/config/prometheus/kustomization.yaml diff --git a/config/prometheus/monitor.yaml b/simple-arc-operator/config/prometheus/monitor.yaml similarity index 62% rename from config/prometheus/monitor.yaml rename to simple-arc-operator/config/prometheus/monitor.yaml index d19136a..a87f7e0 100644 --- a/config/prometheus/monitor.yaml +++ b/simple-arc-operator/config/prometheus/monitor.yaml @@ -5,6 +5,12 @@ kind: ServiceMonitor metadata: labels: control-plane: controller-manager + app.kubernets.io/name: servicemonitor + app.kubernetes.io/instance: controller-manager-metrics-monitor + app.kubernetes.io/component: metrics + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system spec: diff --git a/config/rbac/actionsrunnercontroller_editor_role.yaml b/simple-arc-operator/config/rbac/actionsrunnercontroller_editor_role.yaml similarity index 51% rename from config/rbac/actionsrunnercontroller_editor_role.yaml rename to simple-arc-operator/config/rbac/actionsrunnercontroller_editor_role.yaml index 36151f4..363e7dd 100644 --- a/config/rbac/actionsrunnercontroller_editor_role.yaml +++ b/simple-arc-operator/config/rbac/actionsrunnercontroller_editor_role.yaml @@ -2,10 +2,17 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: actionsrunnercontroller-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize name: actionsrunnercontroller-editor-role rules: - apiGroups: - - charts.example.com + - github-practice.boxboat.com resources: - actionsrunnercontrollers verbs: @@ -17,7 +24,7 @@ rules: - update - watch - apiGroups: - - charts.example.com + - github-practice.boxboat.com resources: - actionsrunnercontrollers/status verbs: diff --git a/simple-arc-operator/config/rbac/actionsrunnercontroller_viewer_role.yaml b/simple-arc-operator/config/rbac/actionsrunnercontroller_viewer_role.yaml new file mode 100644 index 0000000..cfca196 --- /dev/null +++ b/simple-arc-operator/config/rbac/actionsrunnercontroller_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view actionsrunnercontrollers. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: actionsrunnercontroller-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: actionsrunnercontroller-viewer-role +rules: +- apiGroups: + - github-practice.boxboat.com + resources: + - actionsrunnercontrollers + verbs: + - get + - list + - watch +- apiGroups: + - github-practice.boxboat.com + resources: + - actionsrunnercontrollers/status + verbs: + - get diff --git a/simple-arc-operator/config/rbac/auth_proxy_client_clusterrole.yaml b/simple-arc-operator/config/rbac/auth_proxy_client_clusterrole.yaml new file mode 100644 index 0000000..6554fee --- /dev/null +++ b/simple-arc-operator/config/rbac/auth_proxy_client_clusterrole.yaml @@ -0,0 +1,16 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: metrics-reader + app.kubernetes.io/component: kube-rbac-proxy + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: metrics-reader +rules: +- nonResourceURLs: + - "/metrics" + verbs: + - get diff --git a/simple-arc-operator/config/rbac/auth_proxy_role.yaml b/simple-arc-operator/config/rbac/auth_proxy_role.yaml new file mode 100644 index 0000000..88fb53e --- /dev/null +++ b/simple-arc-operator/config/rbac/auth_proxy_role.yaml @@ -0,0 +1,24 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: proxy-role + app.kubernetes.io/component: kube-rbac-proxy + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: proxy-role +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create diff --git a/simple-arc-operator/config/rbac/auth_proxy_role_binding.yaml b/simple-arc-operator/config/rbac/auth_proxy_role_binding.yaml new file mode 100644 index 0000000..68677b2 --- /dev/null +++ b/simple-arc-operator/config/rbac/auth_proxy_role_binding.yaml @@ -0,0 +1,19 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/name: clusterrolebinding + app.kubernetes.io/instance: proxy-rolebinding + app.kubernetes.io/component: kube-rbac-proxy + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: proxy-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: proxy-role +subjects: +- kind: ServiceAccount + name: controller-manager + namespace: system diff --git a/simple-arc-operator/config/rbac/auth_proxy_service.yaml b/simple-arc-operator/config/rbac/auth_proxy_service.yaml new file mode 100644 index 0000000..f4b4ee6 --- /dev/null +++ b/simple-arc-operator/config/rbac/auth_proxy_service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + control-plane: controller-manager + app.kubernetes.io/name: service + app.kubernetes.io/instance: controller-manager-metrics-service + app.kubernetes.io/component: kube-rbac-proxy + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: controller-manager-metrics-service + namespace: system +spec: + ports: + - name: https + port: 8443 + protocol: TCP + targetPort: https + selector: + control-plane: controller-manager diff --git a/config/rbac/kustomization.yaml b/simple-arc-operator/config/rbac/kustomization.yaml similarity index 60% rename from config/rbac/kustomization.yaml rename to simple-arc-operator/config/rbac/kustomization.yaml index 731832a..7db3276 100644 --- a/config/rbac/kustomization.yaml +++ b/simple-arc-operator/config/rbac/kustomization.yaml @@ -16,3 +16,28 @@ resources: - auth_proxy_role.yaml - auth_proxy_role_binding.yaml - auth_proxy_client_clusterrole.yaml + +patchesJson6902: +- target: + kind: ClusterRole + name: manager-role + patch: |- + - op: add + path: /rules/0 + value: + verbs: + - "*" + apiGroups: + - "apiextensions.k8s.io" + resources: + - customresourcedefinitions + - op: add + path: /rules/0 + value: + verbs: + - "*" + apiGroups: + - cert-manager.io + resources: + - certificates + - issuers \ No newline at end of file diff --git a/config/rbac/leader_election_role.yaml b/simple-arc-operator/config/rbac/leader_election_role.yaml similarity index 62% rename from config/rbac/leader_election_role.yaml rename to simple-arc-operator/config/rbac/leader_election_role.yaml index 4190ec8..ca50c8b 100644 --- a/config/rbac/leader_election_role.yaml +++ b/simple-arc-operator/config/rbac/leader_election_role.yaml @@ -2,6 +2,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: + labels: + app.kubernetes.io/name: role + app.kubernetes.io/instance: leader-election-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernets.io/managed-by: kustomize name: leader-election-role rules: - apiGroups: diff --git a/simple-arc-operator/config/rbac/leader_election_role_binding.yaml b/simple-arc-operator/config/rbac/leader_election_role_binding.yaml new file mode 100644 index 0000000..065b0e0 --- /dev/null +++ b/simple-arc-operator/config/rbac/leader_election_role_binding.yaml @@ -0,0 +1,19 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + app.kubernetes.io/name: rolebinding + app.kubernetes.io/instance: leader-election-rolebinding + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: leader-election-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: leader-election-role +subjects: +- kind: ServiceAccount + name: controller-manager + namespace: system diff --git a/config/rbac/role.yaml b/simple-arc-operator/config/rbac/role.yaml similarity index 50% rename from config/rbac/role.yaml rename to simple-arc-operator/config/rbac/role.yaml index 8963c9c..ebcac41 100644 --- a/config/rbac/role.yaml +++ b/simple-arc-operator/config/rbac/role.yaml @@ -3,21 +3,6 @@ kind: ClusterRole metadata: name: manager-role rules: -- verbs: - - "*" - apiGroups: - - "apiextensions.k8s.io" - resources: - - customresourcedefinitions - -- verbs: - - "*" - apiGroups: - - cert-manager.io - resources: - - certificates - - issuers - ## ## Base operator rules ## @@ -44,10 +29,10 @@ rules: - create ## -## Rules for charts.example.com/v1alpha1, Kind: ActionsRunnerController +## Rules for github-practice.boxboat.com/v1alpha1, Kind: ActionsRunnerController ## - apiGroups: - - charts.example.com + - github-practice.boxboat.com resources: - actionsrunnercontrollers - actionsrunnercontrollers/status @@ -60,39 +45,39 @@ rules: - patch - update - watch -- verbs: - - "*" - apiGroups: - - "rbac.authorization.k8s.io" - resources: - - "clusterrolebindings" - - "clusterroles" -- verbs: - - "*" - apiGroups: - - "admissionregistration.k8s.io" - resources: - - "mutatingwebhookconfigurations" - - "validatingwebhookconfigurations" -- verbs: - - "*" - apiGroups: +- apiGroups: - "" resources: - - "serviceaccounts" - - "services" -- verbs: - - "*" - apiGroups: - - "rbac.authorization.k8s.io" - resources: - - "rolebindings" - - "roles" -- verbs: - - "*" - apiGroups: - - "apps" + - pods + - services + - services/finalizers + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - apps resources: - - "deployments" + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch #+kubebuilder:scaffold:rules diff --git a/simple-arc-operator/config/rbac/role_binding.yaml b/simple-arc-operator/config/rbac/role_binding.yaml new file mode 100644 index 0000000..a2451ae --- /dev/null +++ b/simple-arc-operator/config/rbac/role_binding.yaml @@ -0,0 +1,19 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + app.kubernetes.io/name: clusterrolebinding + app.kubernetes.io/instance: manager-rolebinding + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: manager-role +subjects: +- kind: ServiceAccount + name: controller-manager + namespace: system diff --git a/simple-arc-operator/config/rbac/service_account.yaml b/simple-arc-operator/config/rbac/service_account.yaml new file mode 100644 index 0000000..7eb0b4a --- /dev/null +++ b/simple-arc-operator/config/rbac/service_account.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/name: serviceaccount + app.kubernetes.io/instance: controller-manager-sa + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: simple-arc-operator + app.kubernetes.io/part-of: simple-arc-operator + app.kubernetes.io/managed-by: kustomize + name: controller-manager + namespace: system diff --git a/config/samples/charts_v1alpha1_actionsrunnercontroller.yaml b/simple-arc-operator/config/samples/github-practice_v1alpha1_actionsrunnercontroller.yaml similarity index 67% rename from config/samples/charts_v1alpha1_actionsrunnercontroller.yaml rename to simple-arc-operator/config/samples/github-practice_v1alpha1_actionsrunnercontroller.yaml index 3e00089..fd91a7b 100644 --- a/config/samples/charts_v1alpha1_actionsrunnercontroller.yaml +++ b/simple-arc-operator/config/samples/github-practice_v1alpha1_actionsrunnercontroller.yaml @@ -1,9 +1,61 @@ -apiVersion: charts.example.com/v1alpha1 +apiVersion: github-practice.boxboat.com/v1alpha1 kind: ActionsRunnerController metadata: name: actionsrunnercontroller-sample spec: # Default values copied from /helm-charts/actions-runner-controller/values.yaml + actionsMetrics: + port: 8443 + proxy: + enabled: true + image: + repository: quay.io/brancz/kube-rbac-proxy + tag: v0.13.1 + serviceAnnotations: {} + serviceMonitor: false + serviceMonitorLabels: {} + actionsMetricsServer: + affinity: {} + enabled: false + fullnameOverride: "" + imagePullSecrets: [] + ingress: + annotations: {} + enabled: false + hosts: + - extraPaths: [] + host: chart-example.local + paths: [] + ingressClassName: "" + tls: [] + logFormat: text + nameOverride: "" + nodeSelector: {} + podAnnotations: {} + podLabels: {} + podSecurityContext: {} + priorityClassName: "" + replicaCount: 1 + resources: {} + secret: + create: false + enabled: false + github_webhook_secret_token: "" + name: actions-metrics-server + securityContext: {} + service: + annotations: {} + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http + type: ClusterIP + serviceAccount: + annotations: {} + create: true + name: "" + tolerations: [] additionalVolumeMounts: [] additionalVolumes: [] admissionWebHooks: {} @@ -33,6 +85,7 @@ spec: paths: [] ingressClassName: "" tls: [] + logFormat: text nameOverride: "" nodeSelector: {} podAnnotations: {} @@ -71,6 +124,7 @@ spec: repository: summerwind/actions-runner-controller imagePullSecrets: [] labels: {} + logFormat: text metrics: port: 8443 proxy: diff --git a/config/samples/kustomization.yaml b/simple-arc-operator/config/samples/kustomization.yaml similarity index 69% rename from config/samples/kustomization.yaml rename to simple-arc-operator/config/samples/kustomization.yaml index 5bfa5d1..9e4e0eb 100644 --- a/config/samples/kustomization.yaml +++ b/simple-arc-operator/config/samples/kustomization.yaml @@ -1,4 +1,4 @@ ## Append samples you want in your CSV to this file as resources ## resources: -- charts_v1alpha1_actionsrunnercontroller.yaml +- github-practice_v1alpha1_actionsrunnercontroller.yaml #+kubebuilder:scaffold:manifestskustomizesamples diff --git a/config/scorecard/bases/config.yaml b/simple-arc-operator/config/scorecard/bases/config.yaml similarity index 100% rename from config/scorecard/bases/config.yaml rename to simple-arc-operator/config/scorecard/bases/config.yaml diff --git a/config/scorecard/kustomization.yaml b/simple-arc-operator/config/scorecard/kustomization.yaml similarity index 100% rename from config/scorecard/kustomization.yaml rename to simple-arc-operator/config/scorecard/kustomization.yaml diff --git a/config/scorecard/patches/basic.config.yaml b/simple-arc-operator/config/scorecard/patches/basic.config.yaml similarity index 73% rename from config/scorecard/patches/basic.config.yaml rename to simple-arc-operator/config/scorecard/patches/basic.config.yaml index 90f7ef7..ccd4bf7 100644 --- a/config/scorecard/patches/basic.config.yaml +++ b/simple-arc-operator/config/scorecard/patches/basic.config.yaml @@ -4,7 +4,7 @@ entrypoint: - scorecard-test - basic-check-spec - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: basic test: basic-check-spec-test diff --git a/config/scorecard/patches/olm.config.yaml b/simple-arc-operator/config/scorecard/patches/olm.config.yaml similarity index 74% rename from config/scorecard/patches/olm.config.yaml rename to simple-arc-operator/config/scorecard/patches/olm.config.yaml index b55840e..06d9686 100644 --- a/config/scorecard/patches/olm.config.yaml +++ b/simple-arc-operator/config/scorecard/patches/olm.config.yaml @@ -4,7 +4,7 @@ entrypoint: - scorecard-test - olm-bundle-validation - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: olm test: olm-bundle-validation-test @@ -14,7 +14,7 @@ entrypoint: - scorecard-test - olm-crds-have-validation - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: olm test: olm-crds-have-validation-test @@ -24,7 +24,7 @@ entrypoint: - scorecard-test - olm-crds-have-resources - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: olm test: olm-crds-have-resources-test @@ -34,7 +34,7 @@ entrypoint: - scorecard-test - olm-spec-descriptors - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: olm test: olm-spec-descriptors-test @@ -44,7 +44,7 @@ entrypoint: - scorecard-test - olm-status-descriptors - image: quay.io/operator-framework/scorecard-test:v1.23.0 + image: quay.io/operator-framework/scorecard-test:v1.26.0 labels: suite: olm test: olm-status-descriptors-test diff --git a/helm-charts/actions-runner-controller/.helmignore b/simple-arc-operator/helm-charts/actions-runner-controller/.helmignore similarity index 100% rename from helm-charts/actions-runner-controller/.helmignore rename to simple-arc-operator/helm-charts/actions-runner-controller/.helmignore diff --git a/helm-charts/actions-runner-controller/Chart.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/Chart.yaml similarity index 61% rename from helm-charts/actions-runner-controller/Chart.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/Chart.yaml index 74ece33..4cbdd9f 100644 --- a/helm-charts/actions-runner-controller/Chart.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/Chart.yaml @@ -1,13 +1,13 @@ apiVersion: v2 -appVersion: 0.26.0 +appVersion: 0.27.0 description: A Kubernetes controller that operates self-hosted runners for GitHub Actions on your Kubernetes cluster. -home: https://github.com/actions-runner-controller/actions-runner-controller +home: https://github.com/actions/actions-runner-controller maintainers: - name: actions-runner-controller url: https://github.com/actions-runner-controller name: actions-runner-controller sources: -- https://github.com/actions-runner-controller/actions-runner-controller +- https://github.com/actions/actions-runner-controller type: application -version: 0.21.1 +version: 0.22.0 diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/README.md b/simple-arc-operator/helm-charts/actions-runner-controller/README.md new file mode 100644 index 0000000..465dd96 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/README.md @@ -0,0 +1,151 @@ +## Docs + +All additional docs are kept in the `docs/` folder, this README is solely for documenting the values.yaml keys and values + +## Values + +**_The values are documented as of HEAD, to review the configuration options for your chart version ensure you view this file at the relevant [tag](https://github.com/actions/actions-runner-controller/tags)_** + +> _Default values are the defaults set in the charts `values.yaml`, some properties have default configurations in the code for when the property is omitted or invalid_ + +| Key | Description | Default | +|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| +| `labels` | Set labels to apply to all resources in the chart | | +| `replicaCount` | Set the number of controller pods | 1 | +| `webhookPort` | Set the containerPort for the webhook Pod | 9443 | +| `syncPeriod` | Set the period in which the controller reconciles the desired runners count | 1m | +| `enableLeaderElection` | Enable election configuration | true | +| `leaderElectionId` | Set the election ID for the controller group | | +| `githubEnterpriseServerURL` | Set the URL for a self-hosted GitHub Enterprise Server | | +| `githubURL` | Override GitHub URL to be used for GitHub API calls | | +| `githubUploadURL` | Override GitHub Upload URL to be used for GitHub API calls | | +| `runnerGithubURL` | Override GitHub URL to be used by runners during registration | | +| `logLevel` | Set the log level of the controller container | | +| `logFormat` | Set the log format of the controller. Valid options are "text" and "json" | text | +| `additionalVolumes` | Set additional volumes to add to the manager container | | +| `additionalVolumeMounts` | Set additional volume mounts to add to the manager container | | +| `authSecret.create` | Deploy the controller auth secret | false | +| `authSecret.name` | Set the name of the auth secret | controller-manager | +| `authSecret.annotations` | Set annotations for the auth Secret | | +| `authSecret.github_app_id` | The ID of your GitHub App. **This can't be set at the same time as `authSecret.github_token`** | | +| `authSecret.github_app_installation_id` | The ID of your GitHub App installation. **This can't be set at the same time as `authSecret.github_token`** | | +| `authSecret.github_app_private_key` | The multiline string of your GitHub App's private key. **This can't be set at the same time as `authSecret.github_token`** | | +| `authSecret.github_token` | Your chosen GitHub PAT token. **This can't be set at the same time as the `authSecret.github_app_*`** | | +| `authSecret.github_basicauth_username` | Username for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API | | +| `authSecret.github_basicauth_password` | Password for GitHub basic auth to use instead of PAT or GitHub APP in case it's running behind a proxy API | | +| `dockerRegistryMirror` | The default Docker Registry Mirror used by runners. | | +| `hostNetwork` | The "hostNetwork" of the controller container | false | +| `image.repository` | The "repository/image" of the controller container | summerwind/actions-runner-controller | +| `image.tag` | The tag of the controller container | | +| `image.actionsRunnerRepositoryAndTag` | The "repository/image" of the actions runner container | summerwind/actions-runner:latest | +| `image.actionsRunnerImagePullSecrets` | Optional image pull secrets to be included in the runner pod's ImagePullSecrets | | +| `image.dindSidecarRepositoryAndTag` | The "repository/image" of the dind sidecar container | docker:dind | +| `image.pullPolicy` | The pull policy of the controller image | IfNotPresent | +| `metrics.serviceMonitor` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `metrics.serviceAnnotations` | Set annotations for the provisioned metrics service resource | | +| `metrics.port` | Set port of metrics service | 8443 | +| `metrics.proxy.enabled` | Deploy kube-rbac-proxy container in controller pod | true | +| `metrics.proxy.image.repository` | The "repository/image" of the kube-proxy container | quay.io/brancz/kube-rbac-proxy | +| `metrics.proxy.image.tag` | The tag of the kube-proxy image to use when pulling the container | v0.10.0 | +| `metrics.serviceMonitorLabels` | Set labels to apply to ServiceMonitor resources | | +| `imagePullSecrets` | Specifies the secret to be used when pulling the controller pod containers | | +| `fullnameOverride` | Override the full resource names | | +| `nameOverride` | Override the resource name prefix | | +| `serviceAccount.annotations` | Set annotations to the service account | | +| `serviceAccount.create` | Deploy the controller pod under a service account | true | +| `podAnnotations` | Set annotations for the controller pod | | +| `podLabels` | Set labels for the controller pod | | +| `serviceAccount.name` | Set the name of the service account | | +| `securityContext` | Set the security context for each container in the controller pod | | +| `podSecurityContext` | Set the security context to controller pod | | +| `service.annotations` | Set annotations for the provisioned webhook service resource | | +| `service.port` | Set controller service ports | | +| `service.type` | Set controller service type | | +| `topologySpreadConstraints` | Set the controller pod topologySpreadConstraints | | +| `nodeSelector` | Set the controller pod nodeSelector | | +| `resources` | Set the controller pod resources | | +| `affinity` | Set the controller pod affinity rules | | +| `podDisruptionBudget.enabled` | Enables a PDB to ensure HA of controller pods | false | +| `podDisruptionBudget.minAvailable` | Minimum number of pods that must be available after eviction | | +| `podDisruptionBudget.maxUnavailable` | Maximum number of pods that can be unavailable after eviction. Kubernetes 1.7+ required. | | +| `tolerations` | Set the controller pod tolerations | | +| `env` | Set environment variables for the controller container | | +| `priorityClassName` | Set the controller pod priorityClassName | | +| `scope.watchNamespace` | Tells the controller and the github webhook server which namespace to watch if `scope.singleNamespace` is true | `Release.Namespace` (the default namespace of the helm chart). | +| `scope.singleNamespace` | Limit the controller to watch a single namespace | false | +| `certManagerEnabled` | Enable cert-manager. If disabled you must set admissionWebHooks.caBundle and create TLS secrets manually | true | +| `runner.statusUpdateHook.enabled` | Use custom RBAC for runners (role, role binding and service account), this will enable reporting runner statuses | false | +| `admissionWebHooks.caBundle` | Base64-encoded PEM bundle containing the CA that signed the webhook's serving certificate | | +| `githubWebhookServer.logLevel` | Set the log level of the githubWebhookServer container | | +| `githubWebhookServer.logFormat` | Set the log format of the githubWebhookServer controller. Valid options are "text" and "json" | text | +| `githubWebhookServer.replicaCount` | Set the number of webhook server pods | 1 | +| `githubWebhookServer.useRunnerGroupsVisibility` | Enable supporting runner groups with custom visibility, you also need to set `githubWebhookServer.secret.enabled` to enable this feature. | false | +| `githubWebhookServer.enabled` | Deploy the webhook server pod | false | +| `githubWebhookServer.queueLimit` | Set the queue size limit in the githubWebhookServer | | +| `githubWebhookServer.secret.enabled` | Passes the webhook hook secret to the github-webhook-server | false | +| `githubWebhookServer.secret.create` | Deploy the webhook hook secret | false | +| `githubWebhookServer.secret.name` | Set the name of the webhook hook secret | github-webhook-server | +| `githubWebhookServer.secret.github_webhook_secret_token` | Set the webhook secret token value | | +| `githubWebhookServer.imagePullSecrets` | Specifies the secret to be used when pulling the githubWebhookServer pod containers | | +| `githubWebhookServer.nameOverride` | Override the resource name prefix | | +| `githubWebhookServer.fullnameOverride` | Override the full resource names | | +| `githubWebhookServer.serviceAccount.create` | Deploy the githubWebhookServer under a service account | true | +| `githubWebhookServer.serviceAccount.annotations` | Set annotations for the service account | | +| `githubWebhookServer.serviceAccount.name` | Set the service account name | | +| `githubWebhookServer.podAnnotations` | Set annotations for the githubWebhookServer pod | | +| `githubWebhookServer.podLabels` | Set labels for the githubWebhookServer pod | | +| `githubWebhookServer.podSecurityContext` | Set the security context to githubWebhookServer pod | | +| `githubWebhookServer.securityContext` | Set the security context for each container in the githubWebhookServer pod | | +| `githubWebhookServer.resources` | Set the githubWebhookServer pod resources | | +| `githubWebhookServer.topologySpreadConstraints` | Set the githubWebhookServer pod topologySpreadConstraints | | +| `githubWebhookServer.nodeSelector` | Set the githubWebhookServer pod nodeSelector | | +| `githubWebhookServer.tolerations` | Set the githubWebhookServer pod tolerations | | +| `githubWebhookServer.affinity` | Set the githubWebhookServer pod affinity rules | | +| `githubWebhookServer.priorityClassName` | Set the githubWebhookServer pod priorityClassName | | +| `githubWebhookServer.service.type` | Set githubWebhookServer service type | | +| `githubWebhookServer.service.ports` | Set githubWebhookServer service ports | `[{"port":80, "targetPort:"http", "protocol":"TCP", "name":"http"}]` | +| `githubWebhookServer.ingress.enabled` | Deploy an ingress kind for the githubWebhookServer | false | +| `githubWebhookServer.ingress.annotations` | Set annotations for the ingress kind | | +| `githubWebhookServer.ingress.hosts` | Set hosts configuration for ingress | `[{"host": "chart-example.local", "paths": []}]` | +| `githubWebhookServer.ingress.tls` | Set tls configuration for ingress | | +| `githubWebhookServer.ingress.ingressClassName` | Set ingress class name | | +| `githubWebhookServer.podDisruptionBudget.enabled` | Enables a PDB to ensure HA of githubwebhook pods | false | +| `githubWebhookServer.podDisruptionBudget.minAvailable` | Minimum number of pods that must be available after eviction | | +| `githubWebhookServer.podDisruptionBudget.maxUnavailable` | Maximum number of pods that can be unavailable after eviction. Kubernetes 1.7+ required. | | +| `actionsMetricsServer.logLevel` | Set the log level of the actionsMetricsServer container | | +| `actionsMetricsServer.logFormat` | Set the log format of the actionsMetricsServer controller. Valid options are "text" and "json" | text | +| `actionsMetricsServer.enabled` | Deploy the actions metrics server pod | false | +| `actionsMetricsServer.secret.enabled` | Passes the webhook hook secret to the github-webhook-server | false | +| `actionsMetricsServer.secret.create` | Deploy the webhook hook secret | false | +| `actionsMetricsServer.secret.name` | Set the name of the webhook hook secret | github-webhook-server | +| `actionsMetricsServer.secret.github_webhook_secret_token` | Set the webhook secret token value | | +| `actionsMetricsServer.imagePullSecrets` | Specifies the secret to be used when pulling the actionsMetricsServer pod containers | | +| `actionsMetricsServer.nameOverride` | Override the resource name prefix | | +| `actionsMetricsServer.fullnameOverride` | Override the full resource names | | +| `actionsMetricsServer.serviceAccount.create` | Deploy the actionsMetricsServer under a service account | true | +| `actionsMetricsServer.serviceAccount.annotations` | Set annotations for the service account | | +| `actionsMetricsServer.serviceAccount.name` | Set the service account name | | +| `actionsMetricsServer.podAnnotations` | Set annotations for the actionsMetricsServer pod | | +| `actionsMetricsServer.podLabels` | Set labels for the actionsMetricsServer pod | | +| `actionsMetricsServer.podSecurityContext` | Set the security context to actionsMetricsServer pod | | +| `actionsMetricsServer.securityContext` | Set the security context for each container in the actionsMetricsServer pod | | +| `actionsMetricsServer.resources` | Set the actionsMetricsServer pod resources | | +| `actionsMetricsServer.topologySpreadConstraints` | Set the actionsMetricsServer pod topologySpreadConstraints | | +| `actionsMetricsServer.nodeSelector` | Set the actionsMetricsServer pod nodeSelector | | +| `actionsMetricsServer.tolerations` | Set the actionsMetricsServer pod tolerations | | +| `actionsMetricsServer.affinity` | Set the actionsMetricsServer pod affinity rules | | +| `actionsMetricsServer.priorityClassName` | Set the actionsMetricsServer pod priorityClassName | | +| `actionsMetricsServer.service.type` | Set actionsMetricsServer service type | | +| `actionsMetricsServer.service.ports` | Set actionsMetricsServer service ports | `[{"port":80, "targetPort:"http", "protocol":"TCP", "name":"http"}]` | +| `actionsMetricsServer.ingress.enabled` | Deploy an ingress kind for the actionsMetricsServer | false | +| `actionsMetricsServer.ingress.annotations` | Set annotations for the ingress kind | | +| `actionsMetricsServer.ingress.hosts` | Set hosts configuration for ingress | `[{"host": "chart-example.local", "paths": []}]` | +| `actionsMetricsServer.ingress.tls` | Set tls configuration for ingress | | +| `actionsMetricsServer.ingress.ingressClassName` | Set ingress class name | | +| `actionsMetrics.serviceMonitor` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `actionsMetrics.serviceAnnotations` | Set annotations for the provisioned actions metrics service resource | | +| `actionsMetrics.port` | Set port of actions metrics service | 8443 | +| `actionsMetrics.proxy.enabled` | Deploy kube-rbac-proxy container in controller pod | true | +| `actionsMetrics.proxy.image.repository` | The "repository/image" of the kube-proxy container | quay.io/brancz/kube-rbac-proxy | +| `actionsMetrics.proxy.image.tag` | The tag of the kube-proxy image to use when pulling the container | v0.10.0 | +| `actionsMetrics.serviceMonitorLabels` | Set labels to apply to ServiceMonitor resources | | diff --git a/helm-charts/actions-runner-controller/ci/ci-values.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/ci/ci-values.yaml similarity index 100% rename from helm-charts/actions-runner-controller/ci/ci-values.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/ci/ci-values.yaml diff --git a/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_horizontalrunnerautoscalers.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_horizontalrunnerautoscalers.yaml similarity index 100% rename from helm-charts/actions-runner-controller/crds/actions.summerwind.dev_horizontalrunnerautoscalers.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_horizontalrunnerautoscalers.yaml diff --git a/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml similarity index 100% rename from helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerdeployments.yaml diff --git a/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml similarity index 100% rename from helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnerreplicasets.yaml diff --git a/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml similarity index 100% rename from helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runners.yaml diff --git a/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnersets.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnersets.yaml similarity index 100% rename from helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnersets.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/crds/actions.summerwind.dev_runnersets.yaml diff --git a/helm-charts/actions-runner-controller/templates/NOTES.txt b/simple-arc-operator/helm-charts/actions-runner-controller/templates/NOTES.txt similarity index 100% rename from helm-charts/actions-runner-controller/templates/NOTES.txt rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/NOTES.txt diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/_actions_metrics_server_helpers.tpl b/simple-arc-operator/helm-charts/actions-runner-controller/templates/_actions_metrics_server_helpers.tpl new file mode 100644 index 0000000..13e8048 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/_actions_metrics_server_helpers.tpl @@ -0,0 +1,60 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "actions-runner-controller-actions-metrics-server.name" -}} +{{- default .Chart.Name .Values.actionsMetricsServer.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "actions-runner-controller-actions-metrics-server.instance" -}} +{{- printf "%s-%s" .Release.Name "actions-metrics-server" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "actions-runner-controller-actions-metrics-server.fullname" -}} +{{- if .Values.actionsMetricsServer.fullnameOverride }} +{{- .Values.actionsMetricsServer.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.actionsMetricsServer.nameOverride }} +{{- $instance := include "actions-runner-controller-actions-metrics-server.instance" . }} +{{- if contains $name $instance }} +{{- $instance | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s-%s" .Release.Name $name "actions-metrics-server" | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "actions-runner-controller-actions-metrics-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "actions-runner-controller-actions-metrics-server.name" . }} +app.kubernetes.io/instance: {{ include "actions-runner-controller-actions-metrics-server.instance" . }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "actions-runner-controller-actions-metrics-server.serviceAccountName" -}} +{{- if .Values.actionsMetricsServer.serviceAccount.create }} +{{- default (include "actions-runner-controller-actions-metrics-server.fullname" .) .Values.actionsMetricsServer.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.actionsMetricsServer.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "actions-runner-controller-actions-metrics-server.secretName" -}} +{{- default (include "actions-runner-controller-actions-metrics-server.fullname" .) .Values.actionsMetricsServer.secret.name }} +{{- end }} + +{{- define "actions-runner-controller-actions-metrics-server.roleName" -}} +{{- include "actions-runner-controller-actions-metrics-server.fullname" . }} +{{- end }} + +{{- define "actions-runner-controller-actions-metrics-server.serviceMonitorName" -}} +{{- include "actions-runner-controller-actions-metrics-server.fullname" . | trunc 47 }}-service-monitor +{{- end }} diff --git a/helm-charts/actions-runner-controller/templates/_github_webhook_server_helpers.tpl b/simple-arc-operator/helm-charts/actions-runner-controller/templates/_github_webhook_server_helpers.tpl similarity index 100% rename from helm-charts/actions-runner-controller/templates/_github_webhook_server_helpers.tpl rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/_github_webhook_server_helpers.tpl diff --git a/helm-charts/actions-runner-controller/templates/_helpers.tpl b/simple-arc-operator/helm-charts/actions-runner-controller/templates/_helpers.tpl similarity index 100% rename from helm-charts/actions-runner-controller/templates/_helpers.tpl rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/_helpers.tpl diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.deployment.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.deployment.yaml new file mode 100644 index 0000000..ebab267 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.deployment.yaml @@ -0,0 +1,162 @@ +{{- if .Values.actionsMetricsServer.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "actions-runner-controller-actions-metrics-server.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "actions-runner-controller.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.actionsMetricsServer.replicaCount }} + selector: + matchLabels: + {{- include "actions-runner-controller-actions-metrics-server.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.actionsMetricsServer.podAnnotations }} + annotations: + kubectl.kubernetes.io/default-logs-container: "github-webhook-server" + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "actions-runner-controller-actions-metrics-server.selectorLabels" . | nindent 8 }} + {{- with .Values.actionsMetricsServer.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.actionsMetricsServer.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "actions-runner-controller-actions-metrics-server.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.actionsMetricsServer.podSecurityContext | nindent 8 }} + {{- with .Values.actionsMetricsServer.priorityClassName }} + priorityClassName: "{{ . }}" + {{- end }} + containers: + - args: + {{- $metricsHost := .Values.metrics.proxy.enabled | ternary "127.0.0.1" "0.0.0.0" }} + {{- $metricsPort := .Values.metrics.proxy.enabled | ternary "8080" .Values.metrics.port }} + - "--metrics-addr={{ $metricsHost }}:{{ $metricsPort }}" + {{- if .Values.actionsMetricsServer.logLevel }} + - "--log-level={{ .Values.actionsMetricsServer.logLevel }}" + {{- end }} + {{- if .Values.runnerGithubURL }} + - "--runner-github-url={{ .Values.runnerGithubURL }}" + {{- end }} + {{- if .Values.actionsMetricsServer.logFormat }} + - "--log-format={{ .Values.actionsMetricsServer.logFormat }}" + {{- end }} + command: + - "/actions-metrics-server" + env: + - name: GITHUB_WEBHOOK_SECRET_TOKEN + valueFrom: + secretKeyRef: + key: github_webhook_secret_token + name: {{ include "actions-runner-controller-actions-metrics-server.secretName" . }} + optional: true + {{- if .Values.githubEnterpriseServerURL }} + - name: GITHUB_ENTERPRISE_URL + value: {{ .Values.githubEnterpriseServerURL }} + {{- end }} + {{- if .Values.githubURL }} + - name: GITHUB_URL + value: {{ .Values.githubURL }} + {{- end }} + {{- if .Values.githubUploadURL }} + - name: GITHUB_UPLOAD_URL + value: {{ .Values.githubUploadURL }} + {{- end }} + {{- if .Values.actionsMetricsServer.secret.enabled }} + - name: GITHUB_TOKEN + valueFrom: + secretKeyRef: + key: github_token + name: {{ include "actions-runner-controller.githubWebhookServerSecretName" . }} + optional: true + - name: GITHUB_APP_ID + valueFrom: + secretKeyRef: + key: github_app_id + name: {{ include "actions-runner-controller.githubWebhookServerSecretName" . }} + optional: true + - name: GITHUB_APP_INSTALLATION_ID + valueFrom: + secretKeyRef: + key: github_app_installation_id + name: {{ include "actions-runner-controller.githubWebhookServerSecretName" . }} + optional: true + - name: GITHUB_APP_PRIVATE_KEY + valueFrom: + secretKeyRef: + key: github_app_private_key + name: {{ include "actions-runner-controller.githubWebhookServerSecretName" . }} + optional: true + {{- if .Values.authSecret.github_basicauth_username }} + - name: GITHUB_BASICAUTH_USERNAME + value: {{ .Values.authSecret.github_basicauth_username }} + {{- end }} + - name: GITHUB_BASICAUTH_PASSWORD + valueFrom: + secretKeyRef: + key: github_basicauth_password + name: {{ include "actions-runner-controller.secretName" . }} + optional: true + {{- end }} + {{- range $key, $val := .Values.actionsMetricsServer.env }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (cat "v" .Chart.AppVersion | replace " " "") }}" + name: actions-metrics-server + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 8000 + name: http + protocol: TCP + {{- if not .Values.metrics.proxy.enabled }} + - containerPort: {{ .Values.metrics.port }} + name: metrics-port + protocol: TCP + {{- end }} + resources: + {{- toYaml .Values.actionsMetricsServer.resources | nindent 12 }} + securityContext: + {{- toYaml .Values.actionsMetricsServer.securityContext | nindent 12 }} + {{- if .Values.metrics.proxy.enabled }} + - args: + - "--secure-listen-address=0.0.0.0:{{ .Values.metrics.port }}" + - "--upstream=http://127.0.0.1:8080/" + - "--logtostderr=true" + - "--v=10" + image: "{{ .Values.metrics.proxy.image.repository }}:{{ .Values.metrics.proxy.image.tag }}" + name: kube-rbac-proxy + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.metrics.port }} + name: metrics-port + resources: + {{- toYaml .Values.resources | nindent 12 }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + {{- end }} + terminationGracePeriodSeconds: 10 + {{- with .Values.actionsMetricsServer.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.actionsMetricsServer.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.actionsMetricsServer.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.actionsMetricsServer.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.ingress.yaml.yml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.ingress.yaml.yml new file mode 100644 index 0000000..5b54993 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.ingress.yaml.yml @@ -0,0 +1,47 @@ +{{- if .Values.actionsMetricsServer.ingress.enabled -}} +{{- $fullName := include "actions-runner-controller-actions-metrics-server.fullname" . -}} +{{- $svcPort := (index .Values.actionsMetricsServer.service.ports 0).port -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "actions-runner-controller.labels" . | nindent 4 }} + {{- with .Values.actionsMetricsServer.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.actionsMetricsServer.ingress.tls }} + tls: + {{- range .Values.actionsMetricsServer.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + {{- with .Values.actionsMetricsServer.ingress.ingressClassName }} + ingressClassName: {{ . }} + {{- end }} + rules: + {{- range .Values.actionsMetricsServer.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- if .extraPaths }} + {{- toYaml .extraPaths | nindent 10 }} + {{- end }} + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.service.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.service.yaml new file mode 100644 index 0000000..cfd2738 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.service.yaml @@ -0,0 +1,26 @@ +{{- if .Values.actionsMetricsServer.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "actions-runner-controller-actions-metrics-server.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "actions-runner-controller.labels" . | nindent 4 }} +{{- if .Values.actionsMetricsServer.service.annotations }} + annotations: + {{ toYaml .Values.actionsMetricsServer.service.annotations | nindent 4 }} +{{- end }} +spec: + type: {{ .Values.actionsMetricsServer.service.type }} + ports: + {{ range $_, $port := .Values.actionsMetricsServer.service.ports -}} + - {{ $port | toYaml | nindent 6 }} + {{- end }} + {{- if .Values.metrics.serviceMonitor }} + - name: metrics-port + port: {{ .Values.metrics.port }} + targetPort: metrics-port + {{- end }} + selector: + {{- include "actions-runner-controller-actions-metrics-server.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.serviceaccount.yaml.yml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.serviceaccount.yaml.yml new file mode 100644 index 0000000..9ab1afc --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.serviceaccount.yaml.yml @@ -0,0 +1,15 @@ +{{- if .Values.actionsMetricsServer.enabled -}} +{{- if .Values.actionsMetricsServer.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "actions-runner-controller-actions-metrics-server.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "actions-runner-controller.labels" . | nindent 4 }} + {{- with .Values.actionsMetricsServer.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} +{{- end }} diff --git a/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml new file mode 100644 index 0000000..25e72f1 --- /dev/null +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml @@ -0,0 +1,25 @@ +{{- if and .Values.actionsMetricsServer.enabled .Values.actionsMetrics.serviceMonitor }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + {{- include "actions-runner-controller.labels" . | nindent 4 }} + {{- with .Values.actionsMetricsServer.serviceMonitorLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + name: {{ include "actions-runner-controller-actions-metrics-server.serviceMonitorName" . }} + namespace: {{ .Release.Namespace }} +spec: + endpoints: + - path: /metrics + port: metrics-port + {{- if .Values.actionsMetrics.proxy.enabled }} + bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token + scheme: https + tlsConfig: + insecureSkipVerify: true + {{- end }} + selector: + matchLabels: + {{- include "actions-runner-controller-actions-metrics-server.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/helm-charts/actions-runner-controller/templates/auth_proxy_role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/auth_proxy_role.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/auth_proxy_role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/auth_proxy_role.yaml diff --git a/helm-charts/actions-runner-controller/templates/auth_proxy_role_binding.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/auth_proxy_role_binding.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/auth_proxy_role_binding.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/auth_proxy_role_binding.yaml diff --git a/helm-charts/actions-runner-controller/templates/certificate.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/certificate.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/certificate.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/certificate.yaml diff --git a/helm-charts/actions-runner-controller/templates/ci-secret.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/ci-secret.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/ci-secret.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/ci-secret.yaml diff --git a/helm-charts/actions-runner-controller/templates/controller.metrics.service.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.metrics.service.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/controller.metrics.service.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.metrics.service.yaml diff --git a/helm-charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml diff --git a/helm-charts/actions-runner-controller/templates/controller.pdb.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.pdb.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/controller.pdb.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/controller.pdb.yaml diff --git a/helm-charts/actions-runner-controller/templates/deployment.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/deployment.yaml similarity index 98% rename from helm-charts/actions-runner-controller/templates/deployment.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/deployment.yaml index 522d835..020e966 100644 --- a/helm-charts/actions-runner-controller/templates/deployment.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/deployment.yaml @@ -67,6 +67,9 @@ spec: {{- if .Values.runner.statusUpdateHook.enabled }} - "--runner-status-update-hook" {{- end }} + {{- if .Values.logFormat }} + - "--log-format={{ .Values.logFormat }}" + {{- end }} command: - "/manager" env: diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml similarity index 97% rename from helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml index 6d9d573..373ddb8 100644 --- a/helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.deployment.yaml @@ -51,6 +51,9 @@ spec: {{- if .Values.githubWebhookServer.queueLimit }} - "--queue-limit={{ .Values.githubWebhookServer.queueLimit }}" {{- end }} + {{- if .Values.githubWebhookServer.logFormat }} + - "--log-format={{ .Values.githubWebhookServer.logFormat }}" + {{- end }} command: - "/github-webhook-server" env: diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.ingress.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.ingress.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.ingress.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.ingress.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.pdb.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.pdb.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.pdb.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.pdb.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.role.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.role.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.role_binding.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.role_binding.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.role_binding.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.role_binding.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.secrets.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.secrets.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.secrets.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.secrets.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.service.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.service.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.service.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.service.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml diff --git a/helm-charts/actions-runner-controller/templates/githubwebhook.serviceaccount.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.serviceaccount.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/githubwebhook.serviceaccount.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/githubwebhook.serviceaccount.yaml diff --git a/helm-charts/actions-runner-controller/templates/leader_election_role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/leader_election_role.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/leader_election_role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/leader_election_role.yaml diff --git a/helm-charts/actions-runner-controller/templates/leader_election_role_binding.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/leader_election_role_binding.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/leader_election_role_binding.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/leader_election_role_binding.yaml diff --git a/helm-charts/actions-runner-controller/templates/manager_role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role.yaml similarity index 94% rename from helm-charts/actions-runner-controller/templates/manager_role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role.yaml index cd88f15..2049ae9 100644 --- a/helm-charts/actions-runner-controller/templates/manager_role.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role.yaml @@ -16,6 +16,18 @@ rules: - patch - update - watch +- apiGroups: + - actions.summerwind.dev + resources: + - horizontalrunnerautoscalers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - actions.summerwind.dev resources: @@ -286,7 +298,7 @@ rules: {{- end }} {{- if .Values.rbac.allowGrantingKubernetesContainerModePermissions }} {{/* These permissions are required by ARC to create RBAC resources for the runner pod to use the kubernetes container mode. */}} -{{/* See https://github.com/actions-runner-controller/actions-runner-controller/pull/1268/files#r917331632 */}} +{{/* See https://github.com/actions/actions-runner-controller/pull/1268/files#r917331632 */}} - apiGroups: - "" resources: diff --git a/helm-charts/actions-runner-controller/templates/manager_role_binding.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role_binding.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/manager_role_binding.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_role_binding.yaml diff --git a/helm-charts/actions-runner-controller/templates/manager_secrets.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_secrets.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/manager_secrets.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/manager_secrets.yaml diff --git a/helm-charts/actions-runner-controller/templates/runner_editor_role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/runner_editor_role.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/runner_editor_role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/runner_editor_role.yaml diff --git a/helm-charts/actions-runner-controller/templates/runner_viewer_role.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/runner_viewer_role.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/runner_viewer_role.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/runner_viewer_role.yaml diff --git a/helm-charts/actions-runner-controller/templates/serviceaccount.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/serviceaccount.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/serviceaccount.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/serviceaccount.yaml diff --git a/helm-charts/actions-runner-controller/templates/webhook_configs.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/webhook_configs.yaml similarity index 94% rename from helm-charts/actions-runner-controller/templates/webhook_configs.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/webhook_configs.yaml index ec8194d..7a71735 100644 --- a/helm-charts/actions-runner-controller/templates/webhook_configs.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/templates/webhook_configs.yaml @@ -53,7 +53,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -83,7 +83,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -113,7 +113,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -156,7 +156,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -186,7 +186,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -216,7 +216,7 @@ webhooks: {{- end }} clientConfig: {{- if .Values.admissionWebHooks.caBundle }} - caBundle: {{ .Values.admissionWebHooks.caBundle }} + caBundle: {{ quote .Values.admissionWebHooks.caBundle }} {{- else if not .Values.certManagerEnabled }} caBundle: {{ $ca.Cert | b64enc | quote }} {{- end }} @@ -237,7 +237,7 @@ webhooks: resources: - runnerreplicasets sideEffects: None -{{ if not (or .Values.admissionWebHooks.caBundle .Values.certManagerEnabled) }} +{{ if not (or (hasKey .Values.admissionWebHooks "caBundle") .Values.certManagerEnabled) }} --- apiVersion: v1 kind: Secret diff --git a/helm-charts/actions-runner-controller/templates/webhook_service.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/templates/webhook_service.yaml similarity index 100% rename from helm-charts/actions-runner-controller/templates/webhook_service.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/templates/webhook_service.yaml diff --git a/helm-charts/actions-runner-controller/values.yaml b/simple-arc-operator/helm-charts/actions-runner-controller/values.yaml similarity index 69% rename from helm-charts/actions-runner-controller/values.yaml rename to simple-arc-operator/helm-charts/actions-runner-controller/values.yaml index b570613..fb9a337 100644 --- a/helm-charts/actions-runner-controller/values.yaml +++ b/simple-arc-operator/helm-charts/actions-runner-controller/values.yaml @@ -30,7 +30,7 @@ enableLeaderElection: true # # Do set authSecret.enabled=false and set env if you want full control over # the GitHub authn related envvars of the container. -# See https://github.com/actions-runner-controller/actions-runner-controller/pull/937 for more details. +# See https://github.com/actions/actions-runner-controller/pull/937 for more details. authSecret: enabled: true create: false @@ -70,7 +70,7 @@ rbac: # # This allows ARC to dynamically create a ServiceAccount and a Role for each Runner pod that uses "kubernetes" container mode, # # by extending ARC's manager role to have the same permissions required by the pod runs the runner agent in "kubernetes" container mode. # # Without this, Kubernetes blocks ARC to create the role to prevent a priviledge escalation. - # # See https://github.com/actions-runner-controller/actions-runner-controller/pull/1268/files#r917327010 + # # See https://github.com/actions/actions-runner-controller/pull/1268/files#r917327010 # allowGrantingKubernetesContainerModePermissions: true serviceAccount: @@ -185,13 +185,18 @@ admissionWebHooks: #caBundle: "Ci0tLS0tQk......tLS0K" # There may be alternatives to setting `hostNetwork: true`, see -# https://github.com/actions-runner-controller/actions-runner-controller/issues/1005#issuecomment-993097155 +# https://github.com/actions/actions-runner-controller/issues/1005#issuecomment-993097155 #hostNetwork: true +## specify log format for actions runner controller. Valid options are "text" and "json" +logFormat: text + githubWebhookServer: enabled: false replicaCount: 1 useRunnerGroupsVisibility: false + ## specify log format for github webhook controller. Valid options are "text" and "json" + logFormat: text secret: enabled: false create: false @@ -271,3 +276,100 @@ githubWebhookServer: # minAvailable: 1 # maxUnavailable: 3 # queueLimit: 100 + +actionsMetrics: + serviceAnnotations: {} + # Set serviceMonitor=true to create a service monitor + # as a part of the helm release. + # Do note that you also need actionsMetricsServer.enabled=true + # to deploy the actions-metrics-server whose k8s service is referenced by the service monitor. + serviceMonitor: false + serviceMonitorLabels: {} + port: 8443 + proxy: + enabled: true + image: + repository: quay.io/brancz/kube-rbac-proxy + tag: v0.13.1 + +actionsMetricsServer: + enabled: false + # DO NOT CHANGE THIS! + # See the thread below for more context. + # https://github.com/actions/actions-runner-controller/pull/1814#discussion_r974758924 + replicaCount: 1 + ## specify log format for github webhook controller. Valid options are "text" and "json" + logFormat: text + secret: + enabled: false + create: false + name: "actions-metrics-server" + ### GitHub Webhook Configuration + github_webhook_secret_token: "" + ### GitHub Apps Configuration + ## NOTE: IDs MUST be strings, use quotes + #github_app_id: "" + #github_app_installation_id: "" + #github_app_private_key: | + ### GitHub PAT Configuration + #github_token: "" + imagePullSecrets: [] + nameOverride: "" + fullnameOverride: "" + serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + podAnnotations: {} + podLabels: {} + podSecurityContext: {} + # fsGroup: 2000 + securityContext: {} + resources: {} + nodeSelector: {} + tolerations: [] + affinity: {} + priorityClassName: "" + service: + type: ClusterIP + annotations: {} + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + #nodePort: someFixedPortForUseWithTerraformCdkCfnEtc + ingress: + enabled: false + ingressClassName: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + # - path: /* + # pathType: ImplementationSpecific + # Extra paths that are not automatically connected to the server. This is useful when working with annotation based services. + extraPaths: [] + # - path: /* + # backend: + # serviceName: ssl-redirect + # servicePort: use-annotation + ## for Kubernetes >=1.19 (when "networking.k8s.io/v1" is used) + # - path: /* + # pathType: Prefix + # backend: + # service: + # name: ssl-redirect + # port: + # name: use-annotation + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + diff --git a/watches.yaml b/simple-arc-operator/watches.yaml similarity index 83% rename from watches.yaml rename to simple-arc-operator/watches.yaml index 229b640..83eb85b 100644 --- a/watches.yaml +++ b/simple-arc-operator/watches.yaml @@ -1,5 +1,5 @@ # Use the 'create api' subcommand to add watches to this file. -- group: charts.example.com +- group: github-practice.boxboat.com version: v1alpha1 kind: ActionsRunnerController chart: helm-charts/actions-runner-controller diff --git a/tail b/tail new file mode 100644 index 0000000..c338af2 --- /dev/null +++ b/tail @@ -0,0 +1,315 @@ +- apiGroups: + - actions.summerwind.dev + resources: + - horizontalrunnerautoscalers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - horizontalrunnerautoscalers/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - horizontalrunnerautoscalers/status + verbs: + - get + - patch + - update +- apiGroups: + - actions.summerwind.dev + resources: + - runnerdeployments + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnerdeployments/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnerdeployments/status + verbs: + - get + - patch + - update +- apiGroups: + - actions.summerwind.dev + resources: + - runnerreplicasets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnerreplicasets/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnerreplicasets/status + verbs: + - get + - patch + - update +- apiGroups: + - actions.summerwind.dev + resources: + - runners + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runners/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runners/status + verbs: + - get + - patch + - update +- apiGroups: + - actions.summerwind.dev + resources: + - runnersets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnersets/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - actions.summerwind.dev + resources: + - runnersets/status + verbs: + - get + - patch + - update +- apiGroups: + - "apps" + resources: + - statefulsets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "apps" + resources: + - statefulsets/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +- apiGroups: + - "" + resources: + - persistentvolumeclaims + verbs: + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - persistentvolumes + verbs: + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - list + - update +- apiGroups: + - "" + resources: + - pods + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - pods/finalizers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - watch +{{- if .Values.runner.statusUpdateHook.enabled }} +- apiGroups: + - "" + resources: + - serviceaccounts + verbs: + - create + - delete + - get +- apiGroups: + - rbac.authorization.k8s.io + resources: + - rolebindings + verbs: + - create + - delete + - get +- apiGroups: + - rbac.authorization.k8s.io + resources: + - roles + verbs: + - create + - delete + - get +{{- end }} +{{- if .Values.rbac.allowGrantingKubernetesContainerModePermissions }} +{{/* These permissions are required by ARC to create RBAC resources for the runner pod to use the kubernetes container mode. */}} +{{/* See https://github.com/actions/actions-runner-controller/pull/1268/files#r917331632 */}} +- apiGroups: + - "" + resources: + - pods/exec + verbs: + - create + - get +- apiGroups: + - "" + resources: + - pods/log + verbs: + - get + - list + - watch +- apiGroups: + - "batch" + resources: + - jobs + verbs: + - get + - list + - create + - delete +- apiGroups: + - "" + resources: + - secrets + verbs: + - create + - delete +{{- end }}