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

Enable feature flag disabled error reporting for MachinePool, ClusterResourceSet #6331

Closed
killianmuldoon opened this issue Mar 24, 2022 · 3 comments · Fixed by #6348
Closed
Assignees
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Milestone

Comments

@killianmuldoon
Copy link
Contributor

User Story

As a user I would like to get transparent errors about Feature Flags on object creation.

Detailed Description

In order to get clear errors about feature flag status we can enable webhooks for objects when the associated feature flag is not enabled. The issue with this is whether or not enabling the webhooks in this way violates the way users understand feature flags.

All we're enabling here is reporting the status of the feature flag using the webhook so IMO this should not be a problem.

Additional Details
Currently there are two patterns in Cluster API for dealing with webhooks and feature flags:

Pattern 1: Don't start the webhook
MachinePools, ClusterResourceSet
Error:

Error from server (InternalError): error when creating "../scripts/cluster-api/kindnet-clusterresourceset.yaml": Internal error occurred: failed calling webhook "[default.clusterresourceset.addons.cluster.x-k8s.io](http://default.clusterresourceset.addons.cluster.x-k8s.io/)": Post "[https://capi-webhook-service.capi-system.svc:443/mutate-addons-cluster-x-k8s-io-v1beta1-clusterresourceset?timeout=10s](https://capi-webhook-service.capi-system.svc/mutate-addons-cluster-x-k8s-io-v1beta1-clusterresourceset?timeout=10s)": dial tcp 10.96.78.95:443: connect: connection refused

Pattern 2: Start the webhook but refuse object creation and updates.

  • ClusterClass
    Error:
Error from server (spec: Forbidden: can be set only if the ClusterTopology feature flag is enabled): error when creating "../scripts/cluster-api/clusterclass.yaml": admission webhook "validation.kubeadmcontrolplanetemplate.controlplane.cluster.x-k8s.io" denied the request: spec: Forbidden: can be set only if the ClusterTopology feature flag is enabled

Steps to implement
Both patterns block usage of the feature, but the error message from pattern 2 is readable and tells users exactly what happened. As a user I would prefer to see this error so I understand what changes I make to the system.

To do this we would need to:

  1. Remove feature flag checks for starting the MachinePool and ClusterResourceSet webhooks in main.go
  2. Add feature flag checks, like in the Cluster Class webhook, for both ValidateCreate and ValidateUpdate in the MachinePool and ClusterResourceSet webhooks.

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 24, 2022
@fabriziopandini
Copy link
Member

/remove-kind feature
/kind cleanup

/milestone v1.2

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 24, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.2 milestone Mar 24, 2022
@k8s-ci-robot k8s-ci-robot removed the kind/feature Categorizes issue or PR as related to a new feature. label Mar 24, 2022
@CecileRobertMichon
Copy link
Contributor

cc @jackfrancis this should significantly improve the error message when attempting to install a ClusterResourceSet when the feature flag is disabled

@sbueringer
Copy link
Member

/assign @Karthik-K-N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants