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

envtest with Kubernetes 1.20 #1357

Closed
cbandy opened this issue Jan 22, 2021 · 10 comments · Fixed by #1486
Closed

envtest with Kubernetes 1.20 #1357

cbandy opened this issue Jan 22, 2021 · 10 comments · Fixed by #1486
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@cbandy
Copy link
Contributor

cbandy commented Jan 22, 2021

There is a kubebuilder-tools-1.20.2 since kubernetes-sigs/kubebuilder@3147a65, but as pointed out in kubernetes-sigs/kubebuilder#1902 this version has stronger opinions about --insecure flags. See kubernetes/kubernetes@cfc2b33.

When I try to use controller-runtime@v0.8.1 with kubebuilder-tools-1.20.2, the control plane does not start:

Flag --insecure-port has been deprecated, This flag has no effect now and will be removed in v1.24.
Flag --insecure-bind-address has been deprecated, This flag has no effect now and will be removed in v1.24.
Error: invalid port value 56497: only zero is allowed
Flag --insecure-port has been deprecated, This flag has no effect now and will be removed in v1.24.
Flag --insecure-bind-address has been deprecated, This flag has no effect now and will be removed in v1.24.
Error: invalid port value 56497: only zero is allowed
Flag --insecure-port has been deprecated, This flag has no effect now and will be removed in v1.24.
Flag --insecure-bind-address has been deprecated, This flag has no effect now and will be removed in v1.24.
Error: invalid port value 56497: only zero is allowed
Flag --insecure-port has been deprecated, This flag has no effect now and will be removed in v1.24.
Flag --insecure-bind-address has been deprecated, This flag has no effect now and will be removed in v1.24.
Error: invalid port value 56497: only zero is allowed
Flag --insecure-port has been deprecated, This flag has no effect now and will be removed in v1.24.
Flag --insecure-bind-address has been deprecated, This flag has no effect now and will be removed in v1.24.
Error: invalid port value 56497: only zero is allowed

    test.go:37: failed to start the controlplane. retried 5 times: timeout waiting for process kube-apiserver to start
@alvaroaleman
Copy link
Member

Yeah, getting this fixed and not using insecure-port in envtest would be great. In addition to working with newer kube versions, it would also allow us to write tests that require rbac and not be implemented via the allow-all authorized that is used for the insecure port, xref #1346 (comment)

/help

@k8s-ci-robot
Copy link
Contributor

@alvaroaleman:
This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

Yeah, getting this fixed and not using insecure-port in envtest would be great. In addition to working with newer kube versions, it would also allow us to write tests that require rbac and not be implemented via the allow-all authorized that is used for the insecure port, xref #1346 (comment)

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Feb 16, 2021
@DirectXMan12
Copy link
Contributor

I'm poking at this now

/assign @DirectXMan12

@alvaroaleman
Copy link
Member

alvaroaleman commented Mar 15, 2021

@DirectXMan12 WDYT about merging #984 and building on top of that?

@DirectXMan12
Copy link
Contributor

lemme take a look

@DirectXMan12
Copy link
Contributor

hmmm... insecure just stops working in 1.20, and secure should work across all the versions we support, so I'd lean towards making stuff work by default, and making an optional switch to force insecure -- something like

type Environment struct {
  // ...
  
  // ForceInsecure forces communication to the API server to occur over the insecure port.
  // This will only work on API servers 1.19 and below.  It's recommended that you use
  // the default and communicate over the secure port.
  //
  // Deprecated: Only works with Kubernetes 1.19 and below, will be removed once those age out.
  ForceInsecure bool
}

@DirectXMan12
Copy link
Contributor

I think we can make this transparent by populating the rest.Config correctly and doing a bit more setup. It's still possibly a breaking change if people are constructing connections manually -- might want heavy beta testing for this one.

However, the alternative of forcing people to manually turn this on for the future or use different fields seems less ideal to me, I think.

@DirectXMan12
Copy link
Contributor

DirectXMan12 commented Mar 15, 2021

I'll poke around a bit. Lemme see what it actually looks like in practice

@alvaroaleman
Copy link
Member

alvaroaleman commented Mar 15, 2021

Great! Only one wish: lets please not use the AllowAll authorizer, because it makes it impossible to write tests where you need the apiserver to respond with a 403 for some apis only. We can still by default return a kubeconfig that has global admin perms, that still leaves the possibility of using impersonation for the 403 case.

@DirectXMan12
Copy link
Contributor

DirectXMan12 commented Mar 15, 2021

ack 👍 yeah, admin for a default case, plus a helper to produce non-admin users.

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.
Projects
None yet
4 participants