devspace icon indicating copy to clipboard operation
devspace copied to clipboard

feat: add tanka integration to Devspace

Open xvzf opened this issue 2 years ago • 26 comments

/kind feature resolves https://github.com/loft-sh/devspace/issues/2269

Purpose

This PR picks up on #2325 and introduces Tanka environment support for Devspaces. We internally use Tanka and would like to share a common code base between all environments, including local development stacks.

Todos

  • [x] Extend the schema definition with a tanka deployment configuration
  • [x] Fix the schema of deployments.tanka
  • [x] Add a Tanka deployer under pkg/devspace/deploy/deployer/tanka
  • [x] Check if we add an option to run jb update before using tk
  • [ ] ~Make a PR to https://github.com/loft-sh/loft-util to be able to download tanka binary~
  • [x] Add e2e tests

Closes #2325

xvzf avatar Sep 26 '22 10:09 xvzf

Hello, @alexissellier , @xvzf !

Thanks a lot for your contribution so far, we're really appreciating it. I was wondering if you are still working on this specific feature or planning to further contribute to it in the future.

If there's anything we can support with, please don't hesitate to ask. Thanks

alexandradragodan avatar Oct 21 '22 11:10 alexandradragodan

Hi @alexandradragodan,

yes, we're still on this; the work has been paused for a few weeks due to a shift in priorities I/we plan to get this out rather soon as we have to get it out shortly.

I think we are good for now, still need to find the time to develop the proper testing!

Best, Matthias

xvzf avatar Oct 25 '22 10:10 xvzf

@alexandradragodan is there any reason to use go mod vendor?

We had to update some of the dependencies as the build has been failing, and it resulted in a very huge commit: https://github.com/loft-sh/devspace/pull/2344/commits/8724be3094e924b623765a71d23ecbb002405f37

xvzf avatar Oct 28 '22 15:10 xvzf

@xvzf we commit the dependencies to make sure everything that is needed to run the project is checked into github which includes the vendor folder. What dependencies did you need to update?

FabianKramm avatar Nov 07 '22 11:11 FabianKramm

@FabianKramm I just rebased on the main branch and cleaned up some of our commits; this fixes the issue. Should be ready to review now!

xvzf avatar Nov 07 '22 11:11 xvzf

@FabianKramm I rebased again on main - not sure why the checks were failing. It works fine for me on MacOS & inside a plain docker container now, so likely resolved.

In addition, I'm installing the tanka binary in the e2e test dependencies

xvzf avatar Nov 15 '22 13:11 xvzf

