controllers

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelKeyPodTemplateHash = "pod-template-hash"

	EnvVarOrg        = "RUNNER_ORG"
	EnvVarRepo       = "RUNNER_REPO"
	EnvVarEnterprise = "RUNNER_ENTERPRISE"
)
View Source
const (
	LabelKeyRunnerTemplateHash   = "runner-template-hash"
	LabelKeyRunnerDeploymentName = "runner-deployment-name"
)
View Source
const (
	AnnotationKeyLastRegistrationCheckTime = "actions-runner-controller/last-registration-check-time"
)
View Source
const (
	AnnotationKeyTokenExpirationDate = "actions-runner-controller/token-expires-at"
)
View Source
const (
	DefaultScaleDownDelay = 10 * time.Minute
)
View Source
const (
	LabelKeyRunnerSetName = "runnerset-name"
)

Variables

View Source
var LabelKeyPodMutation = "actions-runner-controller/inject-registration-token"
View Source
var LabelValuePodMutation = "true"

Functions

func CloneAndAddLabel

func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string

Clones the given map and returns a new map with the given key and value added. Returns the given map, if labelKey is empty.

Proudly copied from k8s.io/kubernetes/pkg/util/labels.CloneAndAddLabel

func CloneSelectorAndAddLabel

func CloneSelectorAndAddLabel(selector *metav1.LabelSelector, labelKey, labelValue string) *metav1.LabelSelector

Clones the given selector and returns a new selector with the given key and value added. Returns the given selector, if labelKey is empty.

Proudly copied from k8s.io/kubernetes/pkg/util/labels.CloneSelectorAndAddLabel

func ComputeHash

func ComputeHash(template interface{}) string

ComputeHash returns a hash value calculated from pod template and a collisionCount to avoid hash collision. The hash will be safe encoded to avoid bad words.

Proudly modified and adopted from k8s.io/kubernetes/pkg/util/hash.DeepHashObject and k8s.io/kubernetes/pkg/controller.ComputeHash.

func MatchSchedule

func MatchSchedule(now time.Time, startTime, endTime time.Time, recurrenceRule RecurrenceRule) (*Period, *Period, error)

Types

type HorizontalRunnerAutoscalerGitHubWebhook

type HorizontalRunnerAutoscalerGitHubWebhook struct {
	client.Client
	Log      logr.Logger
	Recorder record.EventRecorder
	Scheme   *runtime.Scheme

	// SecretKeyBytes is the byte representation of the Webhook secret token
	// the administrator is generated and specified in GitHub Web UI.
	SecretKeyBytes []byte

	// GitHub Client to discover runner groups assigned to a repository
	GitHubClient *github.Client

	// Namespace is the namespace to watch for HorizontalRunnerAutoscaler's to be
	// scaled on Webhook.
	// Set to empty for letting it watch for all namespaces.
	Namespace string
	Name      string
}

HorizontalRunnerAutoscalerGitHubWebhook autoscales a HorizontalRunnerAutoscaler and the RunnerDeployment on each GitHub Webhook received

func (*HorizontalRunnerAutoscalerGitHubWebhook) Handle

func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchCheckRunEvent

