From 740543d5475eef0275d1e543d98f467dc5466b09 Mon Sep 17 00:00:00 2001 From: sophyc Date: Wed, 18 Oct 2023 11:17:13 +0200 Subject: [PATCH 1/5] Make it possible to reconcile periodically even when statuses match Update doc. --- README.md | 4 ++++ controllers/autoneg.go | 13 ++++------ controllers/controller_test.go | 10 ++++++++ controllers/service_controller.go | 40 +++++++++++++++++++++---------- controllers/suite_test.go | 22 ++++++++++++++--- controllers/types.go | 2 +- go.mod | 6 +++++ go.sum | 2 ++ main.go | 20 ++++++++++++++-- 9 files changed, 92 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 0af1936..d05e2e5 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,10 @@ The controller parameters can be customized via changing the [controller deploym to false. The template defaults to `{name}-{port}`. It can contain `namespace`, `name`, `port` and `hash` and the non-hash values will be truncated evenly if the full name is longer than 63 characters. `` is generated using full length `namespace`, `name` and `port` to avoid name collisions when truncated. +* `--max-rate-per-endpoint-default`: optional. Sets a default value for max-rate-per-endpoint that can be overriden by user config. Defaults to 0. +* `--max-connections-per-endpoint-default`: optional. Same as above but for connections. +* `--always-reconcile`: optional. Makes it possible to reconcile periodically even if the status annotatons don't change. Defaults to false. +* `--reconcile-period`: optional. Sets a reconciliation duration if always-reconcile mode is on. Defaults to 10 hours. ## IAM considerations diff --git a/controllers/autoneg.go b/controllers/autoneg.go index fc6aef1..520ca01 100644 --- a/controllers/autoneg.go +++ b/controllers/autoneg.go @@ -91,14 +91,14 @@ func (s AutonegStatus) Backend(name string, port string, group string) compute.B } // NewBackendController takes the project name and an initialized *compute.Service -func NewBackendController(project string, s *compute.Service) *BackendController { - return &BackendController{ +func NewBackendController(project string, s *compute.Service) *ProdBackendController { + return &ProdBackendController{ project: project, s: s, } } -func (b *BackendController) getBackendService(name string, region string) (svc *compute.BackendService, err error) { +func (b *ProdBackendController) getBackendService(name string, region string) (svc *compute.BackendService, err error) { if region == "" { svc, err = compute.NewBackendServicesService(b.s).Get(b.project, name).Do() if e, ok := err.(*googleapi.Error); ok { @@ -118,7 +118,7 @@ func (b *BackendController) getBackendService(name string, region string) (svc * } -func (b *BackendController) updateBackends(name string, region string, svc *compute.BackendService) error { +func (b *ProdBackendController) updateBackends(name string, region string, svc *compute.BackendService) error { if len(svc.Backends) == 0 { svc.NullFields = []string{"Backends"} } @@ -181,10 +181,7 @@ func checkOperation(op *compute.Operation) error { // ReconcileBackends takes the actual and intended AutonegStatus // and attempts to apply the intended status or return an error -func (b *BackendController) ReconcileBackends(actual, intended AutonegStatus) (err error) { - if b.s == nil { // test suite - return nil - } +func (b *ProdBackendController) ReconcileBackends(actual, intended AutonegStatus) (err error) { removes, upserts := ReconcileStatus(b.project, actual, intended) for port, _removes := range removes { diff --git a/controllers/controller_test.go b/controllers/controller_test.go index 9a13d7d..98791ae 100644 --- a/controllers/controller_test.go +++ b/controllers/controller_test.go @@ -77,6 +77,16 @@ var _ = Describe("Run autoneg Controller", func() { Expect(updatedAnnos[negStatusAnnotation]).To(BeEmpty()) }) + Context("Reconciles periodically", func() { + + It("should reconcile", func() { + timesReconciled := backendController.Counter + time.Sleep(2 * time.Second) + Expect(backendController.Counter-timesReconciled > 0).To(BeTrue(), "should have at least reconciled once.") + }) + + }) + Context("Remove the service", func() { It("should succeed", func() { diff --git a/controllers/service_controller.go b/controllers/service_controller.go index 8ffd955..99729cc 100644 --- a/controllers/service_controller.go +++ b/controllers/service_controller.go @@ -21,6 +21,7 @@ import ( "encoding/json" "errors" "reflect" + "time" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -32,16 +33,22 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) +type BackendController interface { + ReconcileBackends(AutonegStatus, AutonegStatus) error +} + // ServiceReconciler reconciles a Service object type ServiceReconciler struct { client.Client Scheme *runtime.Scheme - *BackendController + BackendController Recorder record.EventRecorder ServiceNameTemplate string AllowServiceName bool MaxRatePerEndpointDefault float64 MaxConnectionsPerEndpointDefault float64 + AlwaysReconcile bool + ReconcileDuration *time.Duration } //+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;update;patch @@ -66,21 +73,21 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct if err != nil { if apierrors.IsNotFound(err) { // Object not found, return. - return reconcile.Result{}, nil + return r.reconcileResult(nil) } // Error reading the object - requeue the request. - return reconcile.Result{}, err + return r.reconcileResult(err) } status, ok, err := getStatuses(svc.Namespace, svc.Name, svc.ObjectMeta.Annotations, r) // Is this service using autoneg? if !ok { - return reconcile.Result{}, nil + return r.reconcileResult(nil) } if err != nil { r.Recorder.Event(svc, "Warning", "ConfigError", err.Error()) - return reconcile.Result{}, err + return r.reconcileResult(err) } deleting := false @@ -102,9 +109,9 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct if deleting { intendedStatus.BackendServices = make(map[string]map[string]AutonegNEGConfig, 0) - } else if reflect.DeepEqual(status.status, intendedStatus) { + } else if reflect.DeepEqual(status.status, intendedStatus) && !r.AlwaysReconcile { // Equal, no reconciliation necessary - return reconcile.Result{}, nil + return r.reconcileResult(nil) } // Reconcile differences @@ -114,11 +121,11 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct var e *errNotFound if !(deleting && errors.As(err, &e)) { r.Recorder.Event(svc, "Warning", "BackendError", err.Error()) - return reconcile.Result{}, err + return r.reconcileResult(err) } if deleting { r.Recorder.Event(svc, "Warning", "BackendError while deleting", err.Error()) - return reconcile.Result{}, err + return r.reconcileResult(err) } } @@ -147,7 +154,7 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct anStatus, err := json.Marshal(intendedStatus) if err != nil { logger.Error(err, "json marshal error") - return reconcile.Result{}, err + return r.reconcileResult(err) } svc.ObjectMeta.Annotations[autonegStatusAnnotation] = string(anStatus) @@ -156,7 +163,7 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct if err != nil { logger.Error(err, "json marshal error") - return reconcile.Result{}, err + return r.reconcileResult(err) } svc.ObjectMeta.Annotations[oldAutonegStatusAnnotation] = string(oldStatus) @@ -168,7 +175,7 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct if !apierrors.IsConflict(err) { r.Recorder.Event(svc, "Warning", "BackendError", err.Error()) } - return reconcile.Result{}, err + return r.reconcileResult(err) } for port, endpointGroups := range intendedStatus.BackendServices { @@ -190,7 +197,7 @@ func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct } } - return reconcile.Result{}, nil + return r.reconcileResult(nil) } // SetupWithManager sets up the controller with the Manager. @@ -219,3 +226,10 @@ func removeString(slice []string, s string) (result []string) { } return } + +func (r *ServiceReconciler) reconcileResult(err error) (reconcile.Result, error) { + if r.ReconcileDuration != nil && r.AlwaysReconcile { + return reconcile.Result{RequeueAfter: *r.ReconcileDuration}, err + } + return reconcile.Result{}, err +} diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 0762b62..58b249c 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -18,14 +18,15 @@ package controllers import ( "context" + "fmt" "path/filepath" "testing" + "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" @@ -37,11 +38,11 @@ import ( // These tests use Ginkgo (BDD-style Go testing framework). Refer to // http://onsi.github.io/ginkgo/ to learn more about Ginkgo. -var cfg *rest.Config var k8sClient client.Client var k8sManager ctrl.Manager var testEnv *envtest.Environment var cancel context.CancelFunc +var backendController *TestBackendController func TestAPIs(t *testing.T) { RegisterFailHandler(Fail) @@ -79,12 +80,17 @@ var _ = BeforeSuite(func() { }) Expect(err).ToNot(HaveOccurred()) + backendController = &TestBackendController{Counter: 0} + duration := 1 * time.Second + err = (&ServiceReconciler{ Client: k8sManager.GetClient(), - BackendController: &BackendController{}, + BackendController: backendController, Recorder: k8sManager.GetEventRecorderFor("autoneg-controller"), ServiceNameTemplate: serviceNameTemplate, AllowServiceName: true, + AlwaysReconcile: true, + ReconcileDuration: &duration, }).SetupWithManager(k8sManager) Expect(err).ToNot(HaveOccurred()) @@ -95,6 +101,16 @@ var _ = BeforeSuite(func() { }() }, 60) +type TestBackendController struct { + Counter int +} + +func (t *TestBackendController) ReconcileBackends(AutonegStatus, AutonegStatus) error { + t.Counter++ + fmt.Print(t.Counter) + return nil +} + var _ = AfterSuite(func() { cancel() By("tearing down the test environment") diff --git a/controllers/types.go b/controllers/types.go index 82dc105..4b2fbc7 100644 --- a/controllers/types.go +++ b/controllers/types.go @@ -85,7 +85,7 @@ type Backends struct { } // BackendController manages operations on a GCLB backend service -type BackendController struct { +type ProdBackendController struct { project string s *compute.Service } diff --git a/go.mod b/go.mod index e004a77..da977e6 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,11 @@ require ( sigs.k8s.io/controller-runtime v0.15.1 ) +require ( + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect +) + require ( cloud.google.com/go/compute v1.23.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -53,6 +58,7 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect diff --git a/go.sum b/go.sum index f5b6798..4f1e35e 100644 --- a/go.sum +++ b/go.sum @@ -166,6 +166,7 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -174,6 +175,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= diff --git a/main.go b/main.go index 8725fdb..857440b 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,7 @@ import ( "flag" "fmt" "os" + "time" // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. @@ -61,10 +62,12 @@ func main() { var enableLeaderElection bool var serviceNameTemplate string var allowServiceName bool + var alwaysReconcile bool + var reconcilePeriod string flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint", 0, "The address the probe endpoint binds to.") - flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint", 0, "The address the probe endpoint binds to.") + flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint-default", 0, "Default max rate per endpoint. Can be overriden by user config.") + flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint-default", 0, "Default max connections per endpoint. Can be overriden by user config.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") @@ -72,6 +75,8 @@ func main() { "A naming template consists of {namespace}, {name}, {port} or {hash} separated by hyphens, "+ "where {hash} is the first 8 digits of a hash of other given information") flag.BoolVar(&allowServiceName, "enable-custom-service-names", true, "Enable using custom service names in autoneg annotation.") + flag.BoolVar(&alwaysReconcile, "always-reconcile", false, "Periodically reconciles even if annotation statuses don't change.") + flag.StringVar(&reconcilePeriod, "reconcile-period", "", "The minimum frequency at which watched resources are reconciled, e.g. 10m. Defaults to 10h if not set.") opts := zap.Options{ Development: true, } @@ -95,6 +100,15 @@ func main() { os.Exit(1) } + var reconcileDuration time.Duration + if reconcilePeriod != "" { + reconcileDuration, err = time.ParseDuration(reconcilePeriod) + if err != nil { + setupLog.Error(err, "Invalid reconcilePeriod") + os.Exit(1) + } + } + if !controllers.IsValidServiceNameTemplate(serviceNameTemplate) { err = fmt.Errorf("invalid service name template %s", serviceNameTemplate) setupLog.Error(err, "invalid service name template") @@ -123,6 +137,8 @@ func main() { AllowServiceName: allowServiceName, MaxRatePerEndpointDefault: maxRatePerEndpointDefault, MaxConnectionsPerEndpointDefault: maxConnectionsPerEndpointDefault, + AlwaysReconcile: alwaysReconcile, + ReconcileDuration: &reconcileDuration, }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "Service") os.Exit(1) From 91cce763aca419ade959c7b04038106cf23add43 Mon Sep 17 00:00:00 2001 From: sophyc Date: Mon, 23 Oct 2023 14:43:13 +0200 Subject: [PATCH 2/5] Change flag name back to make it backwards compatible --- README.md | 4 ++-- main.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d05e2e5..cf35d14 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ The controller parameters can be customized via changing the [controller deploym to false. The template defaults to `{name}-{port}`. It can contain `namespace`, `name`, `port` and `hash` and the non-hash values will be truncated evenly if the full name is longer than 63 characters. `` is generated using full length `namespace`, `name` and `port` to avoid name collisions when truncated. -* `--max-rate-per-endpoint-default`: optional. Sets a default value for max-rate-per-endpoint that can be overriden by user config. Defaults to 0. -* `--max-connections-per-endpoint-default`: optional. Same as above but for connections. +* `--max-rate-per-endpoint`: optional. Sets a default value for max-rate-per-endpoint that can be overriden by user config. Defaults to 0. +* `--max-connections-per-endpoint`: optional. Same as above but for connections. * `--always-reconcile`: optional. Makes it possible to reconcile periodically even if the status annotatons don't change. Defaults to false. * `--reconcile-period`: optional. Sets a reconciliation duration if always-reconcile mode is on. Defaults to 10 hours. diff --git a/main.go b/main.go index 857440b..0610299 100644 --- a/main.go +++ b/main.go @@ -66,8 +66,8 @@ func main() { var reconcilePeriod string flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint-default", 0, "Default max rate per endpoint. Can be overriden by user config.") - flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint-default", 0, "Default max connections per endpoint. Can be overriden by user config.") + flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint", 0, "Default max rate per endpoint. Can be overriden by user config.") + flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint", 0, "Default max connections per endpoint. Can be overriden by user config.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") From a8bc6dd63f39fde98aa9633ee52525772aadb052 Mon Sep 17 00:00:00 2001 From: sophyc Date: Mon, 23 Oct 2023 14:45:44 +0200 Subject: [PATCH 3/5] Removed extra dependencies --- go.mod | 6 ------ go.sum | 2 -- 2 files changed, 8 deletions(-) diff --git a/go.mod b/go.mod index da977e6..e004a77 100644 --- a/go.mod +++ b/go.mod @@ -15,11 +15,6 @@ require ( sigs.k8s.io/controller-runtime v0.15.1 ) -require ( - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect -) - require ( cloud.google.com/go/compute v1.23.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -58,7 +53,6 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect diff --git a/go.sum b/go.sum index 4f1e35e..f5b6798 100644 --- a/go.sum +++ b/go.sum @@ -166,7 +166,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -175,7 +174,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= From 69a1ac109889b9c9e4d0072c1a42b8c4e4f13cb3 Mon Sep 17 00:00:00 2001 From: Sophy Cao Date: Tue, 24 Oct 2023 11:50:40 +0200 Subject: [PATCH 4/5] Fix typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf35d14..818b592 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ The controller parameters can be customized via changing the [controller deploym to false. The template defaults to `{name}-{port}`. It can contain `namespace`, `name`, `port` and `hash` and the non-hash values will be truncated evenly if the full name is longer than 63 characters. `` is generated using full length `namespace`, `name` and `port` to avoid name collisions when truncated. -* `--max-rate-per-endpoint`: optional. Sets a default value for max-rate-per-endpoint that can be overriden by user config. Defaults to 0. +* `--max-rate-per-endpoint`: optional. Sets a default value for max-rate-per-endpoint that can be overridden by user config. Defaults to 0. * `--max-connections-per-endpoint`: optional. Same as above but for connections. -* `--always-reconcile`: optional. Makes it possible to reconcile periodically even if the status annotatons don't change. Defaults to false. +* `--always-reconcile`: optional. Makes it possible to reconcile periodically even if the status annotations don't change. Defaults to false. * `--reconcile-period`: optional. Sets a reconciliation duration if always-reconcile mode is on. Defaults to 10 hours. ## IAM considerations From 4f1dff775975b3562acceb1278d4ce2e5642a06f Mon Sep 17 00:00:00 2001 From: Sophy Cao Date: Tue, 24 Oct 2023 11:58:55 +0200 Subject: [PATCH 5/5] Fix typos --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0610299..2f9453a 100644 --- a/main.go +++ b/main.go @@ -66,8 +66,8 @@ func main() { var reconcilePeriod string flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint", 0, "Default max rate per endpoint. Can be overriden by user config.") - flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint", 0, "Default max connections per endpoint. Can be overriden by user config.") + flag.Float64Var(&maxRatePerEndpointDefault, "max-rate-per-endpoint", 0, "Default max rate per endpoint. Can be overridden by user config.") + flag.Float64Var(&maxConnectionsPerEndpointDefault, "max-connections-per-endpoint", 0, "Default max connections per endpoint. Can be overridden by user config.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.")