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

Dev env setup issues #429

Closed
brightzheng100 opened this issue Sep 23, 2021 · 2 comments · Fixed by #437
Closed

Dev env setup issues #429

brightzheng100 opened this issue Sep 23, 2021 · 2 comments · Fixed by #437
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@brightzheng100
Copy link
Contributor

Bug description

While setting up the dev env for Capsule, I encountered some issues by following the doc here:
https://github.com/clastix/capsule/blob/master/docs/operator/contributing.md

How to reproduce

I followed the abovementioned doc but the step in Run Capsule is wrong.

If I issued make run, I'd hit the first error:

$ make run
...
go run ./main.go
# command-line-arguments
./main.go:61:55: undefined: GitTag
./main.go:61:63: undefined: GitCommit
./main.go:61:74: undefined: GitDirty
./main.go:62:46: undefined: GitRepo
./main.go:63:46: undefined: BuildTime

This is because the GitTag is defined in version.go file, so the fix is very straightforward:

run: generate manifests
	go run ./main.go ./version.go

The I tried it again, I'd hit second error:

$ make run
...
{"level":"error","ts":"2021-09-23T16:36:00.297+0800","logger":"setup","msg":"unable to start manager","error":"unable to determinate the Namespace Capsule is running on","stacktrace":"main.main\n\t/Users/brightzheng/development/go/k8s-ecosystem/capsule/main.go:100\nruntime.main\n\t/usr/local/Cellar/go/1.17.1/libexec/src/runtime/proc.go:255"}

This is also obvious, the main.go is expecting a system env:

	if namespace = os.Getenv("NAMESPACE"); len(namespace) == 0 {
		setupLog.Error(fmt.Errorf("unable to determinate the Namespace Capsule is running on"), "unable to start manager")
		os.Exit(1)
	}

So the fix is also very obvious:

$ export NAMESPACE=capsule-system
$ make run

PS: I'm using k3d-powered k3s cluster as this is lighter way than kind.

Expected behavior

The doc should work expected to easily setup the dev env.

Additional context

  • Capsule version: master
  • Kubernetes version: v1.21.x
@brightzheng100 brightzheng100 added blocked-needs-validation Issue need triage and validation bug Something isn't working labels Sep 23, 2021
@prometherion prometherion added documentation Improvements or additions to documentation and removed blocked-needs-validation Issue need triage and validation labels Sep 23, 2021
@prometherion
Copy link
Member

Thanks for reporting this, @brightzheng100!

This run target has been inherited upon OperatorSDK scaffolding and I never used and totally forgot to keep aligned with the requested changes.

Would be great to fix the missing pieces and document documentation, too: contributions are warmly welcomed! 🤗

@brightzheng100
Copy link
Contributor Author

Sure, I can enhance it with not only Kind but also K3d(+K3s), more options for devs:)

@prometherion prometherion added this to the v0.1.1 milestone Sep 28, 2021
@prometherion prometherion linked a pull request Sep 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants