Documentation ¶
Index ¶
- func AssertManifestExistence(ctx context.Context, c client.Client, manifestYAML string, ...)
- func AssertOwnerRef(o client.Object, owner client.Object, scheme *runtime.Scheme)
- func AssertOwnerRefWithGomega(o client.Object, owner client.Object, scheme *runtime.Scheme, g gomega.Gomega)
- func AssertRedditLabels(o client.Object, controllerName string)
- func AssertRedditLabelsWithGomega(o client.Object, controllerName string, g gomega.Gomega)
- func ConditionsEqual(c, other api.Condition) bool
- func ExternalCRDDirectoryPaths(pkgToCRDDir map[string][]string, rootDir string) ([]string, error)
- func GenerateRandomString(length int) string
- func KubeConfigBytesFromREST(cfg *rest.Config) ([]byte, error)
- func KubeConfigFromREST(cfg *rest.Config) (*kcapi.Config, error)
- func MatchConditionedStatus(expected interface{}) types.GomegaMatcher
- func ModuleDir(pkg string, rootDir string) (string, error)
- func MustParseBool(envVarName string) bool
- func NewReadyConditionForTest(conditions ...api.Condition) api.Condition
- func NewReadyConditionForTestWithObservedGeneration(obsGen int64, conditions ...api.Condition) api.Condition
- type ClientFilter
- type EnvTestBuilder
- func (b *EnvTestBuilder) Start() (_ *TestEnv, rerr error)
- func (b *EnvTestBuilder) WithCRDDirectoryPaths(paths []string) *EnvTestBuilder
- func (b *EnvTestBuilder) WithKubeConfigFile(path string) *EnvTestBuilder
- func (b *EnvTestBuilder) WithLog(log *zap.Logger) *EnvTestBuilder
- func (b *EnvTestBuilder) WithManagerOpts(opts ctrl.Options) *EnvTestBuilder
- func (b *EnvTestBuilder) WithManagerSetupFns(fns ...ManagerSetupFn) *EnvTestBuilder
- func (b *EnvTestBuilder) WithManagerUser(user envtest.User) *EnvTestBuilder
- func (b *EnvTestBuilder) WithScheme(scheme *runtime.Scheme) *EnvTestBuilder
- func (b *EnvTestBuilder) WithWebhookConfigs(configPaths ...string) *EnvTestBuilder
- type FilterFn
- type FilteringClient
- type ManagerSetupFn
- type TestEnv
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertManifestExistence ¶
func AssertManifestExistence( ctx context.Context, c client.Client, manifestYAML string, timeout time.Duration, pollingInterval time.Duration, )
AssertManifestExistence asserts the existence of all objects in a YAML manifest on the kube-apiserver referenced by the given client. Does not check object data.
func AssertOwnerRef ¶
AssertOwnerRef asserts that the provided object has an owner reference that references the provided owner.
func AssertOwnerRefWithGomega ¶
func AssertOwnerRefWithGomega(o client.Object, owner client.Object, scheme *runtime.Scheme, g gomega.Gomega)
AssertOwnerRefWithGomega is the same as AssertOwnerRef but accepts a Gomega instance, useful for using inside Eventually/Consistently blocks.
func AssertRedditLabels ¶
AssertRedditLabels asserts expected Reddit labels on the provided object.
func AssertRedditLabelsWithGomega ¶
AssertRedditLabelsWithGomega is the same as AssertRedditLabels but accepts a Gomega instance, useful for using inside Eventually/Consistently blocks.
func ConditionsEqual ¶
ConditionsEqual compares two api.Condition structs for equality. It mimics the behavior of api.Condition.Equal, but does not compare the ObservedGeneration field.
func ExternalCRDDirectoryPaths ¶
ExternalCRDDirectoryPaths returns a list of paths of CRD directories given a mapping of pkg names to relative CRD directories
func GenerateRandomString ¶
func KubeConfigBytesFromREST ¶
KubeConfigBytesFromREST reverse-engineers a kubeconfig file from a rest.Config. The options are tailored towards the rest.Configs we generate, so they're not broadly applicable.
This is not intended to be exposed beyond internal for the above reasons.
func MatchConditionedStatus ¶
func MatchConditionedStatus(expected interface{}) types.GomegaMatcher
MatchConditionedStatus uses custom equality logic for the ConditionedStatus field, and reflect.DeepEqual for all other fields.
func ModuleDir ¶
ModuleDir returns the absolute path for the module containing the provided package.
func MustParseBool ¶
func NewReadyConditionForTest ¶
NewReadyConditionForTest creates a new Ready condition for testing purposes. It sets the observed generation to 0.
func NewReadyConditionForTestWithObservedGeneration ¶
func NewReadyConditionForTestWithObservedGeneration(obsGen int64, conditions ...api.Condition) api.Condition
NewReadyConditionForTestWithObservedGeneration creates a new Ready condition for testing purposes. It sets the observed generation to the provided value.
Types ¶
type EnvTestBuilder ¶
type EnvTestBuilder struct {
// contains filtered or unexported fields
}
func NewEnvTestBuilder ¶
func NewEnvTestBuilder(ctx context.Context) *EnvTestBuilder
func (*EnvTestBuilder) Start ¶
func (b *EnvTestBuilder) Start() (_ *TestEnv, rerr error)
Start starts the test environment. The caller must call TestEnv.Stop to shut down the environment.
func (*EnvTestBuilder) WithCRDDirectoryPaths ¶
func (b *EnvTestBuilder) WithCRDDirectoryPaths(paths []string) *EnvTestBuilder
func (*EnvTestBuilder) WithKubeConfigFile ¶
func (b *EnvTestBuilder) WithKubeConfigFile(path string) *EnvTestBuilder
WithKubeConfigFile enables writing the envtest kube-apiserver kubeconfig to a file at the given path
func (*EnvTestBuilder) WithLog ¶
func (b *EnvTestBuilder) WithLog(log *zap.Logger) *EnvTestBuilder
WithLog overrides the default logger used with the controller manager.
func (*EnvTestBuilder) WithManagerOpts ¶
func (b *EnvTestBuilder) WithManagerOpts(opts ctrl.Options) *EnvTestBuilder
WithManagerOpts sets the manager options with which to initialize the manager.
func (*EnvTestBuilder) WithManagerSetupFns ¶
func (b *EnvTestBuilder) WithManagerSetupFns(fns ...ManagerSetupFn) *EnvTestBuilder
func (*EnvTestBuilder) WithManagerUser ¶
func (b *EnvTestBuilder) WithManagerUser(user envtest.User) *EnvTestBuilder
WithManagerUser sets the Kubernetes user that the manager is authorized as
func (*EnvTestBuilder) WithScheme ¶
func (b *EnvTestBuilder) WithScheme(scheme *runtime.Scheme) *EnvTestBuilder
WithScheme sets the scheme that will be used for the client and manager (if enabled)
func (*EnvTestBuilder) WithWebhookConfigs ¶
func (b *EnvTestBuilder) WithWebhookConfigs(configPaths ...string) *EnvTestBuilder
WithWebhookConfigs wires up validating or mutating admission webhook configurations specified by the resources residing in the provided path.
type FilteringClient ¶
func NewFilteringClient ¶
func NewFilteringClient(c client.WithWatch, f ...ClientFilter) *FilteringClient
func (*FilteringClient) Create ¶
func (c *FilteringClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (*FilteringClient) Status ¶
func (c *FilteringClient) Status() client.SubResourceWriter
func (*FilteringClient) Update ¶
func (c *FilteringClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error