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

local development error from **make run** main: error: Cannot start controller manager: open /tls/server/tls.crt: no such file or directory #249

Open
mad01 opened this issue May 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@mad01
Copy link

mad01 commented May 21, 2024

What happened?

We are missing the tls path that is expected when running controller locally.

🦄 ❯❯❯ make run 
10:38:52 [ .. ] verify go modules dependencies have expected content
all modules verified
10:39:02 [ OK ] go modules dependencies verified
10:39:02 [ .. ] go generate linux_arm64
10:39:07 [ OK ] go generate linux_arm64
10:39:07 [ .. ] go mod tidy
10:39:07 [ OK ] go mod tidy
10:39:07 [ .. ] Generating CRDs with kustomize
10:39:08 [ OK ] Generated CRDs with kustomize
10:39:08 [ .. ] Cleaning up kustomize generated CRDs
10:39:08 [ OK ] Cleaned up kustomize generated CRDs
10:39:08 [ .. ] Running Crossplane locally out-of-cluster . . .
customresourcedefinition.apiextensions.k8s.io/objects.kubernetes.crossplane.io unchanged
customresourcedefinition.apiextensions.k8s.io/observedobjectcollections.kubernetes.crossplane.io unchanged
customresourcedefinition.apiextensions.k8s.io/providerconfigs.kubernetes.crossplane.io unchanged
customresourcedefinition.apiextensions.k8s.io/providerconfigusages.kubernetes.crossplane.io unchanged
go run cmd/provider/main.go -d
2024-05-21T10:39:11.395+0200	DEBUG	provider-kubernetes	Starting	{"sync-interval": "1h0m0s", "poll-interval": "10m0s", "poll-jitter": "1m0s", "max-reconcile-rate": 100}
2024-05-21T10:39:11.398+0200	INFO	provider-kubernetes	Beta feature enabled	{"flag": "EnableBetaManagementPolicies"}
main: error: Cannot start controller manager: open /tls/server/tls.crt: no such file or directory
exit status 1
make: *** [run] Error 1

How can we reproduce it?

run make target make run from main

@mad01 mad01 added the bug Something isn't working label May 21, 2024
@turkenh
Copy link
Collaborator

turkenh commented May 21, 2024

Unfortunately the steps there are outdated with some recent work.

Here is how I am currently testing/debugging locally (may not be the optimal way, but works fine):

# Creates a kind cluster named "local-dev", deploys crossplane, deploys a locally built provider-kubernetes
make local-deploy

# Stop Crossplane
kubectl -n crossplane-system scale deploy crossplane --replicas=0
# Stop provider-kubernetes running inside the cluster
kubectl -n crossplane-system scale deploy provider-kubernetes-provider-kub --replicas=0

# Fetch generated certs from cluster
./provider-kubernetes-fetch-certs.sh

# Start the provider
export TLS_CLIENT_CERTS_DIR=/tmp/provider-kubernetes/client-certs
export TLS_SERVER_CERTS_DIR=/tmp/provider-kubernetes/server-certs
go run cmd/provider/main.go -d

provider-kubernetes-fetch-certs.sh.zip

@lsviben
Copy link
Collaborator

lsviben commented May 21, 2024

Right, I think I introduced this bug with the conversion webhook, and either didnt notice or forgot about it.

Thanks @turkenh for the workaround. If I get free cycles I can take a look at incorporating that in the make run somehow

@mad01
Copy link
Author

mad01 commented May 21, 2024

here is a gist to how i use it. I had to add some notes on starting a port forward and the provider config setup that is in the readme. At the last step before starting the controller this is where you can pick goland or any other idea and start it from there instead if you like

https://gist.github.com/mad01/7f687b43c72357a0c88bb1b9f45b0f58

@jbw976
Copy link
Member

jbw976 commented May 22, 2024

breadcrumbs to crossplane/crossplane#5636 which looks related (similar error in make run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants