KonfigKonnector has configuration values needed for installing & configuring K8s config connector
var KonfigKonnector struct { APIKey string `description:"path to key.json for service account that will be used with k8s cfg connector, required for non-GKE test runs"` ServiceAccount string `description:"service account name to use when configurng k8s cfg connector on GKE via workload identity"` }
Runtime has configuration values related to the cluster runtime
var Runtime struct { GKE bool `default:"false" description:"whether or not the test is being ran against a GKE cluster"` }
Timeouts has configuration values for K8s specific timeouts
var Timeouts struct { DefaultTimeout time.Duration `default:"30s" description:"default timeout for k8s operations"` Tick time.Duration `default:"1s" description:"default tick interval for k8s operations to be retried"` InstallTimeout time.Duration `default:"60s" description:"default timeout for installing components"` }
func ConfigMap(k client.ObjectKey, data map[string]string) *corev1.ConfigMap
ConfigMap is a helper for creating corev1.ConfigMap resources
func CreateTestPod(name string, namespace string, args []string, image string, registry ...string) *corev1.Pod
Create pod object that runs the specified args in the test cluster. Registry parameter defaults to "localhost:21700" if nothing is input, otherwise it uses the first input value.
func FieldManagerOwner(f *framework.Framework) sap.Owner
FieldManagerOwner creates a consistent ownership key for resource fields that are created/updated by test framework code. The unique name for the test run is used in conjunction with a framework constant to provide scope.
func InstallOpts() []install.Option
InstallOpts returns consistent server-side apply options based on the configured framework timeouts. These options should be used for all of the apply operations
func Namespace(name string) *corev1.Namespace
func NeedsKonfigKonnector(f *framework.Framework)
NeedsKonfigKonnector is a function that can be hooked in as a framework.Step so that test suites which require K8s cfg connector for integration tests are automatically skipped if the pre-reqs aren't provided. Only skips if the test is an integration test.
func ProcessManifest(manifest *unstructured.Unstructured, namespace string) (err error)
update manifest to set unique namespace and update associated role bindings
func Secret(k client.ObjectKey, data map[string]string) *corev1.Secret
K8s implements framework.SubFramework and provides lifecycle utilities for integration tests that run on K8s clusters.
type K8s struct { Namespace string Client client.Client // contains filtered or unexported fields }
func New(cfg *rest.Config, opts ...Option) *K8s
New creates a K8s framework
func (k *K8s) FindPodLogs(ctx context.Context, podname string, namespace string) (io.ReadCloser, error)
Return a stream of the Pod logs for a given pod in a namespace
func (k *K8s) RESTConfig() *rest.Config
func (k *K8s) SetupWithFramework(f *framework.Framework)
SetupWithFramework registers the called instance of K8s with the provided Framework, setting up lifecycle hooks and framework metadata.
Option is used to expose public optional K8s configurations. It should generally only be used to change non-public members of the K8s struct
type Option func(*K8s)
func SkipNamespaceCreation() Option
SkipNamespaceCreation will make the framework skip creation of a namespace for each test case. Useful for tests that don't operate against any Namespaced resources.
func WithCertManager() Option
WithCertManager ensures that cert-manager is installed for the test run.
func WithCtrlManager(mgr manager.Manager) Option
WithCtrlManager sets up the framework for testing a controller-runtime Manager
func WithKonfigKonnector() Option
WithKonfigKonnector controls whether or not K8s config connector is installed and configured for the test run.