@xvzf this is the error we see in the checks (https://github.com/loft-sh/devspace/actions/runs/3469882468/jobs/5800565983):

ok  	github.com/loft-sh/devspace/pkg/devspace/deploy/deployer/kubectl/walk	1.054s	coverage: 73.3% of statements
--- FAIL: TestNewTankaEnvironment (0.00s)
    --- FAIL: TestNewTankaEnvironment/HydrateArguments (0.00s)
panic: cannot handle unexported field at {*tanka.tankaEnvironmentImpl}.stdout.(*os.File).file:
	"os".File
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported [recovered]
	panic: cannot handle unexported field at {*tanka.tankaEnvironmentImpl}.stdout.(*os.File).file:
	"os".File
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported

goroutine 7 [running]:
testing.tRunner.func1.2({0x20e7720, 0xc0000cdea0})
	C:/hostedtoolcache/windows/go/1.19.3/x64/src/testing/testing.go:1396 +0x372
testing.tRunner.func1()
	C:/hostedtoolcache/windows/go/1.19.3/x64/src/testing/testing.go:1399 +0x5f0
panic({0x20e7720, 0xc0000cdea0})
	C:/hostedtoolcache/windows/go/1.19.3/x64/src/runtime/panic.go:890 +0x262
github.com/google/go-cmp/cmp.validator.apply({{}}, 0xc000185ae0, {0x21b9960?, 0xc0000c6008?, 0x2732730?}, {0x21b9960?, 0xc0000c6008?, 0x21b9960?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/options.go:244 +0x445
github.com/google/go-cmp/cmp.(*state).tryOptions(0xc000185ae0, {0x274d4c8, 0x21b9960}, {0x21b9960?, 0xc0000c6008?, 0x4aee39?}, {0x21b9960?, 0xc0000c6008?, 0x4b0405?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:304 +0x146
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x273e618, 0xc000022d00?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:259 +0x5a9
github.com/google/go-cmp/cmp.(*state).compareStruct(0xc000185ae0, {0x274d4c8, 0x2230fe0}, {0x2230fe0?, 0xc0000c6008?, 0xc0002fec40?}, {0x2230fe0?, 0xc0000c6008?, 0x199?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:412 +0xa52
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x273e588, 0xc0000d1e40?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:287 +0x1412
github.com/google/go-cmp/cmp.(*state).comparePtr(0xc000185ae0, {0x274d4c8, 0x236f500}, {0x236f500?, 0xc0000c6008?, 0x0?}, {0x236f500?, 0xc0000c6008?, 0x21c2c[98](https://github.com/loft-sh/devspace/actions/runs/3469882468/jobs/5800565983#step:4:99)?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:564 +0x785
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x273e678, 0xc0000d1e00?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:293 +0x1252
github.com/google/go-cmp/cmp.(*state).compareInterface(0x21c2c60?, {0x274d4c8?, 0x21c2c60?}, {0x21c2c60?, 0xc000185980?, 0xc0000267b0?}, {0x21c2c60?, 0xc0001858e0?, 0x4611c5?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:577 +0x6df
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x273e618, 0xc000022c00?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:295 +0x11ac
github.com/google/go-cmp/cmp.(*state).compareStruct(0xc000185ae0, {0x274d4c8, 0x22e4f40}, {0x22e4f40?, 0xc000185900?, 0xc00017e820?}, {0x22e4f40?, 0xc000185860?, 0x437bf41?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:412 +0xa52
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x273e588, 0xc0000d1d80?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:287 +0x1412
github.com/google/go-cmp/cmp.(*state).comparePtr(0xc000185ae0, {0x274d4c8, 0x2269d60}, {0x2269d60?, 0xc000185900?, 0x[100](https://github.com/loft-sh/devspace/actions/runs/3469882468/jobs/5800565983#step:4:101)0000000000?}, {0x2269d60?, 0xc000185860?, 0x20?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:564 +0x785
github.com/google/go-cmp/cmp.(*state).compareAny(0xc000185ae0, {0x2733368, 0xc0000d1d40?})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:293 +0x1252
github.com/google/go-cmp/cmp.Diff({0x2269d60, 0xc000185900}, {0x2269d60, 0xc000185860}, {0xc0000cddf0, 0x1, 0x1})
	D:/a/devspace/devspace/vendor/github.com/google/go-cmp/cmp/compare.go:[120](https://github.com/loft-sh/devspace/actions/runs/3469882468/jobs/5800565983#step:4:121) +0xd5
github.com/loft-sh/devspace/pkg/devspace/deploy/deployer/tanka.TestNewTankaEnvironment.func1(0xc00017e340)
	D:/a/devspace/devspace/pkg/devspace/deploy/deployer/tanka/builder_test.go:73 +0x267
testing.tRunner(0xc00017e340, 0xc0000cdcf0)
	C:/hostedtoolcache/windows/go/1.19.3/x64/src/testing/testing.go:[144](https://github.com/loft-sh/devspace/actions/runs/3469882468/jobs/5800565983#step:4:145)6 +0x217
created by testing.(*T).Run
	C:/hostedtoolcache/windows/go/1.19.3/x64/src/testing/testing.go:1493 +0x75e
FAIL	github.com/loft-sh/devspace/pkg/devspace/deploy/deployer/tanka	0.186s
FAIL
?   	github.com/loft-sh/devspace/pkg/devspace/deploy/testing	[no test files]

FabianKramm avatar Nov 16 '22 09:11 FabianKramm

@FabianKramm yeah, noticed as well. We don't have windows internally - I'll try to find a fix for this

xvzf avatar Nov 16 '22 10:11 xvzf

@FabianKramm I've change the test so we do not need to rely on cmp.AllowUnexported, thus no more discrepancy between windows and linux regarding the tests

alexissellier avatar Nov 22 '22 10:11 alexissellier

@FabianKramm can you give it another spin please? Hopefully the final one!

xvzf avatar Nov 22 '22 20:11 xvzf

We're looking into it. It seems more and more to be a flaky test :)

xvzf avatar Nov 23 '22 08:11 xvzf

So, flag order is now deterministic and test cases should pass consistently now. Sorry for the inconvenience!

Ping to @carlmontanari to re-trigger the test cases :)

xvzf avatar Nov 23 '22 21:11 xvzf

Hi @FabianKramm, I'm wondering if you have an ETA about this Tanka integration into DevSpace? This missing feature is actually preventing us from adoption. Thanks!

jbfarez avatar Nov 28 '22 07:11 jbfarez

Hey @xvzf @alexissellier! Thanks for the work on this, I still didn't have a chance to review it yet, but hopefully I can take a look this week!

FabianKramm avatar Nov 28 '22 16:11 FabianKramm

Hey @FabianKramm

In case you have any questions or would like to discuss something directly, don't hesitate to reach out

xvzf avatar Dec 06 '22 11:12 xvzf

Hey @FabianKramm @LukasGentele is there any update/ETC or anything you're missing from our end? :)

xvzf avatar Dec 19 '22 10:12 xvzf

@FabianKramm the devspace dev works, we'll add an E2E test for it

xvzf avatar Dec 21 '22 11:12 xvzf

I've set the two options to run JB to true by default.

alexissellier avatar Dec 26 '22 17:12 alexissellier

And I have added an e2e test that focus on a replaced pod using tanka as a deployer @FabianKramm

alexissellier avatar Dec 27 '22 10:12 alexissellier

@FabianKramm could you re-check the PR? :)

xvzf avatar Jan 06 '23 08:01 xvzf

Hi @FabianKramm,

Just 🆙 this one since we're actively waiting for it to finalize our DevSpace integration. Sorry for being so pushy, but we strongly believe in DevSpace and would like to make it work with Tanka, a central configuration piece here at Ankorstore.

Thanks!

jbfarez avatar Jan 18 '23 09:01 jbfarez

@jbfarez @alexissellier @xvzf sorry for the delay, I added comments to the unclear section, in general we should make sure to use smart defaults for all these values, so the goal is to provide an "easy" way to the end user with having to configure as less as possible before getting started with the tanka deployment method. Its fine to have options for more advanced configuration, but the default should be easy and minimal, so what ever we can automatically find out there we should.

FabianKramm avatar Jan 30 '23 09:01 FabianKramm

@FabianKramm responded to your comments & resolved the conflicts with the current HEAD

xvzf avatar Jan 30 '23 11:01 xvzf

Since DevSpace has been donated to the CNCF, don't hesitate to contact us if you're looking for more maintainers. We're increasingly using Devspace internally now and would love to contribute more in the future!

xvzf avatar Jan 30 '23 11:01 xvzf

Hey folks 👋 @FabianKramm @alexandradragodan any chance this is getting some traction soon (and if not, what's the timeline?)

xvzf avatar Feb 16 '23 16:02 xvzf

Deploy Preview for devspace-docs canceled.

Built without sensitive environment variables

Name Link
Latest commit 8ca50b2522d63782138f3cde8ac6a176174f26f2
Latest deploy log https://app.netlify.com/sites/devspace-docs/deploys/64183f4985f3e20008be3269

netlify[bot] avatar Feb 17 '23 17:02 netlify[bot]

Unfortunately, we are not going to include tanka integration into our core codebase for now. Thanks for working on it!

deniseschannon avatar Jul 09 '24 18:07 deniseschannon