Skip to content

Commit d50546c

Browse files
committed
Expose some internal types/funcs in envtest
This exposes a few pieces of the new APIs in internal/testing as public in envtest. These types are effectively part of public APIs (they're referenced by public methods or fields of APIServer, ControlPlane, etc), so we should let users name them.
1 parent 76804ac commit d50546c

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

pkg/envtest/server.go

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,49 @@ const (
5757
defaultKubebuilderControlPlaneStopTimeout = 20 * time.Second
5858
)
5959

60-
// ControlPlane is the re-exported ControlPlane type from the internal integration package
61-
type ControlPlane = controlplane.ControlPlane
60+
// internal types we expose as part of our public API
6261

63-
// APIServer is the re-exported APIServer type from the internal integration package
64-
type APIServer = controlplane.APIServer
62+
type (
63+
// ControlPlane is the re-exported ControlPlane type from the internal integration package
64+
ControlPlane = controlplane.ControlPlane
6565

66-
// Etcd is the re-exported Etcd type from the internal integration package
67-
type Etcd = controlplane.Etcd
66+
// APIServer is the re-exported APIServer from the internal integration package
67+
APIServer = controlplane.APIServer
6868

69-
// User represents a Kubernetes user to provision for auth purposes.
70-
type User = controlplane.User
69+
// Etcd is the re-exported Etcd from the internal integration package
70+
Etcd = controlplane.Etcd
7171

72-
// AuthenticatedUser represets a Kubernetes user that's been provisioned.
73-
type AuthenticatedUser = controlplane.AuthenticatedUser
72+
// User represents a Kubernetes user to provision for auth purposes.
73+
User = controlplane.User
74+
75+
// AuthenticatedUser represets a Kubernetes user that's been provisioned.
76+
AuthenticatedUser = controlplane.AuthenticatedUser
77+
78+
// ListenAddr indicates the address and port that the API server should listen on.
79+
ListenAddr = process.ListenAddr
80+
81+
// SecureServing contains details describing how the API server should serve
82+
// its secure endpoint.
83+
SecureServing = controlplane.SecureServing
84+
85+
// Authn is an authentication method that can be used with the control plane to
86+
// provision users.
87+
Authn = controlplane.Authn
88+
89+
// Arguments allows configuring a process's flags.
90+
Arguments = process.Arguments
91+
92+
// Arg is a single flag with one or more values.
93+
Arg = process.Arg
94+
)
95+
96+
var (
97+
// EmptyArguments constructs a new set of flags with nothing set.
98+
//
99+
// This is mostly useful for testing helper methods -- you'll want to call
100+
// Configure on the APIServer (or etcd) to configure their arguments.
101+
EmptyArguments = process.EmptyArguments()
102+
)
74103

75104
// Environment creates a Kubernetes test environment that will start / stop the Kubernetes control plane and
76105
// install extension APIs

pkg/internal/testing/controlplane/apiserver.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
"sigs.k8s.io/controller-runtime/pkg/internal/testing/process"
1616
)
1717

18-
// TODO: listenaddr needs to be exposes publically so we can set insecureserving
19-
2018
const (
2119
// saKeyFile is the name of the service account signing private key file
2220
saKeyFile = "sa-signer.key"

0 commit comments

Comments
 (0)