kubernetes-sigs / cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Apache License 2.0
3.57k stars 1.31k forks source link

Allow provider-specific validation of ProviderConfig in a Cluster resource #147

Closed csrwng closed 5 years ago

csrwng commented 6 years ago

The Problem:

Currently the cluster API server validates only the known fields of a Cluster resource. ProviderConfig is taken at face value and left for the Machine controller to interpret. Validation is needed to ensure that the data passed in ProviderConfig is well-formed. There are 2 use cases for this:

Given that an external ProviderConfig can be validated by an external server/controller, the following will only deal with the case in which a ProviderConfig is embedded in a Cluster resource.

Possible Solutions:

Many thanks to @deads2k who provided a good bit of information on this.

csrwng commented 6 years ago

@dgoodwin @staebler fyi

dlipovetsky commented 6 years ago

Doesn't this proposal apply to Machine ProviderConfig, too?

dlipovetsky commented 6 years ago

ProviderConfig only references an external resource Although we don't yet have fields for it, the Cluster could simply reference an external resource as its provider config.

Did you mean the ProviderConfigSource field? From what I understand, once the field is implemented (ongoing work is part of https://github.com/kubernetes/kube-deploy/pull/659), a ProviderConfig will be able to reference an external resource.

csrwng commented 6 years ago

Doesn't this proposal apply to Machine ProviderConfig, too?

Yes it does

Did you mean the ProviderConfigSource field?

Yes

alvaroaleman commented 6 years ago

I started to toy around a little with the Webhook functionality of Kubebuilder by trying to let it do Defaulting + Validation for MachineDeployments.

While I got it ultimately working, there are some issues:

CC @Lion-Wei

fejta-bot commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

vincepri commented 5 years ago

/remove-lifecycle stale

vincepri commented 5 years ago

/area api

ncdc commented 5 years ago

v1alpha2 removes the RawExtension fields and providers can now using OpenAPI and/or validating webhooks to validate their types.

/close

k8s-ci-robot commented 5 years ago

@ncdc: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/cluster-api/issues/147#issuecomment-522707423): >v1alpha2 removes the `RawExtension` fields and providers can now using OpenAPI and/or validating webhooks to validate their types. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.