Controller-runtime: cannot specify ControlPlane in envtest.Environment

Created on 25 Mar 2020  路  11Comments  路  Source: kubernetes-sigs/controller-runtime

I think this issue is similar to https://github.com/kubernetes-sigs/controller-runtime/issues/841.

We have some code using envtest.Environment that has used the ControlPlane field to specify arguments for the APIServer and Etcd components:

After sigs.k8s.io/testing_frameworks/integration was moved into pkg/internal/testing/integration in #714, we can no longer do this:

use of internal package sigs.k8s.io/controller-runtime/pkg/internal/testing/integration not allowed

Is there a better way to be achieving this? Or was this unintentional?

good first issue help wanted kinbug prioritcritical-urgent

All 11 comments

This just needs a release. It was fixed in #846.

cc @DirectXMan12

@rajathagasthya no, this issue is different; #846 doesn't fix it.

We explicitly want to specify things like the apiserver host/port and etcd host/port.

We had been doing something like

env := &envtest.Environment {
  ControlPlane: &integration.ControlPlane{
    APIServer: &integration.APIServer{
      URL: apiserverURL,
      EtcdURL: etcdURL,
    },
    Etcd: &integration.Etcd{
      URL: etcdURL,
    },
  },
}

etc.

We can no longer do that, since integration.ControlPlane, integration.APIServer, and integration.Etcd are all in an internal package now.

Ah, sorry. I conflated this with the apiserver flags breakage. I don't think integration testing package should be in an internal package since many things there are customizable in an envtest environment. There are multiple breakages to envtest when testing framework was brought into controller-runtime and put into internal package.

cc @hoegaarden

Was this intentionally put under pkg/internal in #749?

agreed here -- those types shouldn't be internal. Sorry about that. I think all the shuffling around got things lost in translation.

FWIW, I think the intention was that some of the internal helpers were supposed to be in internal, while the public types stayed exposed externally. The goal was to eventually unify our Environment with th e testing-frameworks config to avoid duplication, but we're not there yet, so re-exposing those types seems like a good idea.

/good-first-issue

should be an easy fix -- just re-export these types.

@DirectXMan12:
This request has been marked as suitable for new contributors.

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-good-first-issue command.

In response to this:

/good-first-issue

should be an easy fix -- just re-export these types.

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.

/priority critical-urgent
/kind bug

/assign

Was this page helpful?
0 / 5 - 0 ratings