From d6d1ab97f4531dab5fe2ffe88b6d5ac0d0cd7d39 Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Fri, 13 Dec 2024 15:55:07 -0500 Subject: [PATCH 1/2] Update getting-started sample image references Signed-off-by: Leo Christy Jesuraj --- .../manifests/open-liberty.clusterserviceversion.yaml | 10 +++++----- config/manager/manager.yaml | 2 +- ...apps.openliberty.io_v1_openlibertyapplications.yaml | 2 +- ...openliberty.io_v1beta2_openlibertyapplications.yaml | 2 +- internal/deploy/kubectl/openliberty-app-operator.yaml | 2 +- .../kustomize/daily/base/open-liberty-operator.yaml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bundle/manifests/open-liberty.clusterserviceversion.yaml b/bundle/manifests/open-liberty.clusterserviceversion.yaml index 9669ee57..aaa08597 100644 --- a/bundle/manifests/open-liberty.clusterserviceversion.yaml +++ b/bundle/manifests/open-liberty.clusterserviceversion.yaml @@ -11,7 +11,7 @@ metadata: "name": "openliberty-app-sample" }, "spec": { - "applicationImage": "icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650", + "applicationImage": "icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07", "expose": true, "manageTLS": true, "replicas": 1, @@ -53,7 +53,7 @@ metadata: "name": "openliberty-app-sample" }, "spec": { - "applicationImage": "icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650", + "applicationImage": "icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07", "expose": true, "replicas": 1, "service": { @@ -92,7 +92,7 @@ metadata: categories: Application Runtime certified: "true" containerImage: icr.io/appcafe/open-liberty-operator:daily - createdAt: "2024-11-18T15:15:59Z" + createdAt: "2024-12-13T20:47:41Z" description: Deploy and manage containerized Liberty applications features.operators.openshift.io/disconnected: "true" features.operators.openshift.io/fips-compliant: "true" @@ -1151,7 +1151,7 @@ spec: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - name: RELATED_IMAGE_LIBERTY_SAMPLE_APP - value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 - name: RELATED_IMAGE_OPEN_LIBERTY_OPERATOR value: icr.io/appcafe/open-liberty-operator:daily image: icr.io/appcafe/open-liberty-operator:daily @@ -1458,7 +1458,7 @@ spec: provider: name: IBM relatedImages: - - image: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + - image: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 name: liberty-sample-app - image: icr.io/appcafe/open-liberty-operator:daily name: open-liberty-operator diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 4b2256e9..d7c8e8b9 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -70,7 +70,7 @@ spec: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - name: RELATED_IMAGE_LIBERTY_SAMPLE_APP - value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 - name: RELATED_IMAGE_OPEN_LIBERTY_OPERATOR value: OPERATOR_IMAGE securityContext: diff --git a/config/samples/apps.openliberty.io_v1_openlibertyapplications.yaml b/config/samples/apps.openliberty.io_v1_openlibertyapplications.yaml index 36831c98..67003e80 100644 --- a/config/samples/apps.openliberty.io_v1_openlibertyapplications.yaml +++ b/config/samples/apps.openliberty.io_v1_openlibertyapplications.yaml @@ -3,7 +3,7 @@ kind: OpenLibertyApplication metadata: name: openliberty-app-sample spec: - applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 expose: true manageTLS: true replicas: 1 diff --git a/config/samples/apps.openliberty.io_v1beta2_openlibertyapplications.yaml b/config/samples/apps.openliberty.io_v1beta2_openlibertyapplications.yaml index c1fde3c3..0235f667 100644 --- a/config/samples/apps.openliberty.io_v1beta2_openlibertyapplications.yaml +++ b/config/samples/apps.openliberty.io_v1beta2_openlibertyapplications.yaml @@ -4,7 +4,7 @@ metadata: name: openliberty-app-sample spec: # Add fields here - applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + applicationImage: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 expose: true replicas: 1 service: diff --git a/internal/deploy/kubectl/openliberty-app-operator.yaml b/internal/deploy/kubectl/openliberty-app-operator.yaml index 13a6425d..afaf4173 100644 --- a/internal/deploy/kubectl/openliberty-app-operator.yaml +++ b/internal/deploy/kubectl/openliberty-app-operator.yaml @@ -322,7 +322,7 @@ spec: - name: WATCH_NAMESPACE value: OPEN_LIBERTY_WATCH_NAMESPACE - name: RELATED_IMAGE_LIBERTY_SAMPLE_APP - value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 - name: RELATED_IMAGE_OPEN_LIBERTY_OPERATOR value: icr.io/appcafe/open-liberty-operator:daily image: icr.io/appcafe/open-liberty-operator:daily diff --git a/internal/deploy/kustomize/daily/base/open-liberty-operator.yaml b/internal/deploy/kustomize/daily/base/open-liberty-operator.yaml index 9b835ba5..c6eb9ce9 100644 --- a/internal/deploy/kustomize/daily/base/open-liberty-operator.yaml +++ b/internal/deploy/kustomize/daily/base/open-liberty-operator.yaml @@ -50,7 +50,7 @@ spec: fieldRef: fieldPath: metadata.namespace - name: RELATED_IMAGE_LIBERTY_SAMPLE_APP - value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:3999aa86f788e601d305896e48a043a91861cdbf71951a1959887151390b3650 + value: icr.io/appcafe/open-liberty/samples/getting-started@sha256:1ac4699f934128ed62da43b3720120d469e930458355152e547a574bb7b70c07 - name: RELATED_IMAGE_OPEN_LIBERTY_OPERATOR value: icr.io/appcafe/open-liberty-operator:daily image: icr.io/appcafe/open-liberty-operator:daily From 39061cd8f9fa2e8db0c5c2c1a4ee0c1d9c8f192f Mon Sep 17 00:00:00 2001 From: Leo Christy Jesuraj Date: Fri, 13 Dec 2024 16:04:33 -0500 Subject: [PATCH 2/2] Remove HorizontalPodAutoscaler from owned and watched resources Signed-off-by: Leo Christy Jesuraj --- .../openlibertyapplication_controller.go | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/internal/controller/openlibertyapplication_controller.go b/internal/controller/openlibertyapplication_controller.go index 1515f7eb..998089c7 100644 --- a/internal/controller/openlibertyapplication_controller.go +++ b/internal/controller/openlibertyapplication_controller.go @@ -908,37 +908,43 @@ func (r *ReconcileOpenLiberty) SetupWithManager(mgr ctrl.Manager) error { }, } - b := ctrl.NewControllerManagedBy(mgr).For(&openlibertyv1.OpenLibertyApplication{}, 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(&openlibertyv1.OpenLibertyApplication{}, 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()