Skip to content

Commit

Permalink
Update to use new internal/testing paths
Browse files Browse the repository at this point in the history
This updates envtests, etc to use to the new refactored
internal/testing/xyz paths (certs, addr, controlplane).
  • Loading branch information
DirectXMan12 committed May 25, 2021
1 parent 9d53bf1 commit 294af4f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pkg/builder/builder_suite_test.go
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/addr"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/addr"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics"
Expand Down
22 changes: 11 additions & 11 deletions pkg/envtest/server.go
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/integration"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane"

logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
)
Expand Down Expand Up @@ -82,20 +82,20 @@ func (te *Environment) getBinAssetPath(binary string) string {
return filepath.Join(defaultKubebuilderPath, binary)
}

// ControlPlane is the re-exported ControlPlane type from the internal integration package
type ControlPlane = integration.ControlPlane
// ControlPlane is the re-exported ControlPlane type from the internal testing package
type ControlPlane = controlplane.ControlPlane

// APIServer is the re-exported APIServer type from the internal integration package
type APIServer = integration.APIServer
// APIServer is the re-exported APIServer type from the internal testing package
type APIServer = controlplane.APIServer

// Etcd is the re-exported Etcd type from the internal integration package
type Etcd = integration.Etcd
// Etcd is the re-exported Etcd type from the internal testing package
type Etcd = controlplane.Etcd

// Environment creates a Kubernetes test environment that will start / stop the Kubernetes control plane and
// install extension APIs
type Environment struct {
// ControlPlane is the ControlPlane including the apiserver and etcd
ControlPlane integration.ControlPlane
ControlPlane controlplane.ControlPlane

// Scheme is used to determine if conversion webhooks should be enabled
// for a particular CRD / object.
Expand Down Expand Up @@ -219,10 +219,10 @@ func (te *Environment) Start() (*rest.Config, error) {
}
} else {
if te.ControlPlane.APIServer == nil {
te.ControlPlane.APIServer = &integration.APIServer{Args: te.getAPIServerFlags()}
te.ControlPlane.APIServer = &controlplane.APIServer{Args: te.getAPIServerFlags()}
}
if te.ControlPlane.Etcd == nil {
te.ControlPlane.Etcd = &integration.Etcd{}
te.ControlPlane.Etcd = &controlplane.Etcd{}
}

if os.Getenv(envAttachOutput) == "true" {
Expand Down Expand Up @@ -357,4 +357,4 @@ func (te *Environment) useExistingCluster() bool {

// DefaultKubeAPIServerFlags exposes the default args for the APIServer so that
// you can use those to append your own additional arguments.
var DefaultKubeAPIServerFlags = integration.APIServerDefaultArgs
var DefaultKubeAPIServerFlags = controlplane.APIServerDefaultArgs
6 changes: 3 additions & 3 deletions pkg/envtest/webhook.go
Expand Up @@ -33,8 +33,8 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/integration"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/integration/addr"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/addr"
"sigs.k8s.io/controller-runtime/pkg/internal/testing/certs"
"sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -274,7 +274,7 @@ func (p *webhookPoller) poll() (done bool, err error) {

// setupCA creates CA for testing and writes them to disk
func (o *WebhookInstallOptions) setupCA() error {
hookCA, err := integration.NewTinyCA()
hookCA, err := certs.NewTinyCA()
if err != nil {
return fmt.Errorf("unable to set up webhook CA: %v", err)
}
Expand Down

0 comments on commit 294af4f

Please sign in to comment.