Skip to content

Commit 745fd1f

Browse files
authored
[release-1.37] Update operator lib to cherry-pick install fix (#3890)
* [release-1.37] Update operator lib to cherry-pick install fix * Fix git patches
1 parent 64d32eb commit 745fd1f

File tree

9 files changed

+56
-48
lines changed

9 files changed

+56
-48
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
knative.dev/eventing-kafka-broker v0.37.0
3030
knative.dev/hack v0.0.0-20250220110655-b5e4ff820460
3131
knative.dev/networking v0.0.0-20250117155906-67d1c274ba6a
32-
knative.dev/operator v0.44.8
32+
knative.dev/operator v0.44.9-0.20251030190238-fb0238a50768
3333
knative.dev/pkg v0.0.0-20250306143800-fff4f701c7af
3434
knative.dev/serving v0.44.1
3535
sigs.k8s.io/controller-runtime v0.19.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,8 +3444,8 @@ knative.dev/hack v0.0.0-20250116150306-c142b4835bc5 h1:CwLVoSblWmfaIkgRFX2LcEA0u
34443444
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
34453445
knative.dev/networking v0.0.0-20250117155906-67d1c274ba6a h1:FaDPXtv42+AkYh/mE269pttPSZ3fDVAjJiEsYUaM4SM=
34463446
knative.dev/networking v0.0.0-20250117155906-67d1c274ba6a/go.mod h1:AIKYMfZydhwXR/60c/3KXEnqEnH6aNEEqulifdqJVcQ=
3447-
knative.dev/operator v0.44.8 h1:crr34vl58PR9VPz/8J6Xwg1IkrDzek/JsZb37GmP8+c=
3448-
knative.dev/operator v0.44.8/go.mod h1:vlru9rspHgmuE3EANBU1QBTjkSEsN6tTJRhyMKYiZOk=
3447+
knative.dev/operator v0.44.9-0.20251030190238-fb0238a50768 h1:u3u8Jb8i2HKZ+PIZSewD9/IbuzpIECrIj0VA0PFgTBY=
3448+
knative.dev/operator v0.44.9-0.20251030190238-fb0238a50768/go.mod h1:vlru9rspHgmuE3EANBU1QBTjkSEsN6tTJRhyMKYiZOk=
34493449
knative.dev/pkg v0.0.0-20250117084104-c43477f0052b h1:a+gP7Yzu5NmoX2w1p8nfTgmSKF+aHLKGzqYT82ijJTw=
34503450
knative.dev/pkg v0.0.0-20250117084104-c43477f0052b/go.mod h1:bedSpkdLybR6JhL1J7XDLpd+JMKM/x8M5Apr80i5TeE=
34513451
knative.dev/reconciler-test v0.0.0-20250117161605-4965c77b4dfa h1:fSSS05Rggq+XdsTIRb4goERGVuvKoC5OzOGkw6EXwz0=

hack/patches/020-backstage_plugins_eventmesh_backend.patch

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,3 @@ index 000000000..e23d375d6
8383
+
8484
+ return f.IsEnabled(backstageBackendFeatureFlag)
8585
+}
86-
diff --git a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
87-
index b85ec89e4..59bd74dd1 100644
88-
--- a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
89-
+++ b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
90-
@@ -140,6 +140,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ke *v1beta1.KnativeEvent
91-
},
92-
r.transform,
93-
r.handleTLSResources,
94-
+ r.handleBackstageResources,
95-
manifests.Install,
96-
common.CheckDeployments,
97-
common.InstallWebhookConfigs,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
2+
index 1985d7268..f0d86d1f7 100644
3+
--- a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
4+
+++ b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
5+
@@ -139,6 +139,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ke *v1beta1.KnativeEvent
6+
return nil
7+
},
8+
r.transform,
9+
+ r.handleBackstageResources,
10+
r.handleTLSResources,
11+
manifests.Install,
12+
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths
Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
diff --git a/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go b/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
2-
index 4b8eca0b0..ccf9f2f67 100644
2+
index 77f091a68..bed9f89c4 100644
33
--- a/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
44
+++ b/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
5-
@@ -19,14 +19,15 @@ package knativeserving
5+
@@ -19,14 +19,16 @@ package knativeserving
66
import (
77
"context"
88
"fmt"
9-
+ "os"
10-
9+
+ "os"
10+
1111
- mf "github.com/manifestival/manifestival"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"k8s.io/client-go/kubernetes"
14-
14+
1515
"knative.dev/pkg/logging"
1616
pkgreconciler "knative.dev/pkg/reconciler"
17-
-
17+
1818
+ mf "github.com/manifestival/manifestival"
1919
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2020
"knative.dev/operator/pkg/apis/operator/base"
2121
"knative.dev/operator/pkg/apis/operator/v1beta1"
2222
clientset "knative.dev/operator/pkg/client/clientset/versioned"
23-
@@ -90,6 +91,12 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
24-
if manifest == nil {
23+
@@ -91,6 +93,12 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
24+
logger.Warnf("No manifest found; no cluster-scoped resources will be finalized")
2525
return nil
2626
}
2727
+ // we need this to apply the correct namespace to the resources otherwise it defaults to knative-serving
@@ -30,31 +30,31 @@ index 4b8eca0b0..ccf9f2f67 100644
3030
+ logger.Error("Unable to apply kourier namespace transform", err)
3131
+ return nil
3232
+ }
33-
33+
3434
if err := common.Uninstall(manifest); err != nil {
3535
logger.Error("Failed to finalize platform resources", err)
36-
@@ -97,6 +104,20 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
36+
@@ -98,6 +106,20 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
3737
return nil
3838
}
39-
39+
4040
+func overrideKourierNamespace(ks base.KComponent) mf.Transformer {
4141
+ if ns, required := os.LookupEnv("REQUIRED_SERVING_INGRESS_NAMESPACE"); required {
4242
+ nsInjector := mf.InjectNamespace(ns)
43-
+ return func(u *unstructured.Unstructured) error {
44-
+ provider := u.GetLabels()["networking.knative.dev/ingress-provider"]
45-
+ if provider != "kourier" {
46-
+ return nil
43+
+ return func(u *unstructured.Unstructured) error {
44+
+ provider := u.GetLabels()["networking.knative.dev/ingress-provider"]
45+
+ if provider != "kourier" {
46+
+ return nil
47+
+ }
48+
+ return nsInjector(u)
4749
+ }
48-
+ return nsInjector(u)
49-
+ }
5050
+ }
5151
+ return nil
5252
+}
5353
+
5454
// ReconcileKind compares the actual state with the desired, and attempts to
5555
// converge the two.
5656
func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServing) pkgreconciler.Event {
57-
@@ -117,6 +138,10 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServi
57+
@@ -118,6 +140,10 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServi
5858
security.AppendTargetSecurity,
5959
common.AppendAdditionalManifests,
6060
r.appendExtensionManifests,
@@ -64,5 +64,4 @@ index 4b8eca0b0..ccf9f2f67 100644
6464
+ },
6565
r.transform,
6666
manifests.Install,
67-
common.CheckDeployments,
68-
67+
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths

