Documentation
¶
Index ¶
- func ImplementWebhooks(filename, _ string) error
- type CmdContext
- type Kubectl
- func (k *Kubectl) Apply(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Command(cmdOptions ...string) (string, error)
- func (k *Kubectl) CommandInNamespace(cmdOptions ...string) (string, error)
- func (k *Kubectl) Delete(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Get(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) Logs(cmdOptions ...string) (string, error)
- func (k *Kubectl) Version() (ver KubernetesVersion, err error)
- func (k *Kubectl) Wait(inNamespace bool, cmdOptions ...string) (string, error)
- func (k *Kubectl) WithInput(stdinInput string) *Kubectl
- type KubernetesVersion
- type TestContext
- func (t *TestContext) AllowProjectBeMultiGroup() error
- func (t *TestContext) CreateAPI(resourceOptions ...string) error
- func (t *TestContext) CreateManagerNamespace() error
- func (t *TestContext) CreateWebhook(resourceOptions ...string) error
- func (t *TestContext) Destroy()
- func (t *TestContext) Edit(editOptions ...string) error
- func (t *TestContext) EditHelmPlugin() error
- func (t *TestContext) HelmInstallRelease() error
- func (t *TestContext) HelmInstallReleaseWithOptions(crdKeep bool) error
- func (t *TestContext) HelmUpgradeReleaseWithReplicas(replicas int) error
- func (t *TestContext) Init(initOptions ...string) error
- func (t *TestContext) InstallCertManager() error
- func (t *TestContext) InstallHelm() error
- func (t *TestContext) InstallPrometheusOperManager() error
- func (t *TestContext) LabelNamespacesToEnforceRestricted() error
- func (t *TestContext) LoadImageToKindCluster() error
- func (t TestContext) LoadImageToKindClusterWithName(image string) error
- func (t *TestContext) Make(makeOptions ...string) error
- func (t *TestContext) Prepare() error
- func (t *TestContext) Regenerate(resourceOptions ...string) error
- func (t *TestContext) RemoveNamespaceLabelToEnforceRestricted() error
- func (t *TestContext) Tidy() error
- func (t *TestContext) UninstallCertManager()
- func (t *TestContext) UninstallHelmRelease() error
- func (t *TestContext) UninstallPrometheusOperManager()
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImplementWebhooks ¶ added in v4.2.0
ImplementWebhooks will mock an webhook data
Types ¶
type CmdContext ¶
type CmdContext struct {
// environment variables in k=v format.
Env []string
Dir string
Stdin io.Reader
}
CmdContext provides context for command execution
type Kubectl ¶
type Kubectl struct {
*CmdContext
Namespace string
ServiceAccount string
}
Kubectl contains context to run kubectl commands
func (*Kubectl) CommandInNamespace ¶
CommandInNamespace is a general func to run kubectl commands in the namespace
func (*Kubectl) Version ¶
func (k *Kubectl) Version() (ver KubernetesVersion, err error)
Version is a func to run kubectl version command
type KubernetesVersion ¶
type KubernetesVersion struct {
ClientVersion VersionInfo `json:"clientVersion,omitempty"`
ServerVersion VersionInfo `json:"serverVersion,omitempty"`
}
KubernetesVersion holds a subset of both client and server versions.
type TestContext ¶
type TestContext struct {
*CmdContext
TestSuffix string
Domain string
Group string
Version string
Kind string
Resources string
ImageName string
BinaryName string
Kubectl *Kubectl
K8sVersion *KubernetesVersion
IsRestricted bool
}
TestContext specified to run e2e tests
func NewTestContext ¶
func NewTestContext(binaryName string, env ...string) (*TestContext, error)
NewTestContext init with a random suffix for test TestContext stuff, to avoid conflict when running tests synchronously.
func (*TestContext) AllowProjectBeMultiGroup ¶
func (t *TestContext) AllowProjectBeMultiGroup() error
AllowProjectBeMultiGroup will update the PROJECT file with the information to allow we scaffold apis with different groups. be available.
func (*TestContext) CreateAPI ¶
func (t *TestContext) CreateAPI(resourceOptions ...string) error
CreateAPI is for running `kubebuilder create api`
func (*TestContext) CreateManagerNamespace ¶
func (t *TestContext) CreateManagerNamespace() error
CreateManagerNamespace will create the namespace where the manager is deployed
func (*TestContext) CreateWebhook ¶
func (t *TestContext) CreateWebhook(resourceOptions ...string) error
CreateWebhook is for running `kubebuilder create webhook`
func (*TestContext) Destroy ¶
func (t *TestContext) Destroy()
Destroy is for cleaning up the docker images for testing
func (*TestContext) Edit ¶
func (t *TestContext) Edit(editOptions ...string) error
Edit is for running `kubebuilder edit`
func (*TestContext) EditHelmPlugin ¶ added in v4.4.0
func (t *TestContext) EditHelmPlugin() error
EditHelmPlugin is for running `kubebuilder edit --plugins=helm.kubebuilder.io/v2-alpha`
func (*TestContext) HelmInstallRelease ¶ added in v4.4.0
func (t *TestContext) HelmInstallRelease() error
HelmInstallRelease is for running `helm install` Uses the chart name (project name) as the release name, which is standard Helm practice. When release name matches chart name, chart.fullname simplifies to just the chart name, preserving kustomize resource naming.
func (*TestContext) HelmInstallReleaseWithOptions ¶ added in v4.12.0
func (t *TestContext) HelmInstallReleaseWithOptions(crdKeep bool) error
HelmInstallReleaseWithOptions is for running `helm install` with configurable options crdKeep controls whether CRDs are preserved on helm uninstall (helm.sh/resource-policy: keep)
func (*TestContext) HelmUpgradeReleaseWithReplicas ¶ added in v4.13.0
func (t *TestContext) HelmUpgradeReleaseWithReplicas(replicas int) error
HelmUpgradeReleaseWithReplicas runs `helm upgrade` with manager.replicas set. Uses --reuse-values so existing image and other settings are preserved.
func (*TestContext) Init ¶
func (t *TestContext) Init(initOptions ...string) error
Init is for running `kubebuilder init`
func (*TestContext) InstallCertManager ¶
func (t *TestContext) InstallCertManager() error
InstallCertManager installs the cert manager bundle.
func (*TestContext) InstallHelm ¶ added in v4.4.0
func (t *TestContext) InstallHelm() error
InstallHelm installs Helm in the e2e server.
func (*TestContext) InstallPrometheusOperManager ¶
func (t *TestContext) InstallPrometheusOperManager() error
InstallPrometheusOperManager installs the prometheus manager bundle.
func (*TestContext) LabelNamespacesToEnforceRestricted ¶ added in v4.4.0
func (t *TestContext) LabelNamespacesToEnforceRestricted() error
LabelNamespacesToEnforceRestricted will label specified namespaces so that we can verify if the manifests can be applied in restricted environments with strict security policy enforced
func (*TestContext) LoadImageToKindCluster ¶
func (t *TestContext) LoadImageToKindCluster() error
LoadImageToKindCluster loads a local docker image to the kind cluster
func (TestContext) LoadImageToKindClusterWithName ¶
func (t TestContext) LoadImageToKindClusterWithName(image string) error
LoadImageToKindClusterWithName loads a local docker image with the name informed to the kind cluster
func (*TestContext) Make ¶
func (t *TestContext) Make(makeOptions ...string) error
Make is for running `make` with various targets
func (*TestContext) Prepare ¶
func (t *TestContext) Prepare() error
Prepare prepares the test environment.
func (*TestContext) Regenerate ¶
func (t *TestContext) Regenerate(resourceOptions ...string) error
Regenerate is for running `kubebuilder alpha generate`
func (*TestContext) RemoveNamespaceLabelToEnforceRestricted ¶ added in v4.4.0
func (t *TestContext) RemoveNamespaceLabelToEnforceRestricted() error
RemoveNamespaceLabelToEnforceRestricted will remove the `pod-security.kubernetes.io/enforce` label from the specified namespace
func (*TestContext) Tidy ¶
func (t *TestContext) Tidy() error
Tidy runs `go mod tidy` so that go 1.16 build doesn't fail. See https://blog.golang.org/go116-module-changes#TOC_3.
func (*TestContext) UninstallCertManager ¶
func (t *TestContext) UninstallCertManager()
UninstallCertManager uninstalls the cert manager bundle.
func (*TestContext) UninstallHelmRelease ¶ added in v4.4.0
func (t *TestContext) UninstallHelmRelease() error
UninstallHelmRelease removes the specified Helm release from the cluster. Uses the chart name (project name) as the release name, which is standard Helm practice. Note: With crd.keep=true (default), CRDs are preserved after uninstall. Use DeleteCRDs() to clean them up after verifying they persisted.
func (*TestContext) UninstallPrometheusOperManager ¶
func (t *TestContext) UninstallPrometheusOperManager()
UninstallPrometheusOperManager uninstalls the prometheus manager bundle.
type VersionInfo ¶
type VersionInfo struct {
Major string `json:"major"`
Minor string `json:"minor"`
GitVersion string `json:"gitVersion"`
// contains filtered or unexported fields
}
VersionInfo holds a subset of client/server version information.
func (VersionInfo) GetMajorInt ¶
func (vi VersionInfo) GetMajorInt() uint64
GetMajorInt returns the uint64 representation of vi.Major.
func (VersionInfo) GetMinorInt ¶
func (vi VersionInfo) GetMinorInt() uint64
GetMinorInt returns the uint64 representation of vi.Minor.