kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

Windows release?

Open mattfarina opened this issue 7 years ago • 32 comments
trafficstars

There are releases for both Mac and Linux (appears to be POSIX based). Would it be possible to cross-compile to Windows and have a Windows release as well?

mattfarina avatar Jul 05 '18 14:07 mattfarina

I think cross-compiling Kubebuilder binary itself should be easy because we use GoReleaser to generate the builds, packaging the dependencies for Windows is going to require some more work here. Happy to help if anyone wants to take this up.

droot avatar Jul 10 '18 21:07 droot

If you want to run this on Windows, you could also enable the Windows Linux Subsystem on Windows (10) and install for example Ubuntu from the Windows App store and just install and run the Linux version of Kubebuilder

https://github.com/michaeltreat/Windows-Subsystem-For-Linux-Setup-Guide

p-bakker avatar Oct 12 '18 14:10 p-bakker

@p-bakker It's worth noting that ~50% of devs use Windows and most don't use the subsystem for Linux.

mattfarina avatar Nov 19 '18 17:11 mattfarina

true, but WSL is fairly new/gaining traction and while Devs use windows, I'd say most deployments are on Linux, so imho devs would be wise to get familiar with WSL and start making it part of their vocabulary as it gives them the opportunity to test more realistically (testing signals on windows for example won't get you far). Heck, even in VS Code you can now run your debug targets by adding a single property to the configuration.

Not saying there's no point in having native support on Windows, just noting there are alternatives which are pretty straight forward imho

p-bakker avatar Nov 20 '18 07:11 p-bakker

WSL does not fully support all development workflows. For example:

Can't run delve debugger on WSL: https://github.com/Microsoft/WSL/issues/2977

There is also issue running kubebuilder tests on WSL because etcd shipped with kubebuilder does not run under WSL.

Would be nice if the native windows version was available.

neelesh3710 avatar Feb 26 '19 19:02 neelesh3710

@droot Could you elaborate on packaging the dependencies for Windows is going to require some more work? Do you mean e.g. etcd/kube-apiserver/kubectl for testing? The only dependency I could find which did not have a windows build available was kube-apiserver.

With the two diffs below, I'm able to build and use Kubebuilder natively on windows. I'm happy to take this task up and do the work necessary to get it into mergeable state.

https://github.com/kubernetes-sigs/controller-tools/pull/179 https://github.com/kubernetes-sigs/kubebuilder/pull/661

alexeldeib avatar Apr 08 '19 03:04 alexeldeib

For testing on windows, I used a container and volume mounted my dev directory so that I could run kube-apiserver. This is one of the areas that would require more work for a smooth experience, e.g. providing a predefined dev docker container or possibly running kube-apiserver (and ideally other elements) from a docker image during tests.

alexeldeib avatar Apr 08 '19 05:04 alexeldeib

Could you elaborate on packaging the dependencies for Windows is going to require some more work? Do you mean e.g. etcd/kube-apiserver/kubectl for testing? The only dependency I could find which did not have a windows build available was kube-apiserver.

Yes, thats what I meant.

droot avatar Apr 12 '19 17:04 droot

/reopen

alexeldeib avatar Apr 25 '19 18:04 alexeldeib

@alexeldeib: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Apr 25 '19 18:04 k8s-ci-robot

@droot I marked this as fixed in the PR which was a mistake 😦 could you reopen?

alexeldeib avatar Apr 25 '19 18:04 alexeldeib

sorry for the terrifically long delay here

DirectXMan12 avatar May 30 '19 21:05 DirectXMan12

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

fejta-bot avatar Aug 28 '19 21:08 fejta-bot

/lifecycle frozen

DirectXMan12 avatar Sep 03 '19 18:09 DirectXMan12

we still need help for this. we'll want CI too

DirectXMan12 avatar Sep 03 '19 18:09 DirectXMan12

Re https://github.com/kubernetes-sigs/kubebuilder/issues/300#issuecomment-467586524 about WSL, Microsoft gave up on trying to translating syscalls and WSL2 is a very lightweight VM so now truly all Linux programs will work. Just sayin'.

chx avatar Sep 18 '19 07:09 chx

I think it’s reasonable to tell windows users to run e2e tests agains kind, and set envtest to use existing cluster?

I regularly work on windows and linux and use kubebuilder fine with this approach on both. Some random characters in help text but that’s my biggest complaint.

Rest of testing can probably be done in Go and be x-plat?

alexeldeib avatar Sep 18 '19 08:09 alexeldeib

I am starting off with kubebuilder on windows- is the easiest option to build by myself?

Aarthisk avatar Oct 16 '19 18:10 Aarthisk

That’s what I do

alexeldeib avatar Oct 16 '19 20:10 alexeldeib

It'd be nice to at least have nightly builds using cross-compile, I think (if anyone wants to pitch in) and a test on prow/travis that tries to cross-compile.

DirectXMan12 avatar Oct 16 '19 21:10 DirectXMan12

With both issues mentioned in https://github.com/kubernetes-sigs/kubebuilder/issues/300#issuecomment-480667169 merged, is it possible to compile for windows straight away or do I need to change anything?

The mentioned tests issues are with projects build with kubebuilder or with the kubebuilder cmd? The first is not an issue as they will be tested in my CI machines which are non-windows.

Adirio avatar Oct 17 '19 12:10 Adirio

You'll be fine. I did a sanity check right now:

git clone [email protected]:kubernetes-sigs/kubebuilder
cd kubebuilder
go build -o kubebuilder.exe ./cmd/
./kubebuilder.exe # works

alexeldeib avatar Oct 17 '19 12:10 alexeldeib

Elaborating on my original comment, the test issues are related to running e2e tests for controllers built using Kubebuilder which depend on a full Kubernetes cluster. On Linux, you can use the etcd/apiserver binaries and the envtest package to quickly spin up a real backend. On windows, you can't run the apiserver binary, so this doesn't work.

Using kind works well as a backing cluster for envtest on windows. This will let you run full e2e with controllers made using kubebuilder/controller-runtime on your windows machine.

The tests for kubebuilder itself are a separate story.

alexeldeib avatar Oct 17 '19 12:10 alexeldeib

I have a running kubernetes on windows (docker-for-windows). Well its actually not windows somehow as it is pulling the linux images from the manifests, but all the kubernetes cluster is accessible with kubectl from the windows command. Shouldn't that be enough for e2e tests?

Adirio avatar Oct 17 '19 12:10 Adirio

See https://godoc.org/sigs.k8s.io/controller-runtime/pkg/envtest for requirements, but that will probably work. I can't say without more certainty without trying 😄

alexeldeib avatar Oct 17 '19 12:10 alexeldeib

Which version of Golang are you using? I'm asking this to know if I must set go modules as I'm currently using 1.12.x which if I'm not mistaken is the last that doesn't have it turned on by default.

Adirio avatar Oct 17 '19 13:10 Adirio

Correct, the above requires go modules (I always enable them by default in my environment)

Barring windows specific issues on this thread, slack channel is probably a better forum for discussion + q/a 🙂

alexeldeib avatar Oct 17 '19 13:10 alexeldeib

@alexeldeib you said "Using kind works well as a backing cluster for envtest on windows. This will let you run full e2e with controllers made using kubebuilder/controller-runtime on your windows machine."

So forgive the novice question, but with a backing "real" k8s cluster, this should just work then? The issues you are pointing out are unit testing without a cluster which I can honestly live without.

Aarthisk avatar Oct 17 '19 21:10 Aarthisk

I'm finding some issues with the paths inside the generated Makefile for the projects. To achieve compatibility with Windows I guess this generated Makefile (https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/scaffold/v2/makefile.go) needs to be either generic or specific for the target OS.

Adirio avatar Oct 18 '19 08:10 Adirio

happy to take fixes to make it windows-compatible (none of the core devs have windows machines, so it's a bit hard for us)

DirectXMan12 avatar Nov 06 '19 01:11 DirectXMan12