Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip][SRVKS-1301][RELEASE-1.35] Wait for deployments #3484

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions hack/patches/023-wait-for-webhook-services.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
diff --git a/vendor/knative.dev/operator/pkg/reconciler/common/deployments.go b/vendor/knative.dev/operator/pkg/reconciler/common/deployments.go
index c0c5afcea..b115f1407 100644
--- a/vendor/knative.dev/operator/pkg/reconciler/common/deployments.go
+++ b/vendor/knative.dev/operator/pkg/reconciler/common/deployments.go
@@ -18,6 +18,7 @@ package common

import (
"context"
+ "time"

mf "github.com/manifestival/manifestival"
appsv1 "k8s.io/api/apps/v1"
@@ -25,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/kubernetes/scheme"
"knative.dev/operator/pkg/apis/operator/base"
+ "knative.dev/pkg/controller"
)

// CheckDeployments checks all deployments in the given manifest and updates the given
@@ -52,7 +54,7 @@ func CheckDeployments(ctx context.Context, manifest *mf.Manifest, instance base.

if len(nonReadyDeployments) > 0 {
status.MarkDeploymentsNotReady(nonReadyDeployments)
- return nil
+ return controller.NewRequeueAfter(5*time.Second)
}

status.MarkDeploymentsAvailable()
diff --git a/vendor/knative.dev/operator/pkg/reconciler/common/install.go b/vendor/knative.dev/operator/pkg/reconciler/common/install.go
index 4b3b3adaf..0f0925b85 100644
--- a/vendor/knative.dev/operator/pkg/reconciler/common/install.go
+++ b/vendor/knative.dev/operator/pkg/reconciler/common/install.go
@@ -20,6 +20,8 @@ import (
"context"
"fmt"
"strings"
+
+ "k8s.io/apimachinery/pkg/runtime/schema"

mf "github.com/manifestival/manifestival"
"knative.dev/pkg/logging"
@@ -31,8 +33,9 @@ import (
var (
role mf.Predicate = mf.Any(mf.ByKind("ClusterRole"), mf.ByKind("Role"))
rolebinding mf.Predicate = mf.Any(mf.ByKind("ClusterRoleBinding"), mf.ByKind("RoleBinding"))
- webhook mf.Predicate = mf.Any(mf.ByKind("MutatingWebhookConfiguration"), mf.ByKind("ValidatingWebhookConfiguration"))
- gatewayNotMatch = "no matches for kind \"Gateway\""
+ webhook mf.Predicate = mf.Any(mf.ByKind("MutatingWebhookConfiguration"), mf.ByKind("ValidatingWebhookConfiguration"))
+ webhookDependantResources mf.Predicate = mf.ByGVK(schema.GroupVersionKind{"networking.internal.knative.dev", "v1alpha1", "Certificate"})
+ gatewayNotMatch = "no matches for kind \"Gateway\""
)

// Install applies the manifest resources for the given version and updates the given
@@ -52,7 +55,7 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen
status.MarkInstallFailed(err.Error())
return fmt.Errorf("failed to apply (cluster)rolebindings: %w", err)
}
- if err := manifest.Filter(mf.Not(mf.Any(role, rolebinding, webhook))).Apply(); err != nil {
+ if err := manifest.Filter(mf.Not(mf.Any(role, rolebinding, webhook, webhookDependantResources))).Apply(); err != nil {
status.MarkInstallFailed(err.Error())
if ks, ok := instance.(*v1beta1.KnativeServing); ok && strings.Contains(err.Error(), gatewayNotMatch) &&
(ks.Spec.Ingress == nil || ks.Spec.Ingress.Istio.Enabled) {
@@ -63,10 +66,29 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen

return fmt.Errorf("failed to apply non rbac manifest: %w", err)
}
+ return nil
+}
+
+func InstallWebhookConfigs(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
+ status := instance.GetStatus()
if err := manifest.Filter(webhook).Apply(); err != nil {
status.MarkInstallFailed(err.Error())
return fmt.Errorf("failed to apply webhooks: %w", err)
}
+ return nil
+}
+
+func InstallWebhookDepResources(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
+ status := instance.GetStatus()
+ if err := manifest.Filter(webhookDependantResources).Apply(); err != nil {
+ status.MarkInstallFailed(err.Error())
+ return fmt.Errorf("failed to apply webhooks: %w", err)
+ }
+ return nil
+}
+
+func MarkStatusSuccess(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
+ status := instance.GetStatus()
status.MarkInstallSucceeded()
status.SetVersion(TargetVersion(instance))
return nil
diff --git a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
index 7d652cb0d..6c1c10ed7 100644
--- a/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
+++ b/vendor/knative.dev/operator/pkg/reconciler/knativeeventing/knativeeventing.go
@@ -143,6 +143,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ke *v1beta1.KnativeEvent
r.handleBackstageResources,
manifests.Install,
common.CheckDeployments,
+ common.InstallWebhookConfigs,
+ manifests.SetManifestPaths,
+ common.MarkStatusSuccess,
common.DeleteObsoleteResources(ctx, ke, r.installed),
}
manifest := r.manifest.Append()
diff --git a/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go b/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
index ccf9f2f67..df16adfb5 100644
--- a/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
+++ b/vendor/knative.dev/operator/pkg/reconciler/knativeserving/knativeserving.go
@@ -145,6 +145,10 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServi
r.transform,
manifests.Install,
common.CheckDeployments,
+ common.InstallWebhookConfigs,
+ common.InstallWebhookDepResources,
+ manifests.SetManifestPaths,
+ common.MarkStatusSuccess,
common.DeleteObsoleteResources(ctx, ks, r.installed),
}
manifest := r.manifest.Append()
diff --git a/vendor/knative.dev/operator/pkg/reconciler/manifests/install.go b/vendor/knative.dev/operator/pkg/reconciler/manifests/install.go
index dc5bf0d77..275763d5b 100644
--- a/vendor/knative.dev/operator/pkg/reconciler/manifests/install.go
+++ b/vendor/knative.dev/operator/pkg/reconciler/manifests/install.go
@@ -34,6 +34,10 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen
if err != nil {
return err
}
+ return nil
+}
+
+func SetManifestPaths(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
status := instance.GetStatus()
path := common.TargetManifestPathArray(instance)
version := common.TargetVersion(instance)
2 changes: 1 addition & 1 deletion olm-catalog/serverless-operator-index/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN /bin/opm init serverless-operator --default-channel=stable --output yaml >>
RUN /bin/opm render --skip-tls-verify -o yaml \
registry.ci.openshift.org/knative/release-1.34.0:serverless-bundle \
registry.ci.openshift.org/knative/release-1.35.0:serverless-bundle \
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-135/serverless-bundle@sha256:9ed31ef6fc4499a8ca4747163ad5f9da1bb7537d42dc2976826e7a771d8833fb >> /configs/index.yaml
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-135/serverless-bundle@sha256:d3e592f34127fb1c2dcfdfb1f91cafc3a6e7fe6a4420ca6bccfc6c681ea24ef9 >> /configs/index.yaml

# The base image is expected to contain
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
Expand Down
Loading
Loading