Closed csrwng closed 5 years ago
@dgoodwin @staebler fyi
Doesn't this proposal apply to Machine ProviderConfig, too?
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.
Doesn't this proposal apply to Machine ProviderConfig, too?
Yes it does
Did you mean the ProviderConfigSource field?
Yes
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:
touch
on the respective files so it generates the secret, then re-deploying it with the mount enabled againInternal error occurred: jsonpatch add operation does not apply: doc is missing path: /spec/strategy/type
. Adding the spec.strategy.type
field with an empty string value fixed that and then the rest of the defaulting worked properlyCC @Lion-Wei
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
/remove-lifecycle stale
/area api
v1alpha2 removes the RawExtension
fields and providers can now using OpenAPI and/or validating webhooks to validate their types.
/close
@ncdc: Closing this issue.
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:
A separate controller validates the ProviderConfig - A provider-specific controller could watch Cluster resources as they're created and set their status appropriately if the embedded ProviderConfig is found to be invalid.
Pros:
Cons:
Cluster API apiserver validates the ProviderConfig itself - Assuming that the ProviderConfig is backed by a CRD, the API server could look up the CRD definition, and if it includes a validation definition, reuse the CRD validation code to validate the resource. CRD validation is now a gated feature in Kubernetes 1.10.
Pros:
Cons:
Cluster API apiserver delegates to dynamic admission control to validate - Dynamic admission webhooks allow dynamically registering external HTTP endpoints that will be called with an API resource on admission and give them a chance to validate the resource before it makes it to the API server's regular validation logic. This requires that the apiserver be configured to include the ValidatingAdmissionWebhook admission control via command line argument.
Pros:
Cons:
Many thanks to @deads2k who provided a good bit of information on this.