Documentation
¶
Index ¶
Constants ¶
const ( // RepositoryFinalizer holds a Repository until its AutoscalingRunnerSet // is gone, so the actions-runner-controller can deregister the scale set // and clean up its runners before the namespace goes. RepositoryFinalizer = "repository.actions.thecluster.io/finalizer" // TypeReady is the condition a Repository reports. TypeReady = "Ready" )
const (
// UserLabel names the User that generated a Repository.
UserLabel = "actions.thecluster.io/user"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultNamespace ¶
DefaultNamespace is the namespace a Repository named name gets when it sets none: the prefix and the name, with the dots and underscores a namespace cannot hold replaced by dashes. It matches the arc-runner-scale-set chart in the-cluster, so a migrated scale set keeps its namespace.
A result longer than a namespace can be is cut short and given a hash of the full name, so two long names that share a beginning stay apart.
func RepositoryName ¶
RepositoryName is the name of the Repository a User generates for the repository called repo: lowercased, with dots and underscores replaced by dashes. It matches the scale set names in the-cluster's arc-runners, so a generated Repository lands in the namespace the chart used.
Types ¶
type Defaults ¶
type Defaults struct {
// ControllerVersion is the actions-runner-controller version. The
// controller deletes any AutoscalingRunnerSet whose version label differs
// from its own in major or minor.
ControllerVersion string
// ControllerServiceAccount is the controller's ServiceAccount, which each
// scale set's manager Role is bound to.
ControllerServiceAccount types.NamespacedName
// GitHubConfigSecret is the Secret copied into a Repository's namespace
// when it names none.
GitHubConfigSecret types.NamespacedName
NamespacePrefix string
RunnerScaleSetName string
MaxRunners int32
RunnerImage string
DindImage string
StorageClass string
NixStorageSize resource.Quantity
WorkSize resource.Quantity
// RunnerNixConfig is set as NIX_CONFIG on the runner container, for
// example to point nix at an in-cluster binary cache. Empty sets nothing.
RunnerNixConfig string
}
Defaults is what a Repository gets for every field it leaves unset, plus the facts about the cluster's actions-runner-controller install that no Repository should have to restate. The manager fills it from flags, so image pins and cluster specifics stay with whoever deploys the operator.
type RepositoryReconciler ¶
func (*RepositoryReconciler) Reconcile ¶
func (r *RepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile renders a Repository as the objects the gha-runner-scale-set chart would: a namespace, a copy of the GitHub credentials, a ServiceAccount with no permissions for the runners, a Role and RoleBinding for the controller, and the AutoscalingRunnerSet itself.
func (*RepositoryReconciler) SetupWithManager ¶
func (r *RepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type UserReconciler ¶
type UserReconciler struct {
client.Client
Scheme *runtime.Scheme
Defaults Defaults
// GitHubURL is where repositories live, for the URL of a Repository the
// User lists by name. GitHubAPIURL is what discovery calls.
GitHubURL string
GitHubAPIURL string
}
func (*UserReconciler) Reconcile ¶
Reconcile generates a Repository for each repository the User selects, and deletes the Repositories it generated for repositories it no longer selects. A Repository someone else created is left alone, even when the User selects its repository. Deleting the User deletes its Repositories through their owner references.
func (*UserReconciler) SetupWithManager ¶
func (r *UserReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager. Status updates are filtered out, since each reconcile writes the User's own and would otherwise start another discovery before the interval is up.