From 65b4c238acd0467aa2d30182943ed517cf748649 Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Sun, 8 Dec 2024 15:47:31 -0500 Subject: [PATCH 1/3] Update RCO module to latest to include 5 seconds min reconcile interval Signed-off-by: Leo Christy Jesuraj --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8bbb5326..37673a1f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20241122163644-be3e5df8ce61 - github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241125214817-041cee0513b1 + github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241208202953-762c4a3794da github.com/cert-manager/cert-manager v1.13.6 github.com/go-logr/logr v1.3.0 github.com/openshift/api v0.0.0-20230928134114-673ed0cfc7f1 diff --git a/go.sum b/go.sum index 089f0b80..673502ad 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxa contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20241122163644-be3e5df8ce61 h1:opulRJMtFd8ZoZ/bFuuZTH1bYHsoJcMraHavyA3ik34= github.com/OpenLiberty/open-liberty-operator v0.8.1-0.20241122163644-be3e5df8ce61/go.mod h1:zivpLdSHMQGhKzdOo0vZkQx3YNgA57ASEQu9Eqzal2Q= -github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241125214817-041cee0513b1 h1:FtP4qRQLrOjbYaO16/EtXLhJSJmeDiQbvlzss3V/n/0= -github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241125214817-041cee0513b1/go.mod h1:Q//a3yubxjR3+COorasymYRuuiDPs0Usgl9YuADkD6U= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241208202953-762c4a3794da h1:mqb4fHq32QvmU1NSn56cMv6PHKhX6DqJyAUf7cNEioI= +github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241208202953-762c4a3794da/go.mod h1:E/Y5paF2HFgzCDo6ISV4EXN4s7UMWpw/6HzNzGa9jSw= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= From 369f54c80bb525a3ca70ba7753d97e4096f745fb Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Sun, 8 Dec 2024 15:47:54 -0500 Subject: [PATCH 2/3] Rename reconcileIntervalSeconds to reconcileIntervalMinimum Signed-off-by: Leo Christy Jesuraj --- internal/controller/webspherelibertyapplication_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/controller/webspherelibertyapplication_controller.go b/internal/controller/webspherelibertyapplication_controller.go index 2a30f537..2e38e9f5 100644 --- a/internal/controller/webspherelibertyapplication_controller.go +++ b/internal/controller/webspherelibertyapplication_controller.go @@ -132,7 +132,7 @@ func (r *ReconcileWebSphereLiberty) Reconcile(ctx context.Context, request ctrl. return reconcile.Result{}, err } - if err = common.CheckValidValue(common.Config, common.OpConfigReconcileIntervalSeconds, OperatorName); err != nil { + if err = common.CheckValidValue(common.Config, common.OpConfigReconcileIntervalMinimum, OperatorName); err != nil { return r.ManageError(err, common.StatusConditionTypeReconciled, instance) } From c77d4f4360bb19a8ff61372c884acf393a6a856d Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Sun, 8 Dec 2024 15:54:45 -0500 Subject: [PATCH 3/3] Remove HorizontalPodAutoscaler from owned and watched resources Signed-off-by: Leo Christy Jesuraj --- .../webspherelibertyapplication_controller.go | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/internal/controller/webspherelibertyapplication_controller.go b/internal/controller/webspherelibertyapplication_controller.go index 2e38e9f5..ed50797c 100644 --- a/internal/controller/webspherelibertyapplication_controller.go +++ b/internal/controller/webspherelibertyapplication_controller.go @@ -926,37 +926,43 @@ func (r *ReconcileWebSphereLiberty) SetupWithManager(mgr ctrl.Manager) error { }, } - b := ctrl.NewControllerManagedBy(mgr).For(&webspherelibertyv1.WebSphereLibertyApplication{}, builder.WithPredicates(pred)). - Owns(&corev1.Service{}, builder.WithPredicates(predSubResource)). - Owns(&corev1.Secret{}, builder.WithPredicates(predSubResource)). - Owns(&appsv1.Deployment{}, builder.WithPredicates(predSubResWithGenCheck)). - Owns(&appsv1.StatefulSet{}, builder.WithPredicates(predSubResWithGenCheck)). - Owns(&autoscalingv1.HorizontalPodAutoscaler{}, builder.WithPredicates(predSubResource)) - - ok, _ := r.IsGroupVersionSupported(routev1.SchemeGroupVersion.String(), "Route") - if ok { - b = b.Owns(&routev1.Route{}, builder.WithPredicates(predSubResource)) - } - ok, _ = r.IsGroupVersionSupported(networkingv1.SchemeGroupVersion.String(), "Ingress") - if ok { - b = b.Owns(&networkingv1.Ingress{}, builder.WithPredicates(predSubResource)) - } - ok, _ = r.IsGroupVersionSupported(servingv1.SchemeGroupVersion.String(), "Service") - if ok { - b = b.Owns(&servingv1.Service{}, builder.WithPredicates(predSubResource)) - } - ok, _ = r.IsGroupVersionSupported(prometheusv1.SchemeGroupVersion.String(), "ServiceMonitor") - if ok { - b = b.Owns(&prometheusv1.ServiceMonitor{}, builder.WithPredicates(predSubResource)) - } - ok, _ = r.IsGroupVersionSupported(imagev1.SchemeGroupVersion.String(), "ImageStream") - if ok { - b = b.Watches(&imagev1.ImageStream{}, &EnqueueRequestsForCustomIndexField{ - Matcher: &ImageStreamMatcher{ - Klient: mgr.GetClient(), - WatchNamespaces: watchNamespaces, - }, - }) + b := ctrl.NewControllerManagedBy(mgr).For(&webspherelibertyv1.WebSphereLibertyApplication{}, builder.WithPredicates(pred)) + + if !oputils.GetOperatorDisableWatches() { + b = b.Owns(&corev1.Service{}, builder.WithPredicates(predSubResource)). + Owns(&corev1.Secret{}, builder.WithPredicates(predSubResource)). + Owns(&appsv1.Deployment{}, builder.WithPredicates(predSubResWithGenCheck)). + Owns(&appsv1.StatefulSet{}, builder.WithPredicates(predSubResWithGenCheck)) + + if oputils.GetOperatorWatchHPA() { + b = b.Owns(&autoscalingv1.HorizontalPodAutoscaler{}, builder.WithPredicates(predSubResource)) + } + + ok, _ := r.IsGroupVersionSupported(routev1.SchemeGroupVersion.String(), "Route") + if ok { + b = b.Owns(&routev1.Route{}, builder.WithPredicates(predSubResource)) + } + ok, _ = r.IsGroupVersionSupported(networkingv1.SchemeGroupVersion.String(), "Ingress") + if ok { + b = b.Owns(&networkingv1.Ingress{}, builder.WithPredicates(predSubResource)) + } + ok, _ = r.IsGroupVersionSupported(servingv1.SchemeGroupVersion.String(), "Service") + if ok { + b = b.Owns(&servingv1.Service{}, builder.WithPredicates(predSubResource)) + } + ok, _ = r.IsGroupVersionSupported(prometheusv1.SchemeGroupVersion.String(), "ServiceMonitor") + if ok { + b = b.Owns(&prometheusv1.ServiceMonitor{}, builder.WithPredicates(predSubResource)) + } + ok, _ = r.IsGroupVersionSupported(imagev1.SchemeGroupVersion.String(), "ImageStream") + if ok { + b = b.Watches(&imagev1.ImageStream{}, &EnqueueRequestsForCustomIndexField{ + Matcher: &ImageStreamMatcher{ + Klient: mgr.GetClient(), + WatchNamespaces: watchNamespaces, + }, + }) + } } maxConcurrentReconciles := oputils.GetMaxConcurrentReconciles()