thecluster-operator

module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0

README

THECLUSTER Operator

Hercules CI

An operator for useful stuff in your CLUSTER. WIP.

APIs

Group Kind What it does
actions.thecluster.io Repository A GitHub Actions runner scale set for one repo
core.thecluster.io WireguardClient Runs a linuxserver/wireguard client
pia.thecluster.io WireguardConfig Generates a WireGuard config from PIA credentials
registry.thecluster.io Registry Connects to a Harbor instance
registry.thecluster.io ProxyCache A pull-through cache of one upstream registry
registry.thecluster.io Project A private project to push to

Samples live in config/samples/.

Runners

The actions.thecluster.io group is a thin layer over actions-runner-controller's scale sets, which must already be installed.

  • Repository is cluster scoped and needs only spec.url. It renders what the gha-runner-scale-set chart would: a namespace (arc-<name> by default), a copy of the GitHub credentials Secret, the runner ServiceAccount, the controller's Role and RoleBinding, and the AutoscalingRunnerSet. Every other field defaults from the operator's flags: a dind runner with a /nix volume, --max-runners, --runner-scale-set-name, and --github-config-secret. spec.template replaces the default runner pod outright. The manager needs --arc-version, --arc-service-account, --runner-image, and --dind-image; without them every Repository reports Misconfigured. Deleting a Repository deletes the scale set, waits for the controller to clean it up, then deletes the namespace.
  • User is cluster scoped and generates a Repository for each of a GitHub user's repositories it selects, applying spec.template to every one. It selects the names in spec.repositories, plus, with spec.discover, every repository the user owns that the credentials can see. Discovery reads the same githubConfigSecret the scale sets use, a GitHub App or a token, and runs every spec.interval (ten minutes by default). spec.include and spec.exclude filter discovered repositories by name glob, and archived repositories and forks are skipped unless spec.includeArchived or spec.includeForks is set. A generated Repository is named after its repository, lowercased with dots and underscores as dashes, and is deleted once the User no longer selects it. A Repository the User did not create is left alone and listed in status.conflicts, so one with hand-written overrides can sit beside a User that would also select it. --github-url and --github-api-url point it at a GitHub other than github.com.
Registries

The registry.thecluster.io group describes registries by what they do rather than how a product configures it. Harbor is the only backend so far.

  • Registry points at a Harbor instance with an administrator's password from a Secret, and reports Ready plus the host clients pull from.
  • ProxyCache is a pull-through cache of one upstream (Docker Hub, ghcr.io, quay.io, or any distribution registry). On Harbor it becomes a registry endpoint and a proxy-cache project, both named after the ProxyCache, and status.endpoint is the prefix to pull through. Settings changed in Harbor are put back on the next resync, every ten minutes. Deleting the ProxyCache deletes the project, its cached images, and the endpoint.
  • Project is a private project named after it, with status.endpoint as the prefix to push to. Project names are global to the Registry, so a project the operator did not create, including one another namespace claimed first, is refused with a Conflict condition. Deleting the Project deletes the Harbor project only once it is empty, since what was pushed cannot be pulled again; until then the Project stays, reporting why.

Development

Everything comes from the Nix devshell: copy hack/example.envrc to .envrc for direnv, or prefix commands with nix develop -c.

make test       # envtest suites; KUBEBUILDER_ASSETS is set by the devshell
make lint       # golangci-lint
make fmt        # treefmt
make check      # nix flake check
make manifests generate  # regenerate CRDs, RBAC and deepcopy code after editing api/
make kind-cluster test-e2e

Install

The Helm chart is in dist/chart, regenerated from config/ by make helm. Images are published to ghcr.io/unmango/thecluster-operator.

helm install thecluster-operator ./dist/chart \
  --namespace thecluster-operator-system --create-namespace

Directories

Path Synopsis
api
actions/v1alpha1
Package v1alpha1 contains API Schema definitions for the actions v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the actions v1alpha1 API group.
core/v1alpha1
Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group.
pia/v1alpha1
Package v1alpha1 contains API Schema definitions for the pia v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the pia v1alpha1 API group.
registry/v1alpha1
Package v1alpha1 contains API Schema definitions for the registry v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the registry v1alpha1 API group.
internal
arc
Package arc holds the slice of actions-runner-controller's actions.github.com/v1alpha1 API that this operator writes and reads.
Package arc holds the slice of actions-runner-controller's actions.github.com/v1alpha1 API that this operator writes and reads.
github
Package github lists the repositories User discovery selects from, with credentials in the actions-runner-controller's githubConfigSecret format, so discovery and the scale sets share one Secret.
Package github lists the repositories User discovery selects from, with credentials in the actions-runner-controller's githubConfigSecret format, so discovery and the scale sets share one Secret.
github/githubtest
Package githubtest is an in-memory stand-in for the parts of GitHub's API that package github calls.
Package githubtest is an in-memory stand-in for the parts of GitHub's API that package github calls.
harbor
Package harbor adapts goharbor/go-client to the parts of Harbor's v2.0 API the registry controllers use: registry endpoints, projects, and the repositories that have to go before a project can be deleted.
Package harbor adapts goharbor/go-client to the parts of Harbor's v2.0 API the registry controllers use: registry endpoints, projects, and the repositories that have to go before a project can be deleted.
harbor/harbortest
Package harbortest is an in-memory stand-in for the parts of Harbor's API that package harbor calls.
Package harbortest is an in-memory stand-in for the parts of Harbor's API that package harbor calls.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL