iximiuz / client-go-examples

Collection of mini-programs demonstrating Kubernetes client-go usage.
https://labs.iximiuz.com/playgrounds/k8s-client-go/
Apache License 2.0
1.02k stars 131 forks source link

Implement CI #11

Closed Jasstkn closed 1 year ago

Jasstkn commented 1 year ago

Signed-off-by: Maria Kotlyarevskaya mariia.kotliarevskaia@gmail.com

Hey @iximiuz! I took an initiative to implement some POC of CI for this repository. The main issue with it is that some of the examples expect you pass extra options during the start or create something beforehand.

The current implementation is very simple and works this way:

  1. takes list of the directories in this repo, create a json valid list
  2. run go mod tidy, go run main.go in each of this directories
  3. it supports working with several go / kubernetes versions easily. (but we need to figure out how to set up it properly, because even now one of the examples requires go 1.18)

You can see it alive here. Let me know what do you think :)

iximiuz commented 1 year ago

Great job!

I think it might be interesting to test different versions of Kubernetes against multiple versions of client-go (the Go version itself is probably less critical). Have you tried something like go mod edit -replace k8s.io/client-go=k8s.io/client-go@<version>?

Jasstkn commented 1 year ago

Great job!

I think it might be interesting to test different versions of Kubernetes against multiple versions of client-go (the Go version itself is probably less critical). Have you tried something like go mod edit -replace k8s.io/client-go=k8s.io/client-go@<version>?

yep, that's working but according to the results - a lot of examples should be fixed. I didn't go in details but it seems that the latest libraries require correspondent go version. (e.g. 1.19)

sample run

iximiuz commented 1 year ago

I think then we should bump up the Go version. IMO, we should be more focused on different package & k8s versions than on the compiler. Go has been pretty good with backward compatibility. Well done! I merging it for now since there will be always a room for improvement 😄

Jasstkn commented 1 year ago

I think then we should bump up the Go version. IMO, we should be more focused on different package & k8s versions than on the compiler. Go has been pretty good with backward compatibility. Well done! I merging it for now since there will be always a room for improvement 😄

I don't mind to dig into that - feel free to ping me in the issues 🚀

iximiuz commented 1 year ago

I adapted the project a bit to make it more test-friendly. See #14. Bumped up the Go version and started using make test instead of plain go run main.go since some of the programs require extra preparation steps and/or arguments. And thanks to your groundwork, it's now 3 client-go versions x 4 k8s versions x 24 mini-programs 🔥