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

Book ERROR setup problem running manager {"error": "open /tmp/k8s-webhook-server/serving-certs/tls.crt: no such file or directory"} #3559

Closed
csantanapr opened this issue Aug 25, 2023 · 3 comments · Fixed by #3578
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@csantanapr
Copy link
Member

What broke? What's expected?

Following the book tutorial in ordered steps, when getting to this page https://book.kubebuilder.io/cronjob-tutorial/running

At this point of the tutorial the user doesn't want to run the webhooks, just test with make run and disable the webhooks.

It intructs the user to skip the webhook with environment variable

export ENABLE_WEBHOOKS=false
make run

I expect to not see any errors.
The previous page https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation
Doesn't mention at all that the main.go needs be modified from:

	if err = (&batchv1.CronJob{}).SetupWebhookWithManager(mgr); err != nil {
		setupLog.Error(err, "unable to create webhook", "webhook", "CronJob")
		os.Exit(1)
	}

Modified to:

	if os.Getenv("ENABLE_WEBHOOKS") != "false" {
		if err = (&batchv1.CronJob{}).SetupWebhookWithManager(mgr); err != nil {
			setupLog.Error(err, "unable to create webhook", "webhook", "CronJob")
			os.Exit(1)
		}
	}

Reproducing this issue

Follow tutorial in order up to this page Following the book tutorial in ordered steps, when getting to this page https://book.kubebuilder.io/cronjob-tutorial/running

It intructs the user to skip the webhook with environment variable

export ENABLE_WEBHOOKS=false
make run

When running I get the following error

2023-08-25T17:57:51Z    ERROR   setup   problem running manager {"error": "open /tmp/k8s-webhook-server/serving-certs/tls.crt: no such file or directory"}
main.main
        /workspaces/kubebuilder-book-club-aws/cmd/main.go:116
runtime.main
        /usr/local/go/src/runtime/proc.go:250

KubeBuilder (CLI) Version

3.11.1

PROJECT version

3

Plugin versions

No response

Other versions

No response

Extra Labels

/kind documentation

@csantanapr csantanapr added the kind/bug Categorizes issue or PR as related to a bug. label Aug 25, 2023
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Aug 25, 2023
@camilamacedo86
Copy link
Member

Hi @csantanapr,

Thank you for pointing this out. You're absolutely right. The tutorial is structured with the assumption that readers are progressing step by step and have completed the preceding sections, as seen here: https://book.kubebuilder.io/cronjob-tutorial/main-revisited

However, for the benefit of those who might land directly on this specific page, I believe it would be beneficial to include a "note" or "warning" highlight. This way, readers are informed about the prerequisites and can navigate the tutorial more effectively.

Would you like to work on this one?
WDYT about push a PR to update this doc?

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Aug 26, 2023
@lowang-bh
Copy link
Member

/assign

@lowang-bh
Copy link
Member

Hi, @csantanapr and @camilamacedo86 , I reproduce this error using master branch code with following steps and found the generated code in main.go does not check the ENABLE_WEBHOOKS env:

  1. make install to install master kuberbuilder
  2. following the quick start docs to create a app
  3. use kubebuilder create webhook to gen a webhook and run make manifests; make install to update
  4. run export ENABLE_WEBHOOKS=false; make run
image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
4 participants