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

Make kubectl-validate compatible with WASM #79

Open
eddycharly opened this issue Nov 9, 2023 · 7 comments
Open

Make kubectl-validate compatible with WASM #79

eddycharly opened this issue Nov 9, 2023 · 7 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@eddycharly
Copy link
Contributor

eddycharly commented Nov 9, 2023

Currently it's not possible to use kubectl-validate and build a wasm module because of dependencies that bring a reference to etcd (that has non supported syscalls).

GOOS=js GOARCH=wasm go build -o ./main.wasm ./main.go

package command-line-arguments
        imports sigs.k8s.io/kubectl-validate/pkg/cmd
        imports k8s.io/apiextensions-apiserver/pkg/apiserver
        imports k8s.io/apiextensions-apiserver/pkg/registry/customresource
        imports k8s.io/apiserver/pkg/registry/generic
        imports k8s.io/apiserver/pkg/storage/storagebackend/factory
        imports go.etcd.io/etcd/client/pkg/v3/transport
        imports golang.org/x/sys/unix: build constraints exclude all Go files in /Users/charled/Documents/dev/eddycharly/kubectl-validate/vendor/golang.org/x/sys/unix

I think there's no reason why it should not be possible, probably requires to change packages organisation a little bit though to avoid the package level reference to etcd ?

@alexzielenski
Copy link
Contributor

alexzielenski commented Nov 16, 2023

Yeah this is mainly due to our reliance on apiextensions-apiserver to validate CRDs. THey ahve recursive schemas which the k8s validators choke on.

If we remove the ability to validate CRDs by schema and just skip/error on CRDs then this requirement can be removed.

Curious about people's thoughts on that proposition

@eddycharly
Copy link
Contributor Author

eddycharly commented Dec 12, 2023

@alexzielenski do you suggest removing CRD support ?

@eddycharly
Copy link
Contributor Author

IIRC code like this was part of the problem return rest.BeforeCreate(strat, request.WithNamespace(context.TODO(), ""), obj)

@alexzielenski
Copy link
Contributor

@alexzielenski do you suggest removing CRD support ?

I am waffling about it. It is the only resource we cheat for validation on and it would be a lot of work to support its recursive schema. I wonder if users would miss it

ike this was part of the problem return rest.BeforeCreate(strat, request.WithNamespace(context.TODO(), ""), obj)

Ah, if that is the case that can also be quite easily removed & replicated within our own codebase

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 13, 2024
@alexzielenski
Copy link
Contributor

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 1, 2024
@alexzielenski
Copy link
Contributor

alexzielenski commented Apr 15, 2024

Took another look at this. We rely on a lot more code than just ValidateCustomResourceDefinition inside apiextensions-apiserver (all CEL validaiton lives there, as well as structural schema definitions and ratcheting validators). Unfortunately itd be quite a large refactor to move them out of that package upstream, and I would rather keep the dependency to ensure the code says the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants