Documentation
¶
Index ¶
- Constants
- Variables
- func AppendPluginDefinitionPluginOption(option greenhousev1alpha1.PluginOption) func(*greenhousev1alpha1.PluginDefinition)
- func AppendPluginOption(option greenhousev1alpha1.PluginOption) func(*greenhousev1alpha1.ClusterPluginDefinition)
- func EventuallyCreated(ctx context.Context, c client.Client, obj client.Object)
- func EventuallyDeleted(ctx context.Context, c client.Client, obj client.Object)
- func GreenhouseV1Alpha1Scheme() *runtime.Scheme
- func KubeconfigFromEnvVar(envVar string) ([]byte, error)
- func MockHelmChartReady(ctx context.Context, k8sClient client.Client, ...)
- func MustDeleteCluster(ctx context.Context, c client.Client, cluster *greenhousev1alpha1.Cluster)
- func MustRemoveAnnotation(ctx context.Context, c client.Client, o client.Object, key string)
- func MustRemoveLabel(ctx context.Context, c client.Client, o client.Object, key string)
- func MustReturnJSONFor(val any) *apiextensionsv1.JSON
- func MustSetAnnotation(ctx context.Context, c client.Client, o client.Object, key, value string)
- func MustSetAnnotations(ctx context.Context, c client.Client, o client.Object, ...)
- func NewCatalog(name, namespace string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
- func NewCatalogSource(opts ...func(source *greenhousev1alpha1.CatalogSource)) greenhousev1alpha1.CatalogSource
- func NewCluster(ctx context.Context, name, namespace string, ...) *greenhousev1alpha1.Cluster
- func NewClusterPluginDefinition(ctx context.Context, name string, ...) *greenhousev1alpha1.ClusterPluginDefinition
- func NewConfigMap(name, namespace string, opts ...func(*corev1.ConfigMap)) *corev1.ConfigMap
- func NewOrganization(ctx context.Context, name string, ...) *greenhousev1alpha1.Organization
- func NewPlugin(ctx context.Context, name, namespace string, ...) *greenhousev1alpha1.Plugin
- func NewPluginDefinition(ctx context.Context, name, namespace string, ...) *greenhousev1alpha1.PluginDefinition
- func NewPluginPreset(name, namespace string, opts ...func(*greenhousev1alpha1.PluginPreset)) *greenhousev1alpha1.PluginPreset
- func NewSecret(name, namespace string, opts ...func(*corev1.Secret)) *corev1.Secret
- func NewTeam(ctx context.Context, name, namespace string, ...) *greenhousev1alpha1.Team
- func NewTeamRole(ctx context.Context, name, namespace string, ...) *greenhousev1alpha1.TeamRole
- func NewTeamRoleBinding(ctx context.Context, name, namespace string, ...) *greenhousev1alpha2.TeamRoleBinding
- func RegisterController(controllerName string, f registerControllerFunc)
- func RegisterWebhook(webhookName string, f registerWebhookFunc)
- func SetClusterReadyCondition(ctx context.Context, c client.Client, cluster *greenhousev1alpha1.Cluster, ...) error
- func SetOptionValueForPlugin(plugin *greenhousev1alpha1.Plugin, key, value string)
- func StartControlPlane(port string, installCRDs, installWebhooks bool) (*rest.Config, client.Client, *envtest.Environment, []byte)
- func UnregisterController(controllerName string)
- func UnregisterWebhook(webhookName string)
- func UpdateClusterWithDeletionAnnotation(ctx context.Context, c client.Client, cluster *greenhousev1alpha1.Cluster) *greenhousev1alpha1.Cluster
- func WithAccessMode(mode greenhousev1alpha1.ClusterAccessMode) func(*greenhousev1alpha1.Cluster)
- func WithAdditionalRedirects(additionalRedirects ...string) func(organization *greenhousev1alpha1.Organization)
- func WithAggregationRule(aggregationRule *rbacv1.AggregationRule) func(*greenhousev1alpha1.TeamRole)
- func WithCatalogResources(resources []string) func(source *greenhousev1alpha1.CatalogSource)
- func WithCluster(cluster string) func(*greenhousev1alpha1.Plugin)
- func WithClusterAnnotations(annotations map[string]string) func(*greenhousev1alpha1.Cluster)
- func WithClusterLabel(key, value string) func(*greenhousev1alpha1.Cluster)
- func WithClusterName(clusterName string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithClusterOverride(clusterName string, optionValues []greenhousev1alpha1.PluginOptionValue) func(*greenhousev1alpha1.PluginPreset)
- func WithClusterPluginDefinition(pluginDefinition string) func(*greenhousev1alpha1.Plugin)
- func WithClusterSelector(selector metav1.LabelSelector) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithConfigMapData(data map[string]string) func(*corev1.ConfigMap)
- func WithConfigMapLabels(labels map[string]string) func(*corev1.ConfigMap)
- func WithConfigMapRef(configMapRef string) func(*greenhousev1alpha1.Organization)
- func WithCreateNamespace(createNamespaces bool) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithHelmChart(chart *greenhousev1alpha1.HelmChartReference) func(*greenhousev1alpha1.ClusterPluginDefinition)
- func WithLabels(labels map[string]string) func(*greenhousev1alpha1.TeamRole)
- func WithMappedAdminIDPGroup(group string) func(*greenhousev1alpha1.Organization)
- func WithMappedIDPGroup(group string) func(*greenhousev1alpha1.Team)
- func WithMaxTokenValidity(maxTokenValidity int32) func(*greenhousev1alpha1.Cluster)
- func WithNamespaces(namespaces ...string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithOIDCConfig(issuer, secretName, clientIDKey, clientSecretKey string) func(*greenhousev1alpha1.Organization)
- func WithOrgAnnotations(annotations map[string]string) func(*greenhousev1alpha1.Organization)
- func WithOverrides(overrides []greenhousev1alpha1.CatalogOverrides) func(source *greenhousev1alpha1.CatalogSource)
- func WithPluginDefinition(pluginDefinition string) func(*greenhousev1alpha1.Plugin)
- func WithPluginDefinitionHelmChart(chart *greenhousev1alpha1.HelmChartReference) func(*greenhousev1alpha1.PluginDefinition)
- func WithPluginDefinitionUIApplication(ui *greenhousev1alpha1.UIApplicationReference) func(*greenhousev1alpha1.PluginDefinition)
- func WithPluginDefinitionVersion(version string) func(*greenhousev1alpha1.PluginDefinition)
- func WithPluginDeletionPolicy(deletionPolicy string) func(*greenhousev1alpha1.Plugin)
- func WithPluginLabel(key, value string) func(*greenhousev1alpha1.Plugin)
- func WithPluginOptionValue(name string, value *apiextensionsv1.JSON) func(*greenhousev1alpha1.Plugin)
- func WithPluginOptionValueExpression(name string, expression *string) func(*greenhousev1alpha1.Plugin)
- func WithPluginOptionValueFrom(name string, valueFrom *greenhousev1alpha1.PluginValueFromSource) func(*greenhousev1alpha1.Plugin)
- func WithPluginOptionValueFromRef(name string, ref *greenhousev1alpha1.ExternalValueSource) func(*greenhousev1alpha1.Plugin)
- func WithPluginPresetAnnotation(key, value string) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginPresetClusterSelector(clusterSelector metav1.LabelSelector) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginPresetDeletionPolicy(deletionPolicy string) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginPresetLabel(key, value string) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginPresetPluginSpec(pluginSpec greenhousev1alpha1.PluginSpec) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginPresetWaitFor(waitFor greenhousev1alpha1.WaitForItem) func(*greenhousev1alpha1.PluginPreset)
- func WithPluginWaitFor(waitFor []greenhousev1alpha1.WaitForItem) func(*greenhousev1alpha1.Plugin)
- func WithPresetLabelValue(value string) func(*greenhousev1alpha1.Plugin)
- func WithReleaseName(releaseName string) func(*greenhousev1alpha1.Plugin)
- func WithReleaseNamespace(releaseNamespace string) func(*greenhousev1alpha1.Plugin)
- func WithRepository(url string) func(source *greenhousev1alpha1.CatalogSource)
- func WithRepositoryBranch(branch string) func(source *greenhousev1alpha1.CatalogSource)
- func WithRepositorySHA(sha string) func(source *greenhousev1alpha1.CatalogSource)
- func WithRepositoryTag(tag string) func(source *greenhousev1alpha1.CatalogSource)
- func WithRules(rules []rbacv1.PolicyRule) func(*greenhousev1alpha1.TeamRole)
- func WithSecretAnnotations(annotations map[string]string) func(*corev1.Secret)
- func WithSecretData(data map[string][]byte) func(*corev1.Secret)
- func WithSecretLabel(key, value string) func(*corev1.Secret)
- func WithSecretLabels(labels map[string]string) func(*corev1.Secret)
- func WithSecretNamespace(namespace string) func(*corev1.Secret)
- func WithSecretType(secretType corev1.SecretType) func(*corev1.Secret)
- func WithTeamLabel(key, value string) func(*greenhousev1alpha1.Team)
- func WithTeamRef(teamRef string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithTeamRefs(teamRefs ...string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithTeamRoleBindingLabel(key, value string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithTeamRoleRef(roleRef string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithUIApplication(ui *greenhousev1alpha1.UIApplicationReference) func(*greenhousev1alpha1.ClusterPluginDefinition)
- func WithUsernames(usernames []string) func(*greenhousev1alpha2.TeamRoleBinding)
- func WithVersion(version string) func(*greenhousev1alpha1.ClusterPluginDefinition)
- func WithoutHelmChart() func(*greenhousev1alpha1.ClusterPluginDefinition)
- func WithoutPluginDefinitionHelmChart() func(*greenhousev1alpha1.PluginDefinition)
- type TestSetup
- func (t *TestSetup) CreateCatalog(ctx context.Context, name string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
- func (t *TestSetup) CreateCluster(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Cluster)) *greenhousev1alpha1.Cluster
- func (t *TestSetup) CreateClusterPluginDefinition(ctx context.Context, name string, ...) *greenhousev1alpha1.ClusterPluginDefinition
- func (t *TestSetup) CreateConfigMap(ctx context.Context, name string, opts ...func(*corev1.ConfigMap)) *corev1.ConfigMap
- func (t *TestSetup) CreateDefaultOrgWithOIDCSecret(ctx context.Context, supportGroupTeamName string) *greenhousev1alpha1.Organization
- func (t *TestSetup) CreateOrgOIDCSecret(ctx context.Context, orgName, supportGroupTeamName string) *corev1.Secret
- func (t *TestSetup) CreateOrganization(ctx context.Context, name string, ...) *greenhousev1alpha1.Organization
- func (t *TestSetup) CreateOrganizationWithOIDCConfig(ctx context.Context, orgName, supportGroupTeamName string) (*greenhousev1alpha1.Organization, *corev1.Secret)
- func (t *TestSetup) CreatePlugin(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Plugin)) *greenhousev1alpha1.Plugin
- func (t *TestSetup) CreatePluginDefinition(ctx context.Context, name string, ...) *greenhousev1alpha1.PluginDefinition
- func (t *TestSetup) CreatePluginPreset(ctx context.Context, name string, ...) *greenhousev1alpha1.PluginPreset
- func (t *TestSetup) CreateSecret(ctx context.Context, name string, opts ...func(*corev1.Secret)) *corev1.Secret
- func (t *TestSetup) CreateTeam(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Team)) *greenhousev1alpha1.Team
- func (t *TestSetup) CreateTeamRole(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.TeamRole)) *greenhousev1alpha1.TeamRole
- func (t *TestSetup) CreateTeamRoleBinding(ctx context.Context, name string, ...) *greenhousev1alpha2.TeamRoleBinding
- func (t *TestSetup) Namespace() string
- func (t *TestSetup) OnboardCluster(ctx context.Context, name string, kubeCfg []byte, ...) *greenhousev1alpha1.Cluster
- func (t *TestSetup) RandomizeName(name string) string
- func (t *TestSetup) UpdateCatalog(ctx context.Context, name string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
- func (t *TestSetup) UpdateOrganization(ctx context.Context, name string, ...) *greenhousev1alpha1.Organization
- func (t *TestSetup) UpdateSecret(ctx context.Context, name string, opts ...func(*corev1.Secret)) *corev1.Secret
Constants ¶
const ( // TestNamespace is the namespace used for testing. Name reflects it represents a greenhouse org. TestNamespace = "test-org" TestGreenhouseNamespace = "greenhouse" )
const ( OIDCSecretResource = "oidc-secret" OIDCClientIDKey = "clientID" OIDCClientID = "the-client-id" OIDCClientSecretKey = "clientSecret" OIDCClientSecret = "the-client-secret" OIDCIssuer = "https://the-issuer" )
Variables ¶
var ( // Cfg is the rest.Config to access the cluster the tests are running against. Cfg *rest.Config // RestClientGetter is the clientutil.RestClientGetter to access the cluster the tests are running against. RestClientGetter *clientutil.RestClientGetter // K8sClient is the client.Client to access the cluster the tests are running against. K8sClient client.Client // K8sManager is the ctrl.Manager the controllers are run by. K8sManager ctrl.Manager // KubeConfig is the raw kubeconfig to access the cluster the tests are running against. KubeConfig []byte // Ctx is the context to use for the tests. Ctx context.Context // IsUseExistingCluster is true if the tests are running against an existing cluster. IsUseExistingCluster = useExistingGreenhouseCluster // TestBeforeSuite configures the test suite. TestBeforeSuite = func() { logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) SetDefaultEventuallyTimeout(1 * time.Minute) installCRDs := clientutil.GetEnvOrDefault("TEST_INSTALL_CRDS", "true") == "true" installWebhooks := len(allRegisterWebhookFuncs) > 0 && os.Getenv("TEST_INSTALL_WEBHOOKS") != "false" if useExistingGreenhouseCluster { e2eKubeconfig := os.Getenv("TEST_KUBECONFIG") Expect(e2eKubeconfig).NotTo(BeEmpty(), "the environment variable TEST_KUBECONFIG must be set to run the tests against a remote cluster") os.Setenv("KUBECONFIG", e2eKubeconfig) fmt.Printf("Running tests against existing cluster with kubeconfig: %s\n", e2eKubeconfig) installCRDs = false installWebhooks = false } else { _, isHasEnvKubebuilderAssets := os.LookupEnv("KUBEBUILDER_ASSETS") Expect(isHasEnvKubebuilderAssets). To(BeTrue(), "the environment variable KUBEBUILDER_ASSETS must be set to run the tests against local envtest") } Cfg, K8sClient, testEnv, KubeConfig = StartControlPlane("", installCRDs, installWebhooks) _ = K8sClient RestClientGetter = clientutil.NewRestClientGetterFromRestConfig(Cfg, TestNamespace, clientutil.WithPersistentConfig()) Expect(RestClientGetter).ToNot(BeNil(), "the RestClientGetter should not be nil") Ctx, cancel = context.WithCancel(context.TODO()) if !useExistingGreenhouseCluster { //+kubebuilder:scaffold:scheme var err error K8sManager, err = ctrl.NewManager(Cfg, ctrl.Options{ Scheme: testEnv.Scheme, Metrics: metricsserver.Options{ BindAddress: "0", }, WebhookServer: webhook.NewServer(webhook.Options{ Host: testEnv.WebhookInstallOptions.LocalServingHost, Port: testEnv.WebhookInstallOptions.LocalServingPort, CertDir: testEnv.WebhookInstallOptions.LocalServingCertDir, }), LeaderElection: false, }) Expect(err). ToNot(HaveOccurred(), "there must be no error creating a manager") Expect(K8sManager). NotTo(BeNil(), "the manager must not be nil") for webhookName, registerFunc := range allRegisterWebhookFuncs { logf.FromContext(Ctx, "message", "registering webhook", "name", webhookName) Expect(registerFunc(K8sManager)).To(Succeed(), "there must be no error registering the webhook", "name", webhookName) } for controllerName, registerFunc := range allRegisterControllerFuncs { Expect(registerFunc(controllerName, K8sManager)). To(Succeed(), "there must be no error registering the controller", "name", controllerName) } go func() { defer GinkgoRecover() err = K8sManager.Start(Ctx) Expect(err). ToNot(HaveOccurred(), "there must be no error starting the manager") }() if len(allRegisterWebhookFuncs) > 0 { dialer := &net.Dialer{Timeout: time.Second} addrPort := fmt.Sprintf("%s:%d", testEnv.WebhookInstallOptions.LocalServingHost, testEnv.WebhookInstallOptions.LocalServingPort) Eventually(func() error { conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) if err != nil { return err } conn.Close() return nil }, updateTimeout, pollInterval).Should(Succeed(), "there should be no error dialing the webhook server") } } err := K8sClient.Create(Ctx, &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: TestNamespace}}) Expect(err).NotTo(HaveOccurred(), "there should be no error creating the test namespace") err = K8sClient.Create(Ctx, &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: TestGreenhouseNamespace}}) Expect(err).NotTo(HaveOccurred(), "there should be no error creating the greenhouse namespace") } // TestAfterSuite configures the test suite. TestAfterSuite = func() { err := K8sClient.Delete(Ctx, &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: TestNamespace}}) Expect(err).NotTo(HaveOccurred(), "there should be no error deleting the test namespace") cancel() By("tearing down the test environment") Eventually(func() error { return testEnv.Stop() }).Should(Succeed(), "there should be no error stopping the test environment") if useExistingGreenhouseCluster { os.Setenv("KUBECONFIG", persistedKubeconfig) } } )
Functions ¶
func AppendPluginDefinitionPluginOption ¶ added in v0.7.0
func AppendPluginDefinitionPluginOption(option greenhousev1alpha1.PluginOption) func(*greenhousev1alpha1.PluginDefinition)
AppendPluginDefinitionPluginOption sets the plugin option in ClusterPluginDefinition
func AppendPluginOption ¶
func AppendPluginOption(option greenhousev1alpha1.PluginOption) func(*greenhousev1alpha1.ClusterPluginDefinition)
AppendPluginOption sets the plugin option in ClusterPluginDefinition
func EventuallyCreated ¶
EventuallyCreated verifies if the object is created
func EventuallyDeleted ¶
EventuallyDeleted deletes the object and waits until it is gone. Early return if the delete fails with NotFound
func GreenhouseV1Alpha1Scheme ¶
GreenhouseV1Alpha1Scheme returns a new runtime.Scheme with the Greenhouse v1alpha1 scheme added.
func KubeconfigFromEnvVar ¶
KubeconfigFromEnvVar returns the kubeconfig []byte from the path specified in the environment variable
func MockHelmChartReady ¶ added in v0.11.0
func MockHelmChartReady(ctx context.Context, k8sClient client.Client, pluginDefinition common.GenericPluginDefinition, helmChartNamespace string)
MockHelmChartReady mocks the HelmChart status for a PluginDefinition as ready. This is useful in tests where the Flux source controller is not running. The function uses Eventually to wait for the HelmChart to be created and then patches its status. Works with both ClusterPluginDefinition and PluginDefinition via the common.GenericPluginDefinition interface.
func MustDeleteCluster ¶
MustDeleteCluster is used in the test context only and removes a cluster by namespaced name.
func MustRemoveAnnotation ¶ added in v0.7.0
func MustRemoveLabel ¶ added in v0.11.0
func MustReturnJSONFor ¶
func MustReturnJSONFor(val any) *apiextensionsv1.JSON
MustReturnJSONFor marshals val to JSON and returns an apiextensionsv1.JSON.
func MustSetAnnotation ¶ added in v0.7.0
func MustSetAnnotations ¶ added in v0.7.0
func NewCatalog ¶ added in v0.7.0
func NewCatalog(name, namespace string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
func NewCatalogSource ¶ added in v0.7.0
func NewCatalogSource(opts ...func(source *greenhousev1alpha1.CatalogSource)) greenhousev1alpha1.CatalogSource
func NewCluster ¶
func NewCluster(ctx context.Context, name, namespace string, opts ...func(*greenhousev1alpha1.Cluster)) *greenhousev1alpha1.Cluster
NewCluster returns a greenhousev1alpha1.Cluster object. Opts can be used to set the desired state of the Cluster.
func NewClusterPluginDefinition ¶ added in v0.6.0
func NewClusterPluginDefinition(ctx context.Context, name string, opts ...func(definition *greenhousev1alpha1.ClusterPluginDefinition)) *greenhousev1alpha1.ClusterPluginDefinition
NewClusterPluginDefinition returns a greenhousev1alpha1.ClusterPluginDefinition object. Opts can be used to set the desired state of the ClusterPluginDefinition.
func NewConfigMap ¶ added in v0.6.0
func NewOrganization ¶
func NewOrganization(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Organization)) *greenhousev1alpha1.Organization
NewOrganization returns a greenhousev1alpha1.Organization object. Opts can be used to set the desired state of the Organization.
func NewPlugin ¶
func NewPlugin(ctx context.Context, name, namespace string, opts ...func(*greenhousev1alpha1.Plugin)) *greenhousev1alpha1.Plugin
NewPlugin returns a greenhousev1alpha1.Plugin object. Opts can be used to set the desired state of the Plugin.
func NewPluginDefinition ¶
func NewPluginDefinition(ctx context.Context, name, namespace string, opts ...func(definition *greenhousev1alpha1.PluginDefinition)) *greenhousev1alpha1.PluginDefinition
NewPluginDefinition returns a namespaced greenhousev1alpha1.PluginDefinition object. Opts can be used to set the desired state of the PluginDefinition.
func NewPluginPreset ¶ added in v0.6.0
func NewPluginPreset(name, namespace string, opts ...func(*greenhousev1alpha1.PluginPreset)) *greenhousev1alpha1.PluginPreset
NewPluginPreset returns a greenhousev1alpha1.PluginPreset object. Opts can be used to set the desired state of the PluginPreset.
func NewSecret ¶
NewSecret returns a Secret object. Opts can be used to set the desired state of the Secret.
func NewTeam ¶
func NewTeam(ctx context.Context, name, namespace string, opts ...func(*greenhousev1alpha1.Team)) *greenhousev1alpha1.Team
NewTeam returns a greenhousev1alpha1.Team object. Opts can be used to set the desired state of the Team.
func NewTeamRole ¶
func NewTeamRole(ctx context.Context, name, namespace string, opts ...func(*greenhousev1alpha1.TeamRole)) *greenhousev1alpha1.TeamRole
NewTeamRole returns a greenhousev1alpha1.TeamRole object. Opts can be used to set the desired state of the TeamRole.
func NewTeamRoleBinding ¶
func NewTeamRoleBinding(ctx context.Context, name, namespace string, opts ...func(*greenhousev1alpha2.TeamRoleBinding)) *greenhousev1alpha2.TeamRoleBinding
NewTeamRoleBinding returns a greenhousev1alpha2.TeamRoleBinding object. Opts can be used to set the desired state of the TeamRoleBinding.
func RegisterController ¶
func RegisterController(controllerName string, f registerControllerFunc)
RegisterController registers a controller for the testbed. A currently running testbed is not affected.
func RegisterWebhook ¶
func RegisterWebhook(webhookName string, f registerWebhookFunc)
RegisterWebhook registers a webhook for the testbed. A currently running testbed is not affected.
func SetClusterReadyCondition ¶
func SetClusterReadyCondition(ctx context.Context, c client.Client, cluster *greenhousev1alpha1.Cluster, readyStatus metav1.ConditionStatus) error
SetClusterReadyCondition sets the ready condition of the cluster resource.
func SetOptionValueForPlugin ¶
func SetOptionValueForPlugin(plugin *greenhousev1alpha1.Plugin, key, value string)
SetOptionValueForPlugin sets the value of a PluginOptionValue in plugin
func StartControlPlane ¶
func StartControlPlane(port string, installCRDs, installWebhooks bool) (*rest.Config, client.Client, *envtest.Environment, []byte)
Starts a envTest control plane and returns the config, client, envtest.Environment and raw kubeconfig.
func UnregisterController ¶
func UnregisterController(controllerName string)
UnregisterController removes a controller from the testbed. A currently running testbed is not affected.
func UnregisterWebhook ¶
func UnregisterWebhook(webhookName string)
UnregisterWebhook removes a webhook from the testbed. A currently running testbed is not affected.
func UpdateClusterWithDeletionAnnotation ¶
func UpdateClusterWithDeletionAnnotation(ctx context.Context, c client.Client, cluster *greenhousev1alpha1.Cluster) *greenhousev1alpha1.Cluster
func WithAccessMode ¶
func WithAccessMode(mode greenhousev1alpha1.ClusterAccessMode) func(*greenhousev1alpha1.Cluster)
WithAccessMode sets the ClusterAccessMode on a Cluster
func WithAdditionalRedirects ¶ added in v0.5.0
func WithAdditionalRedirects(additionalRedirects ...string) func(organization *greenhousev1alpha1.Organization)
WithAdditionalRedirects - sets the additional redirect URIs on an Organization. (To be used with WithOIDCConfig)
func WithAggregationRule ¶
func WithAggregationRule(aggregationRule *rbacv1.AggregationRule) func(*greenhousev1alpha1.TeamRole)
WithAggregationRule sets the AggregationRule on a TeamRole
func WithCatalogResources ¶ added in v0.7.0
func WithCatalogResources(resources []string) func(source *greenhousev1alpha1.CatalogSource)
func WithCluster ¶
func WithCluster(cluster string) func(*greenhousev1alpha1.Plugin)
WithCluster sets the Cluster for a Plugin
func WithClusterAnnotations ¶ added in v0.5.0
func WithClusterAnnotations(annotations map[string]string) func(*greenhousev1alpha1.Cluster)
WithClusterAnnotations sets metadata annotations on a Cluster
func WithClusterLabel ¶ added in v0.6.0
func WithClusterLabel(key, value string) func(*greenhousev1alpha1.Cluster)
WithClusterLabel sets the label on a Cluster
func WithClusterName ¶
func WithClusterName(clusterName string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithClusterOverride ¶ added in v0.7.0
func WithClusterOverride(clusterName string, optionValues []greenhousev1alpha1.PluginOptionValue) func(*greenhousev1alpha1.PluginPreset)
WithClusterOverrides sets the ClusterOverrides for a Cluster
func WithClusterPluginDefinition ¶ added in v0.7.0
func WithClusterPluginDefinition(pluginDefinition string) func(*greenhousev1alpha1.Plugin)
WithClusterPluginDefinition sets the PluginDefinition reference to ClusterPluginDefinition in the Plugin
func WithClusterSelector ¶
func WithClusterSelector(selector metav1.LabelSelector) func(*greenhousev1alpha2.TeamRoleBinding)
func WithConfigMapData ¶ added in v0.6.0
func WithConfigMapLabels ¶ added in v0.6.0
func WithConfigMapRef ¶ added in v0.6.0
func WithConfigMapRef(configMapRef string) func(*greenhousev1alpha1.Organization)
func WithCreateNamespace ¶
func WithCreateNamespace(createNamespaces bool) func(*greenhousev1alpha2.TeamRoleBinding)
func WithHelmChart ¶
func WithHelmChart(chart *greenhousev1alpha1.HelmChartReference) func(*greenhousev1alpha1.ClusterPluginDefinition)
WithHelmChart sets the HelmChart of a ClusterPluginDefinition
func WithLabels ¶
func WithLabels(labels map[string]string) func(*greenhousev1alpha1.TeamRole)
WithLabels sets the .spec.Labels on a TeamRole
func WithMappedAdminIDPGroup ¶
func WithMappedAdminIDPGroup(group string) func(*greenhousev1alpha1.Organization)
WithMappedAdminIDPGroup sets the MappedIDPGroup on an Organization
func WithMappedIDPGroup ¶
func WithMappedIDPGroup(group string) func(*greenhousev1alpha1.Team)
func WithMaxTokenValidity ¶ added in v0.5.0
func WithMaxTokenValidity(maxTokenValidity int32) func(*greenhousev1alpha1.Cluster)
WithKubeConfig sets the kubeconfig of a Cluster
func WithNamespaces ¶
func WithNamespaces(namespaces ...string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithOIDCConfig ¶
func WithOIDCConfig(issuer, secretName, clientIDKey, clientSecretKey string) func(*greenhousev1alpha1.Organization)
WithOIDCConfig sets the OIDCConfig on an Organization
func WithOrgAnnotations ¶ added in v0.5.0
func WithOrgAnnotations(annotations map[string]string) func(*greenhousev1alpha1.Organization)
func WithOverrides ¶ added in v0.7.0
func WithOverrides(overrides []greenhousev1alpha1.CatalogOverrides) func(source *greenhousev1alpha1.CatalogSource)
func WithPluginDefinition ¶
func WithPluginDefinition(pluginDefinition string) func(*greenhousev1alpha1.Plugin)
WithPluginDefinition sets the PluginDefinition reference to namespaced PluginDefinition in the Plugin
func WithPluginDefinitionHelmChart ¶ added in v0.7.0
func WithPluginDefinitionHelmChart(chart *greenhousev1alpha1.HelmChartReference) func(*greenhousev1alpha1.PluginDefinition)
WithPluginDefinitionHelmChart sets the HelmChart of a ClusterPluginDefinition
func WithPluginDefinitionUIApplication ¶ added in v0.7.0
func WithPluginDefinitionUIApplication(ui *greenhousev1alpha1.UIApplicationReference) func(*greenhousev1alpha1.PluginDefinition)
WithPluginDefinitionUIApplication sets the description of a ClusterPluginDefinition
func WithPluginDefinitionVersion ¶ added in v0.7.0
func WithPluginDefinitionVersion(version string) func(*greenhousev1alpha1.PluginDefinition)
WithPluginDefinitionVersion sets the version of a ClusterPluginDefinition
func WithPluginDeletionPolicy ¶ added in v0.8.0
func WithPluginDeletionPolicy(deletionPolicy string) func(*greenhousev1alpha1.Plugin)
WithPluginDeletionPolicy sets the DeletionPolicy of a Plugin
func WithPluginLabel ¶ added in v0.6.0
func WithPluginLabel(key, value string) func(*greenhousev1alpha1.Plugin)
WithPluginLabel sets the label on a Plugin
func WithPluginOptionValue ¶
func WithPluginOptionValue(name string, value *apiextensionsv1.JSON) func(*greenhousev1alpha1.Plugin)
WithPluginOptionValue sets the value of a PluginOptionValue, clears ValueFrom and Expression
func WithPluginOptionValueExpression ¶ added in v0.9.0
func WithPluginOptionValueExpression(name string, expression *string) func(*greenhousev1alpha1.Plugin)
WithPluginOptionValueExpression sets the expression of a PluginOptionValue,
func WithPluginOptionValueFrom ¶ added in v0.7.0
func WithPluginOptionValueFrom(name string, valueFrom *greenhousev1alpha1.PluginValueFromSource) func(*greenhousev1alpha1.Plugin)
WithPluginOptionValueFrom sets the value of a PluginOptionValue from a secret, clears Value and Expression
func WithPluginOptionValueFromRef ¶ added in v0.9.0
func WithPluginOptionValueFromRef(name string, ref *greenhousev1alpha1.ExternalValueSource) func(*greenhousev1alpha1.Plugin)
WithPluginOptionValueFromRef sets the value of a PluginOptionValue from an external reference, clears Value and Expression
func WithPluginPresetAnnotation ¶ added in v0.8.0
func WithPluginPresetAnnotation(key, value string) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetAnnotation sets the annotation on a PluginPreset
func WithPluginPresetClusterSelector ¶ added in v0.6.0
func WithPluginPresetClusterSelector(clusterSelector metav1.LabelSelector) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetClusterSelector sets the ClusterSelector on a PluginPreset.
func WithPluginPresetDeletionPolicy ¶ added in v0.7.0
func WithPluginPresetDeletionPolicy(deletionPolicy string) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetDeletionPolicy sets the DeletionPolicy on a PluginPreset.
func WithPluginPresetLabel ¶ added in v0.6.0
func WithPluginPresetLabel(key, value string) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetLabel sets the label on a PluginPreset
func WithPluginPresetPluginSpec ¶ added in v0.6.0
func WithPluginPresetPluginSpec(pluginSpec greenhousev1alpha1.PluginSpec) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetPluginSpec sets the PluginSpec on a PluginPreset.
func WithPluginPresetWaitFor ¶ added in v0.8.0
func WithPluginPresetWaitFor(waitFor greenhousev1alpha1.WaitForItem) func(*greenhousev1alpha1.PluginPreset)
WithPluginPresetWaitFor adds the WaitForItem to a PluginPreset's WaitFor.
func WithPluginWaitFor ¶ added in v0.7.0
func WithPluginWaitFor(waitFor []greenhousev1alpha1.WaitForItem) func(*greenhousev1alpha1.Plugin)
func WithPresetLabelValue ¶ added in v0.5.0
func WithPresetLabelValue(value string) func(*greenhousev1alpha1.Plugin)
WithPresetLabelValue sets the value of the greenhouseapis.LabelKeyPluginPreset label on a Plugin This label is used to indicate that the Plugin is managed by a PluginPreset.
func WithReleaseName ¶ added in v0.5.0
func WithReleaseName(releaseName string) func(*greenhousev1alpha1.Plugin)
WithReleaseName sets the ReleaseName of a Plugin
func WithReleaseNamespace ¶
func WithReleaseNamespace(releaseNamespace string) func(*greenhousev1alpha1.Plugin)
WithReleaseNamespace sets the ReleaseNamespace of a Plugin
func WithRepository ¶ added in v0.7.0
func WithRepository(url string) func(source *greenhousev1alpha1.CatalogSource)
func WithRepositoryBranch ¶ added in v0.7.0
func WithRepositoryBranch(branch string) func(source *greenhousev1alpha1.CatalogSource)
func WithRepositorySHA ¶ added in v0.7.0
func WithRepositorySHA(sha string) func(source *greenhousev1alpha1.CatalogSource)
func WithRepositoryTag ¶ added in v0.7.0
func WithRepositoryTag(tag string) func(source *greenhousev1alpha1.CatalogSource)
func WithRules ¶
func WithRules(rules []rbacv1.PolicyRule) func(*greenhousev1alpha1.TeamRole)
WithRules overrides the default rules of a TeamRole
func WithSecretAnnotations ¶ added in v0.5.0
func WithSecretData ¶
WithSecretData sets the data of the Secret
func WithSecretLabel ¶ added in v0.6.0
WithSecretLabel sets the label on a Secret
func WithSecretLabels ¶ added in v0.5.0
func WithSecretNamespace ¶
WithSecretNamespace sets the namespace of the Secret
func WithSecretType ¶
func WithSecretType(secretType corev1.SecretType) func(*corev1.Secret)
WithSecretType sets the type of the Secret
func WithTeamLabel ¶ added in v0.6.0
func WithTeamLabel(key, value string) func(*greenhousev1alpha1.Team)
WithTeamLabel sets the label on a Team
func WithTeamRef ¶
func WithTeamRef(teamRef string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithTeamRefs ¶ added in v0.11.0
func WithTeamRefs(teamRefs ...string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithTeamRoleBindingLabel ¶ added in v0.6.0
func WithTeamRoleBindingLabel(key, value string) func(*greenhousev1alpha2.TeamRoleBinding)
WithTeamRoleBindingLabel sets the label on a TeamRoleBinding
func WithTeamRoleRef ¶
func WithTeamRoleRef(roleRef string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithUIApplication ¶
func WithUIApplication(ui *greenhousev1alpha1.UIApplicationReference) func(*greenhousev1alpha1.ClusterPluginDefinition)
WithDescription sets the description of a ClusterPluginDefinition
func WithUsernames ¶
func WithUsernames(usernames []string) func(*greenhousev1alpha2.TeamRoleBinding)
func WithVersion ¶
func WithVersion(version string) func(*greenhousev1alpha1.ClusterPluginDefinition)
WithVersion sets the version of a ClusterPluginDefinition
func WithoutHelmChart ¶
func WithoutHelmChart() func(*greenhousev1alpha1.ClusterPluginDefinition)
WithoutHelmChart sets the HelmChart of a ClusterPluginDefinition to nil
func WithoutPluginDefinitionHelmChart ¶ added in v0.7.0
func WithoutPluginDefinitionHelmChart() func(*greenhousev1alpha1.PluginDefinition)
WithoutPluginDefinitionHelmChart sets the HelmChart of a ClusterPluginDefinition to nil
Types ¶
type TestSetup ¶
func NewTestSetup ¶
NewTestSetup creates a new TestSetup object and a new namespace on the cluster for the test
func (*TestSetup) CreateCatalog ¶ added in v0.7.0
func (t *TestSetup) CreateCatalog(ctx context.Context, name string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
func (*TestSetup) CreateCluster ¶
func (t *TestSetup) CreateCluster(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Cluster)) *greenhousev1alpha1.Cluster
CreateCluster creates a new Cluster resource without creating a Secret
func (*TestSetup) CreateClusterPluginDefinition ¶ added in v0.6.0
func (t *TestSetup) CreateClusterPluginDefinition(ctx context.Context, name string, opts ...func(definition *greenhousev1alpha1.ClusterPluginDefinition)) *greenhousev1alpha1.ClusterPluginDefinition
CreateClusterPluginDefinition creates and returns a ClusterPluginDefinition object. Opts can be used to set the desired state of the ClusterPluginDefinition.
func (*TestSetup) CreateConfigMap ¶ added in v0.6.0
func (t *TestSetup) CreateConfigMap(ctx context.Context, name string, opts ...func(*corev1.ConfigMap)) *corev1.ConfigMap
CreateConfigMap returns a ConfigMap object. Opts can be used to set the desired state of the ConfigMap.
func (*TestSetup) CreateDefaultOrgWithOIDCSecret ¶ added in v0.5.0
func (t *TestSetup) CreateDefaultOrgWithOIDCSecret(ctx context.Context, supportGroupTeamName string) *greenhousev1alpha1.Organization
func (*TestSetup) CreateOrgOIDCSecret ¶ added in v0.5.0
func (*TestSetup) CreateOrganization ¶
func (t *TestSetup) CreateOrganization(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Organization)) *greenhousev1alpha1.Organization
CreateOrganization creates an Organization within the TestSetup and returns the created Organization resource.
func (*TestSetup) CreateOrganizationWithOIDCConfig ¶
func (t *TestSetup) CreateOrganizationWithOIDCConfig(ctx context.Context, orgName, supportGroupTeamName string) (*greenhousev1alpha1.Organization, *corev1.Secret)
func (*TestSetup) CreatePlugin ¶
func (t *TestSetup) CreatePlugin(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Plugin)) *greenhousev1alpha1.Plugin
CreatePlugin creates and returns a Plugin object. Opts can be used to set the desired state of the Plugin.
func (*TestSetup) CreatePluginDefinition ¶
func (t *TestSetup) CreatePluginDefinition(ctx context.Context, name string, opts ...func(definition *greenhousev1alpha1.PluginDefinition)) *greenhousev1alpha1.PluginDefinition
CreatePluginDefinition creates and returns a PluginDefinition object. Opts can be used to set the desired state of the PluginDefinition.
func (*TestSetup) CreatePluginPreset ¶ added in v0.6.0
func (t *TestSetup) CreatePluginPreset(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.PluginPreset)) *greenhousev1alpha1.PluginPreset
CreatePluginPreset creates and returns a PluginPreset object. Opts can be used to set the desired state of the PluginPreset.
func (*TestSetup) CreateSecret ¶
func (t *TestSetup) CreateSecret(ctx context.Context, name string, opts ...func(*corev1.Secret)) *corev1.Secret
CreateSecret returns a Secret object. Opts can be used to set the desired state of the Secret.
func (*TestSetup) CreateTeam ¶
func (t *TestSetup) CreateTeam(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Team)) *greenhousev1alpha1.Team
CreateTeam returns a Team object. Opts can be used to set the desired state of the Team.st
func (*TestSetup) CreateTeamRole ¶
func (t *TestSetup) CreateTeamRole(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.TeamRole)) *greenhousev1alpha1.TeamRole
CreateTeamRole returns a TeamRole object. Opts can be used to set the desired state of the TeamRole.
func (*TestSetup) CreateTeamRoleBinding ¶
func (t *TestSetup) CreateTeamRoleBinding(ctx context.Context, name string, opts ...func(*greenhousev1alpha2.TeamRoleBinding)) *greenhousev1alpha2.TeamRoleBinding
CreateTeamRoleBinding returns a TeamRoleBinding object. Opts can be used to set the desired state of the TeamRoleBinding.
func (*TestSetup) OnboardCluster ¶
func (t *TestSetup) OnboardCluster(ctx context.Context, name string, kubeCfg []byte, opts ...func(*greenhousev1alpha1.Cluster)) *greenhousev1alpha1.Cluster
OnboardCluster creates a new Cluster and Kubernetes secret for a remote cluster and creates the namespace used for TestSetup on the remote cluster
func (*TestSetup) RandomizeName ¶
RandomizeName returns the name with a random alphanumeric suffix
func (*TestSetup) UpdateCatalog ¶ added in v0.7.0
func (t *TestSetup) UpdateCatalog(ctx context.Context, name string, sources ...greenhousev1alpha1.CatalogSource) *greenhousev1alpha1.Catalog
func (*TestSetup) UpdateOrganization ¶
func (t *TestSetup) UpdateOrganization(ctx context.Context, name string, opts ...func(*greenhousev1alpha1.Organization)) *greenhousev1alpha1.Organization