Skip to content

Revert "Propagate manifests paths earlier to operator status (#2106)" #2107

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 0 additions & 9 deletions pkg/reconciler/common/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ 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)
}
// Webhook configs are placeholder to be reconciled and configured by webhook controllers, not fully operational yet.
// They are owned by SYSTEM_NAMESPACE and reconciled once webhook deployment is started.
// In some cases a webhook config might be left on the cluster from previous uncompleted install/reinstall attempts.
// Such pre-existing webhook config can block creation of ConfigMap and other resource that are validated, resulting
// in a deadlock installation loop. For this reasons
if err := InstallWebhookConfigs(ctx, manifest, instance); err != nil {
return err
}
if err := manifest.Filter(mf.Not(mf.Any(role, rolebinding, webhook, webhookDependentResources))).Apply(); err != nil {
status.MarkInstallFailed(err.Error())
if ks, ok := instance.(*v1beta1.KnativeServing); ok && strings.Contains(err.Error(), gatewayNotMatch) &&
Expand All @@ -79,7 +71,6 @@ func Install(ctx context.Context, manifest *mf.Manifest, instance base.KComponen

// InstallWebhookConfigs applies the Webhook manifest resources and updates the given status accordingly.
func InstallWebhookConfigs(ctx context.Context, manifest *mf.Manifest, instance base.KComponent) error {
logging.FromContext(ctx).Debug("Installing webhook configurations")
status := instance.GetStatus()
if err := manifest.Filter(webhook).Apply(); err != nil {
status.MarkInstallFailed(err.Error())
Expand Down
6 changes: 5 additions & 1 deletion pkg/reconciler/common/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func TestInstall(t *testing.T) {
*clusterRole.DeepCopy(),
*roleBinding.DeepCopy(),
*clusterRoleBinding.DeepCopy(),
*deployment.DeepCopy(),
*mutatingWebhookConfiguration.DeepCopy(),
*validatingWebhookConfiguration.DeepCopy(),
*deployment.DeepCopy(),
}

client := &fakeClient{}
Expand All @@ -81,6 +81,10 @@ func TestInstall(t *testing.T) {
t.Fatalf("Install() = %v, want no error", err)
}

if err := InstallWebhookConfigs(context.TODO(), &manifest, instance); err != nil {
t.Fatalf("InstallWebhookConfigs() = %v, want no error", err)
}

if err := MarkStatusSuccess(context.TODO(), &manifest, instance); err != nil {
t.Fatalf("MarkStatusSuccess() = %v, want no error", err)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciler/knativeeventing/knativeeventing.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ke *v1beta1.KnativeEvent
r.transform,
r.handleTLSResources,
manifests.Install,
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths
common.CheckDeployments,
common.InstallWebhookConfigs,
manifests.SetManifestPaths,
common.MarkStatusSuccess,
common.DeleteObsoleteResources(ctx, ke, r.installed),
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/knativeserving/knativeserving.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1beta1.Knative
}

if manifest == nil {
logger.Warnf("No manifest found; no cluster-scoped resources will be finalized")
return nil
}

Expand Down Expand Up @@ -124,9 +123,10 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, ks *v1beta1.KnativeServi
r.appendExtensionManifests,
r.transform,
manifests.Install,
manifests.SetManifestPaths, // setting path right after applying manifests to populate paths
common.CheckDeployments,
common.InstallWebhookConfigs,
common.InstallWebhookDependentResources,
manifests.SetManifestPaths,
common.MarkStatusSuccess,
common.DeleteObsoleteResources(ctx, ks, r.installed),
}
Expand Down
Loading