func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchCheckRunEvent(event *github.CheckRunEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool

func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchPullRequestEvent

func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPullRequestEvent(event *github.PullRequestEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool

func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchPushEvent

func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPushEvent(event *github.PushEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool

func (*HorizontalRunnerAutoscalerGitHubWebhook) Reconcile

func (*HorizontalRunnerAutoscalerGitHubWebhook) SetupWithManager

func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) SetupWithManager(mgr ctrl.Manager) error

type HorizontalRunnerAutoscalerReconciler

type HorizontalRunnerAutoscalerReconciler struct {
	client.Client
	GitHubClient *github.Client
	Log          logr.Logger
	Recorder     record.EventRecorder
	Scheme       *runtime.Scheme

	CacheDuration time.Duration
	Name          string
}

HorizontalRunnerAutoscalerReconciler reconciles a HorizontalRunnerAutoscaler object

func (*HorizontalRunnerAutoscalerReconciler) Reconcile

func (*HorizontalRunnerAutoscalerReconciler) SetupWithManager

func (r *HorizontalRunnerAutoscalerReconciler) SetupWithManager(mgr ctrl.Manager) error

type Override

type Override struct {
	ScheduledOverride v1alpha1.ScheduledOverride
	Period            Period
}

type Period

type Period struct {
	StartTime time.Time
	EndTime   time.Time
}

func (*Period) String

func (r *Period) String() string

type PodRunnerTokenInjector

type PodRunnerTokenInjector struct {
	client.Client

	Name         string
	Log          logr.Logger
	Recorder     record.EventRecorder
	GitHubClient *github.Client
	// contains filtered or unexported fields
}

func (*PodRunnerTokenInjector) Handle

func (*PodRunnerTokenInjector) InjectDecoder

func (t *PodRunnerTokenInjector) InjectDecoder(d *admission.Decoder) error

func (*PodRunnerTokenInjector) SetupWithManager

func (r *PodRunnerTokenInjector) SetupWithManager(mgr ctrl.Manager) error

type RecurrenceRule

type RecurrenceRule struct {
	Frequency string
	UntilTime time.Time
}

type RunnerDeploymentReconciler

type RunnerDeploymentReconciler struct {
	client.Client
	Log                logr.Logger
	Recorder           record.EventRecorder
	Scheme             *runtime.Scheme
	CommonRunnerLabels []string
	Name               string
}

RunnerDeploymentReconciler reconciles a Runner object

func (*RunnerDeploymentReconciler) Reconcile

func (*RunnerDeploymentReconciler) SetupWithManager

func (r *RunnerDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error

type RunnerPodReconciler

type RunnerPodReconciler struct {
	client.Client
	Log                         logr.Logger
	Recorder                    record.EventRecorder
	Scheme                      *runtime.Scheme
	GitHubClient                *github.Client
	Name                        string
	RegistrationRecheckInterval time.Duration
	RegistrationRecheckJitter   time.Duration
}

RunnerPodReconciler reconciles a Runner object

func (*RunnerPodReconciler) Reconcile

func (r *RunnerPodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*RunnerPodReconciler) SetupWithManager

func (r *RunnerPodReconciler) SetupWithManager(mgr ctrl.Manager) error

type RunnerReconciler

type RunnerReconciler struct {
	client.Client
	Log                         logr.Logger
	Recorder                    record.EventRecorder
	Scheme                      *runtime.Scheme
	GitHubClient                *github.Client
	RunnerImage                 string
	RunnerImagePullSecrets      []string
	DockerImage                 string
	DockerRegistryMirror        string
	Name                        string
	RegistrationRecheckInterval time.Duration
	RegistrationRecheckJitter   time.Duration
}

RunnerReconciler reconciles a Runner object

func (*RunnerReconciler) Reconcile

func (r *RunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*RunnerReconciler) SetupWithManager

func (r *RunnerReconciler) SetupWithManager(mgr ctrl.Manager) error

type RunnerReplicaSetReconciler

type RunnerReplicaSetReconciler struct {
	client.Client
	Log          logr.Logger
	Recorder     record.EventRecorder
	Scheme       *runtime.Scheme
	GitHubClient *github.Client
	Name         string
}

RunnerReplicaSetReconciler reconciles a Runner object

func (*RunnerReplicaSetReconciler) Reconcile

func (*RunnerReplicaSetReconciler) SetupWithManager

func (r *RunnerReplicaSetReconciler) SetupWithManager(mgr ctrl.Manager) error

type RunnerSetReconciler

type RunnerSetReconciler struct {
	Name string

	client.Client
	Log      logr.Logger
	Recorder record.EventRecorder
	Scheme   *runtime.Scheme

	CommonRunnerLabels     []string
	GitHubBaseURL          string
	RunnerImage            string
	RunnerImagePullSecrets []string
	DockerImage            string
	DockerRegistryMirror   string
}

RunnerSetReconciler reconciles a Runner object

func (*RunnerSetReconciler) Reconcile

func (r *RunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*RunnerSetReconciler) SetupWithManager

func (r *RunnerSetReconciler) SetupWithManager(mgr ctrl.Manager) error

Directories

Path Synopsis
Package metrics provides the metrics of custom resources such as HRA.
Package metrics provides the metrics of custom resources such as HRA.

Jump to

Keyboard shortcuts

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