vendor/knative.dev/operator/pkg/reconciler/common/install.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen
5555
status.MarkInstallFailed(err.Error())
5656
return fmt.Errorf("failed to apply (cluster)rolebindings: %w", err)
5757
}
58+
// Webhook configs are placeholder to be reconciled and configured by webhook controllers, not fully operational yet.
59+
// They are owned by SYSTEM_NAMESPACE and reconciled once webhook deployment is started.
60+
// In some cases a webhook config might be left on the cluster from previous uncompleted install/reinstall attempts.
61+
// Such pre-existing webhook config can block creation of ConfigMap and other resource that are validated, resulting
62+
// in a deadlock installation loop. For this reasons
63+
if err := InstallWebhookConfigs(ctx, manifest, instance); err != nil {
64+
return err
65+
}
5866
if err := manifest.Filter(mf.Not(mf.Any(role, rolebinding, webhook, webhookDependentResources))).Apply(); err != nil {
5967
status.MarkInstallFailed(err.Error())
6068
if ks, ok := instance.(*v1beta1.KnativeServing); ok && strings.Contains(err.Error(), gatewayNotMatch) &&
@@ -71,6 +79,7 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen
7179

7280
// InstallWebhookConfigs applies the Webhook manifest resources and updates the given status accordingly.
7381
func InstallWebhookConfigs(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
82+
logging.FromContext(ctx).Debug("Installing webhook configurations")
7483
status := instance.GetStatus()
7584
if err := manifest.Filter(webhook).Apply(); err != nil {
7685
status.MarkInstallFailed(err.Error())

vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,11 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ke *v1beta1.KnativeEvent
139139
return nil
140140
},
141141
r.transform,
142-
r.handleTLSResources,
143142
r.handleBackstageResources,
143+
r.handleTLSResources,
144144
manifests.Install,
145+
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths
145146
common.CheckDeployments,
146-
common.InstallWebhookConfigs,
147-
manifests.SetManifestPaths,
148147
common.MarkStatusSuccess,
149148
common.DeleteObsoleteResources(ctx, ke, r.installed),
150149
}

vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ package knativeserving
1919
import (
2020
"context"
2121
"fmt"
22-
"os"
22+
"os"
2323

2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525
"k8s.io/client-go/kubernetes"
2626

2727
"knative.dev/pkg/logging"
2828
pkgreconciler "knative.dev/pkg/reconciler"
29+
2930
mf "github.com/manifestival/manifestival"
3031
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3132
"knative.dev/operator/pkg/apis/operator/base"
@@ -89,6 +90,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
8990
}
9091

9192
if manifest == nil {
93+
logger.Warnf("No manifest found; no cluster-scoped resources will be finalized")
9294
return nil
9395
}
9496
// we need this to apply the correct namespace to the resources otherwise it defaults to knative-serving
@@ -107,13 +109,13 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
107109
func overrideKourierNamespace(ks base.KComponent) mf.Transformer {
108110
if ns, required := os.LookupEnv("REQUIRED_SERVING_INGRESS_NAMESPACE"); required {
109111
nsInjector := mf.InjectNamespace(ns)
110-
return func(u *unstructured.Unstructured) error {
111-
provider := u.GetLabels()["networking.knative.dev/ingress-provider"]
112-
if provider != "kourier" {
113-
return nil
112+
return func(u *unstructured.Unstructured) error {
113+
provider := u.GetLabels()["networking.knative.dev/ingress-provider"]
114+
if provider != "kourier" {
115+
return nil
116+
}
117+
return nsInjector(u)
114118
}
115-
return nsInjector(u)
116-
}
117119
}
118120
return nil
119121
}
@@ -144,10 +146,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServi
144146
},
145147
r.transform,
146148
manifests.Install,
149+
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths
147150
common.CheckDeployments,
148-
common.InstallWebhookConfigs,
149151
common.InstallWebhookDependentResources,
150-
manifests.SetManifestPaths,
151152
common.MarkStatusSuccess,
152153
common.DeleteObsoleteResources(ctx, ks, r.installed),
153154
}

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ knative.dev/networking/pkg/http/proxy
16091609
knative.dev/networking/pkg/http/stats
16101610
knative.dev/networking/pkg/ingress
16111611
knative.dev/networking/pkg/k8s
1612-
# knative.dev/operator v0.44.8
1612+
# knative.dev/operator v0.44.9-0.20251030190238-fb0238a50768
16131613
## explicit; go 1.23.0
16141614
knative.dev/operator/pkg/apis/operator
16151615
knative.dev/operator/pkg/apis/operator/base

0 commit comments

Comments
 (0)