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

Cannot use var APIServerDefaultArgs #841

Closed
kfyharukz opened this issue Mar 6, 2020 · 4 comments · Fixed by #846
Closed

Cannot use var APIServerDefaultArgs #841

kfyharukz opened this issue Mar 6, 2020 · 4 comments · Fixed by #846
Assignees

Comments

@kfyharukz
Copy link

Description

I tried to run envtest's API Server with appending extra API server flags to default API server flags.

However, DefaultKubeAPIServerFlags in pkg/envtest/server.go disappeared and APIServerDefaultArgs in sigs.k8s.io/controller-runtime/pkg/internal/testing/integration is cannot imported because it is an internal package.
https://github.com/kubernetes-sigs/controller-runtime/pull/763/files

How can I resolve it? or should APIServerDefaultArgs be exposed?

Environment

controller-runtime v0.5.0

@djzager
Copy link
Contributor

djzager commented Mar 6, 2020

@kfyharukz I think the kubebuilder book covers this here including here in case url's change in the future.

Here’s an example of modifying the flags with which to start the API server in your integration tests, compared to the default values in envtest.DefaultKubeAPIServerFlags:

customApiServerFlags := []string{
    "--secure-port=6884",
    "--admission-control=MutatingAdmissionWebhook",
}

apiServerFlags := append([]string(nil), envtest.DefaultKubeAPIServerFlags...)
apiServerFlags = append(apiServerFlags, customApiServerFlags...)

testEnv = &envtest.Environment{
    CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
    KubeAPIServerFlags: apiServerFlags,
}

@kfyharukz
Copy link
Author

@djzager Thank you for your reply!
I used almost the same codes as gitbook. However, envtest.DefaultKubeAPIServerFlags does not exist in controller-runtime v0.5.0 (maybe because this PR, so currently my code does not work...

@djzager
Copy link
Contributor

djzager commented Mar 9, 2020

You are right. APIServerDefaultARgs is no longer accessible and I don't see any way for you to modify the example from the kubebuilder book to make it work (ie. add some custom arguments to the default flags).

@djzager
Copy link
Contributor

djzager commented Mar 9, 2020

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants