Skip to content

Commit

Permalink
Merge pull request #714 from WASdev/lcj-update-RCO
Browse files Browse the repository at this point in the history
Remove HorizontalPodAutoscaler from owned and watched resources + update RCO module
  • Loading branch information
leochr authored Dec 8, 2024
2 parents 53c92bc + c77d4f4 commit a5ac092
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
70 changes: 38 additions & 32 deletions internal/controller/webspherelibertyapplication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit a5ac092

Please sign in to comment.