Skip to content

Commit

Permalink
Merge pull request #666 from OpenLiberty/lcj-updates-141
Browse files Browse the repository at this point in the history
Update sample app and remove watch on HPA
  • Loading branch information
leochr authored Dec 13, 2024
2 parents cc1de79 + 39061cd commit 7a21815
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 41 deletions.
10 changes: 5 additions & 5 deletions bundle/manifests/open-liberty.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
68 changes: 37 additions & 31 deletions internal/controller/openlibertyapplication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion internal/deploy/kubectl/openliberty-app-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a21815

Please sign in to comment.