Merge branch 'master' into dependabot/go_modules/gomod-d479b7dd4b
This commit is contained in:
@@ -6,7 +6,7 @@ endif
|
|||||||
DOCKER_USER ?= $(shell echo ${DOCKER_IMAGE_NAME} | cut -d / -f1)
|
DOCKER_USER ?= $(shell echo ${DOCKER_IMAGE_NAME} | cut -d / -f1)
|
||||||
VERSION ?= dev
|
VERSION ?= dev
|
||||||
COMMIT_SHA = $(shell git rev-parse HEAD)
|
COMMIT_SHA = $(shell git rev-parse HEAD)
|
||||||
RUNNER_VERSION ?= 2.333.1
|
RUNNER_VERSION ?= 2.334.0
|
||||||
TARGETPLATFORM ?= $(shell arch)
|
TARGETPLATFORM ?= $(shell arch)
|
||||||
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
|
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
|
||||||
RUNNER_TAG ?= ${VERSION}
|
RUNNER_TAG ?= ${VERSION}
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ spec:
|
|||||||
{{- with .Values.flags.k8sClientRateLimiterBurst }}
|
{{- with .Values.flags.k8sClientRateLimiterBurst }}
|
||||||
- "--k8s-client-rate-limiter-burst={{ . }}"
|
- "--k8s-client-rate-limiter-burst={{ . }}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- with .Values.flags.rateLimiter }}
|
||||||
|
{{- with .name }}
|
||||||
|
- "--workqueue-rate-limiter={{ . }}"
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
command:
|
command:
|
||||||
- "/manager"
|
- "/manager"
|
||||||
{{- with .Values.metrics }}
|
{{- with .Values.metrics }}
|
||||||
|
|||||||
@@ -136,6 +136,13 @@ flags:
|
|||||||
# excludeLabelPropagationPrefixes:
|
# excludeLabelPropagationPrefixes:
|
||||||
# - "argocd.argoproj.io/instance"
|
# - "argocd.argoproj.io/instance"
|
||||||
|
|
||||||
|
## Workqueue rate limiter configuration.
|
||||||
|
## By default, controller-runtime uses a combined rate limiter with both a per-item
|
||||||
|
## exponential backoff and an overall token bucket (10 QPS, 100 bucket size).
|
||||||
|
## Valid names: "bucket_rate_limiter" (default), "typed_rate_limiter" (per-item only, no global token bucket).
|
||||||
|
# rateLimiter:
|
||||||
|
# name: "bucket_rate_limiter"
|
||||||
|
|
||||||
# Overrides the default `.Release.Namespace` for all resources in this chart.
|
# Overrides the default `.Release.Namespace` for all resources in this chart.
|
||||||
namespaceOverride: ""
|
namespaceOverride: ""
|
||||||
|
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ func (r *AutoscalingListenerReconciler) publishRunningListener(autoscalingListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetupWithManager sets up the controller with the Manager.
|
// SetupWithManager sets up the controller with the Manager.
|
||||||
func (r *AutoscalingListenerReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *AutoscalingListenerReconciler) SetupWithManager(mgr ctrl.Manager, opts ...Option) error {
|
||||||
labelBasedWatchFunc := func(_ context.Context, obj client.Object) []reconcile.Request {
|
labelBasedWatchFunc := func(_ context.Context, obj client.Object) []reconcile.Request {
|
||||||
var requests []reconcile.Request
|
var requests []reconcile.Request
|
||||||
labels := obj.GetLabels()
|
labels := obj.GetLabels()
|
||||||
@@ -716,14 +716,16 @@ func (r *AutoscalingListenerReconciler) SetupWithManager(mgr ctrl.Manager) error
|
|||||||
return requests
|
return requests
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return builderWithOptions(
|
||||||
For(&v1alpha1.AutoscalingListener{}).
|
ctrl.NewControllerManagedBy(mgr).
|
||||||
Owns(&corev1.Pod{}).
|
For(&v1alpha1.AutoscalingListener{}).
|
||||||
Owns(&corev1.ServiceAccount{}).
|
Owns(&corev1.Pod{}).
|
||||||
Watches(&rbacv1.Role{}, handler.EnqueueRequestsFromMapFunc(labelBasedWatchFunc)).
|
Owns(&corev1.ServiceAccount{}).
|
||||||
Watches(&rbacv1.RoleBinding{}, handler.EnqueueRequestsFromMapFunc(labelBasedWatchFunc)).
|
Watches(&rbacv1.Role{}, handler.EnqueueRequestsFromMapFunc(labelBasedWatchFunc)).
|
||||||
WithEventFilter(predicate.ResourceVersionChangedPredicate{}).
|
Watches(&rbacv1.RoleBinding{}, handler.EnqueueRequestsFromMapFunc(labelBasedWatchFunc)).
|
||||||
Complete(r)
|
WithEventFilter(predicate.ResourceVersionChangedPredicate{}),
|
||||||
|
opts,
|
||||||
|
).Complete(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func listenerContainerStatus(pod *corev1.Pod) *corev1.ContainerStatus {
|
func listenerContainerStatus(pod *corev1.Pod) *corev1.ContainerStatus {
|
||||||
|
|||||||
@@ -762,25 +762,27 @@ func (r *AutoscalingRunnerSetReconciler) listEphemeralRunnerSets(ctx context.Con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetupWithManager sets up the controller with the Manager.
|
// SetupWithManager sets up the controller with the Manager.
|
||||||
func (r *AutoscalingRunnerSetReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *AutoscalingRunnerSetReconciler) SetupWithManager(mgr ctrl.Manager, opts ...Option) error {
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return builderWithOptions(
|
||||||
For(&v1alpha1.AutoscalingRunnerSet{}).
|
ctrl.NewControllerManagedBy(mgr).
|
||||||
Owns(&v1alpha1.EphemeralRunnerSet{}).
|
For(&v1alpha1.AutoscalingRunnerSet{}).
|
||||||
Watches(&v1alpha1.AutoscalingListener{}, handler.EnqueueRequestsFromMapFunc(
|
Owns(&v1alpha1.EphemeralRunnerSet{}).
|
||||||
func(_ context.Context, o client.Object) []reconcile.Request {
|
Watches(&v1alpha1.AutoscalingListener{}, handler.EnqueueRequestsFromMapFunc(
|
||||||
autoscalingListener := o.(*v1alpha1.AutoscalingListener)
|
func(_ context.Context, o client.Object) []reconcile.Request {
|
||||||
return []reconcile.Request{
|
autoscalingListener := o.(*v1alpha1.AutoscalingListener)
|
||||||
{
|
return []reconcile.Request{
|
||||||
NamespacedName: types.NamespacedName{
|
{
|
||||||
Namespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace,
|
NamespacedName: types.NamespacedName{
|
||||||
Name: autoscalingListener.Spec.AutoscalingRunnerSetName,
|
Namespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace,
|
||||||
|
Name: autoscalingListener.Spec.AutoscalingRunnerSetName,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
},
|
||||||
},
|
)).
|
||||||
)).
|
WithEventFilter(predicate.ResourceVersionChangedPredicate{}),
|
||||||
WithEventFilter(predicate.ResourceVersionChangedPredicate{}).
|
opts,
|
||||||
Complete(r)
|
).Complete(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
type autoscalingRunnerSetFinalizerDependencyCleaner struct {
|
type autoscalingRunnerSetFinalizerDependencyCleaner struct {
|
||||||
|
|||||||
@@ -522,12 +522,14 @@ func (r *EphemeralRunnerSetReconciler) deleteEphemeralRunnerWithActionsClient(ct
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetupWithManager sets up the controller with the Manager.
|
// SetupWithManager sets up the controller with the Manager.
|
||||||
func (r *EphemeralRunnerSetReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
func (r *EphemeralRunnerSetReconciler) SetupWithManager(mgr ctrl.Manager, opts ...Option) error {
|
||||||
return ctrl.NewControllerManagedBy(mgr).
|
return builderWithOptions(
|
||||||
For(&v1alpha1.EphemeralRunnerSet{}).
|
ctrl.NewControllerManagedBy(mgr).
|
||||||
Owns(&v1alpha1.EphemeralRunner{}).
|
For(&v1alpha1.EphemeralRunnerSet{}).
|
||||||
WithEventFilter(predicate.ResourceVersionChangedPredicate{}).
|
Owns(&v1alpha1.EphemeralRunner{}).
|
||||||
Complete(r)
|
WithEventFilter(predicate.ResourceVersionChangedPredicate{}),
|
||||||
|
opts,
|
||||||
|
).Complete(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ephemeralRunnerStepper struct {
|
type ephemeralRunnerStepper struct {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package actionsgithubcom
|
package actionsgithubcom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/client-go/util/workqueue"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/controller"
|
"sigs.k8s.io/controller-runtime/pkg/controller"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options is the optional configuration for the controllers, which can be
|
// Options is the optional configuration for the controllers, which can be
|
||||||
@@ -37,6 +39,25 @@ func WithMaxConcurrentReconciles(n int) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithTypedRateLimiter sets the rate limiter for the controller's workqueue.
|
||||||
|
//
|
||||||
|
// By default, the controller-runtime uses
|
||||||
|
// workqueue.DefaultTypedControllerRateLimiter[reconcile.Request], which combines
|
||||||
|
// an exponential backoff per-item limiter with a token bucket overall limiter
|
||||||
|
// (10 QPS, 100 bucket size). In large-scale environments with many runner
|
||||||
|
// scale sets, the token bucket limiter can become a bottleneck for
|
||||||
|
// reconciliation throughput.
|
||||||
|
//
|
||||||
|
// Use this option to override the default rate limiter, for example, to use
|
||||||
|
// workqueue.DefaultTypedItemBasedRateLimiter[reconcile.Request], which removes
|
||||||
|
// the overall token bucket constraint while keeping the per-item exponential
|
||||||
|
// backoff.
|
||||||
|
func WithTypedRateLimiter(rateLimiter workqueue.TypedRateLimiter[reconcile.Request]) Option {
|
||||||
|
return func(b *controller.Options) {
|
||||||
|
b.RateLimiter = rateLimiter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// builderWithOptions applies the given options to the provided builder, if any.
|
// builderWithOptions applies the given options to the provided builder, if any.
|
||||||
// This is a helper function to avoid the need to import the controller-runtime package in every reconciler source file
|
// This is a helper function to avoid the need to import the controller-runtime package in every reconciler source file
|
||||||
// and the command package that creates the controller.
|
// and the command package that creates the controller.
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||||
|
"k8s.io/client-go/util/workqueue"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/cache"
|
"sigs.k8s.io/controller-runtime/pkg/cache"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
|
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||||
// +kubebuilder:scaffold:imports
|
// +kubebuilder:scaffold:imports
|
||||||
)
|
)
|
||||||
@@ -110,6 +112,8 @@ func main() {
|
|||||||
|
|
||||||
k8sClientRateLimiterQPS int
|
k8sClientRateLimiterQPS int
|
||||||
k8sClientRateLimiterBurst int
|
k8sClientRateLimiterBurst int
|
||||||
|
|
||||||
|
workqueueRateLimiter string
|
||||||
)
|
)
|
||||||
var c github.Config
|
var c github.Config
|
||||||
err = envconfig.Process("github", &c)
|
err = envconfig.Process("github", &c)
|
||||||
@@ -155,6 +159,7 @@ func main() {
|
|||||||
flag.Var(&autoScalerImagePullSecrets, "auto-scaler-image-pull-secrets", "The default image-pull secret name for auto-scaler listener container.")
|
flag.Var(&autoScalerImagePullSecrets, "auto-scaler-image-pull-secrets", "The default image-pull secret name for auto-scaler listener container.")
|
||||||
flag.IntVar(&k8sClientRateLimiterQPS, "k8s-client-rate-limiter-qps", 20, "The QPS value of the K8s client rate limiter.")
|
flag.IntVar(&k8sClientRateLimiterQPS, "k8s-client-rate-limiter-qps", 20, "The QPS value of the K8s client rate limiter.")
|
||||||
flag.IntVar(&k8sClientRateLimiterBurst, "k8s-client-rate-limiter-burst", 30, "The burst value of the K8s client rate limiter.")
|
flag.IntVar(&k8sClientRateLimiterBurst, "k8s-client-rate-limiter-burst", 30, "The burst value of the K8s client rate limiter.")
|
||||||
|
flag.StringVar(&workqueueRateLimiter, "workqueue-rate-limiter", "", `The workqueue rate limiter to use. Valid values are "bucket_rate_limiter" (default) and "typed_rate_limiter" (per-item only, no global token bucket).`)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
runnerPodDefaults.RunnerImagePullSecrets = runnerImagePullSecrets
|
runnerPodDefaults.RunnerImagePullSecrets = runnerImagePullSecrets
|
||||||
@@ -293,6 +298,20 @@ func main() {
|
|||||||
|
|
||||||
log.Info("Resource builder initializing")
|
log.Info("Resource builder initializing")
|
||||||
|
|
||||||
|
var controllerOpts []actionsgithubcom.Option
|
||||||
|
switch workqueueRateLimiter {
|
||||||
|
case "typed_rate_limiter":
|
||||||
|
log.Info("Using typed rate limiter (per-item only, no global token bucket)")
|
||||||
|
controllerOpts = append(controllerOpts,
|
||||||
|
actionsgithubcom.WithTypedRateLimiter(workqueue.DefaultTypedItemBasedRateLimiter[reconcile.Request]()),
|
||||||
|
)
|
||||||
|
case "bucket_rate_limiter", "":
|
||||||
|
log.Info("Using default bucket rate limiter")
|
||||||
|
default:
|
||||||
|
log.Error(fmt.Errorf("unknown workqueue rate limiter: %s", workqueueRateLimiter), "invalid --workqueue-rate-limiter value")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if err = (&actionsgithubcom.AutoscalingRunnerSetReconciler{
|
if err = (&actionsgithubcom.AutoscalingRunnerSetReconciler{
|
||||||
Client: mgr.GetClient(),
|
Client: mgr.GetClient(),
|
||||||
Log: log.WithName("AutoscalingRunnerSet").WithValues("version", build.Version),
|
Log: log.WithName("AutoscalingRunnerSet").WithValues("version", build.Version),
|
||||||
@@ -302,17 +321,18 @@ func main() {
|
|||||||
UpdateStrategy: actionsgithubcom.UpdateStrategy(updateStrategy),
|
UpdateStrategy: actionsgithubcom.UpdateStrategy(updateStrategy),
|
||||||
DefaultRunnerScaleSetListenerImagePullSecrets: autoScalerImagePullSecrets,
|
DefaultRunnerScaleSetListenerImagePullSecrets: autoScalerImagePullSecrets,
|
||||||
ResourceBuilder: rb,
|
ResourceBuilder: rb,
|
||||||
}).SetupWithManager(mgr); err != nil {
|
}).SetupWithManager(mgr, controllerOpts...); err != nil {
|
||||||
log.Error(err, "unable to create controller", "controller", "AutoscalingRunnerSet")
|
log.Error(err, "unable to create controller", "controller", "AutoscalingRunnerSet")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runnerOpts := append(controllerOpts, actionsgithubcom.WithMaxConcurrentReconciles(opts.RunnerMaxConcurrentReconciles))
|
||||||
if err = (&actionsgithubcom.EphemeralRunnerReconciler{
|
if err = (&actionsgithubcom.EphemeralRunnerReconciler{
|
||||||
Client: mgr.GetClient(),
|
Client: mgr.GetClient(),
|
||||||
Log: log.WithName("EphemeralRunner").WithValues("version", build.Version),
|
Log: log.WithName("EphemeralRunner").WithValues("version", build.Version),
|
||||||
Scheme: mgr.GetScheme(),
|
Scheme: mgr.GetScheme(),
|
||||||
ResourceBuilder: rb,
|
ResourceBuilder: rb,
|
||||||
}).SetupWithManager(mgr, actionsgithubcom.WithMaxConcurrentReconciles(opts.RunnerMaxConcurrentReconciles)); err != nil {
|
}).SetupWithManager(mgr, runnerOpts...); err != nil {
|
||||||
log.Error(err, "unable to create controller", "controller", "EphemeralRunner")
|
log.Error(err, "unable to create controller", "controller", "EphemeralRunner")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@@ -323,7 +343,7 @@ func main() {
|
|||||||
Scheme: mgr.GetScheme(),
|
Scheme: mgr.GetScheme(),
|
||||||
PublishMetrics: metricsAddr != "0",
|
PublishMetrics: metricsAddr != "0",
|
||||||
ResourceBuilder: rb,
|
ResourceBuilder: rb,
|
||||||
}).SetupWithManager(mgr); err != nil {
|
}).SetupWithManager(mgr, controllerOpts...); err != nil {
|
||||||
log.Error(err, "unable to create controller", "controller", "EphemeralRunnerSet")
|
log.Error(err, "unable to create controller", "controller", "EphemeralRunnerSet")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@@ -335,7 +355,7 @@ func main() {
|
|||||||
ListenerMetricsAddr: listenerMetricsAddr,
|
ListenerMetricsAddr: listenerMetricsAddr,
|
||||||
ListenerMetricsEndpoint: listenerMetricsEndpoint,
|
ListenerMetricsEndpoint: listenerMetricsEndpoint,
|
||||||
ResourceBuilder: rb,
|
ResourceBuilder: rb,
|
||||||
}).SetupWithManager(mgr); err != nil {
|
}).SetupWithManager(mgr, controllerOpts...); err != nil {
|
||||||
log.Error(err, "unable to create controller", "controller", "AutoscalingListener")
|
log.Error(err, "unable to create controller", "controller", "AutoscalingListener")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ DIND_ROOTLESS_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind-rootless
|
|||||||
OS_IMAGE ?= ubuntu-22.04
|
OS_IMAGE ?= ubuntu-22.04
|
||||||
TARGETPLATFORM ?= $(shell arch)
|
TARGETPLATFORM ?= $(shell arch)
|
||||||
|
|
||||||
RUNNER_VERSION ?= 2.333.1
|
RUNNER_VERSION ?= 2.334.0
|
||||||
RUNNER_CONTAINER_HOOKS_VERSION ?= 0.8.1
|
RUNNER_CONTAINER_HOOKS_VERSION ?= 0.8.1
|
||||||
DOCKER_VERSION ?= 28.0.4
|
DOCKER_VERSION ?= 28.0.4
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
RUNNER_VERSION=2.333.1
|
RUNNER_VERSION=2.334.0
|
||||||
RUNNER_CONTAINER_HOOKS_VERSION=0.8.1
|
RUNNER_CONTAINER_HOOKS_VERSION=0.8.1
|
||||||
@@ -36,7 +36,7 @@ var (
|
|||||||
|
|
||||||
testResultCMNamePrefix = "test-result-"
|
testResultCMNamePrefix = "test-result-"
|
||||||
|
|
||||||
RunnerVersion = "2.333.1"
|
RunnerVersion = "2.334.0"
|
||||||
RunnerContainerHooksVersion = "0.8.1"
|
RunnerContainerHooksVersion = "0.8.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user