Documentation ¶
Index ¶
- Constants
- func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string
- func CloneSelectorAndAddLabel(selector *metav1.LabelSelector, labelKey, labelValue string) *metav1.LabelSelector
- func ComputeHash(template interface{}) string
- func MatchSchedule(now time.Time, startTime, endTime time.Time, recurrenceRule RecurrenceRule) (*Period, *Period, error)
- type HorizontalRunnerAutoscalerGitHubWebhook
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.ResponseWriter, r *http.Request)
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchCheckRunEvent(event *github.CheckRunEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPullRequestEvent(event *github.PullRequestEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPushEvent(event *github.PushEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Reconcile(request reconcile.Request) (reconcile.Result, error)
- func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) SetupWithManager(mgr ctrl.Manager) error
- type HorizontalRunnerAutoscalerReconciler
- type Override
- type Period
- type RecurrenceRule
- type RunnerDeploymentReconciler
- type RunnerReconciler
- type RunnerReplicaSetReconciler
- type ScaleTarget
Constants ¶
const ( LabelKeyRunnerTemplateHash = "runner-template-hash" LabelKeyRunnerDeploymentName = "runner-deployment-name" )
const (
DefaultScaleDownDelay = 10 * time.Minute
)
const (
LabelKeyPodTemplateHash = "pod-template-hash"
)
Variables ¶
This section is empty.
Functions ¶
func CloneAndAddLabel ¶ added in v0.4.0
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 ¶ added in v0.18.0
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 ¶ added in v0.4.0
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 ¶ added in v0.19.0
Types ¶
type HorizontalRunnerAutoscalerGitHubWebhook ¶ added in v0.18.0
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 // 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 ¶ added in v0.18.0
func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) Handle(w http.ResponseWriter, r *http.Request)
func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchCheckRunEvent ¶ added in v0.18.0
func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchCheckRunEvent(event *github.CheckRunEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchPullRequestEvent ¶ added in v0.18.0
func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPullRequestEvent(event *github.PullRequestEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
func (*HorizontalRunnerAutoscalerGitHubWebhook) MatchPushEvent ¶ added in v0.18.0
func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) MatchPushEvent(event *github.PushEvent) func(scaleUpTrigger v1alpha1.ScaleUpTrigger) bool
func (*HorizontalRunnerAutoscalerGitHubWebhook) SetupWithManager ¶ added in v0.18.0
func (autoscaler *HorizontalRunnerAutoscalerGitHubWebhook) SetupWithManager(mgr ctrl.Manager) error
type HorizontalRunnerAutoscalerReconciler ¶ added in v0.7.0
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) SetupWithManager ¶ added in v0.7.0
func (r *HorizontalRunnerAutoscalerReconciler) SetupWithManager(mgr ctrl.Manager) error
type Override ¶ added in v0.19.0
type Override struct { ScheduledOverride v1alpha1.ScheduledOverride Period Period }
type RecurrenceRule ¶ added in v0.19.0
type RunnerDeploymentReconciler ¶ added in v0.4.0
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) SetupWithManager ¶ added in v0.4.0
func (r *RunnerDeploymentReconciler) 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 DockerImage string Name string RegistrationRecheckInterval time.Duration RegistrationRecheckJitter time.Duration }
RunnerReconciler reconciles a Runner object
func (*RunnerReconciler) SetupWithManager ¶
func (r *RunnerReconciler) SetupWithManager(mgr ctrl.Manager) error
type RunnerReplicaSetReconciler ¶ added in v0.4.0
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) SetupWithManager ¶ added in v0.4.0
func (r *RunnerReplicaSetReconciler) SetupWithManager(mgr ctrl.Manager) error
type ScaleTarget ¶ added in v0.18.0
type ScaleTarget struct { v1alpha1.HorizontalRunnerAutoscaler v1alpha1.ScaleUpTrigger }
Source Files ¶
- autoscaling.go
- horizontal_runner_autoscaler_webhook.go
- horizontal_runner_autoscaler_webhook_on_check_run.go
- horizontal_runner_autoscaler_webhook_on_pull_request.go
- horizontal_runner_autoscaler_webhook_on_push.go
- horizontalrunnerautoscaler_controller.go
- runner_controller.go
- runnerdeployment_controller.go
- runnerreplicaset_controller.go
- schedule.go
- utils.go