Documentation ¶
Index ¶
- func AddAnnotationForDeployItem(ctx context.Context, testenv *envtest.Environment, di *lsv1alpha1.DeployItem, ...) error
- func AddMimicKCMSecretControllerToManager(mgr manager.Manager) error
- func AddMimicKCMServiceAccountControllerToManager(mgr manager.Manager) error
- func AddReconcileAnnotation(ctx context.Context, testenv *envtest.Environment, ...) error
- func BuildContainerDeployItem(configuration *containerv1alpha1.ProviderConfiguration) *lsv1alpha1.DeployItem
- func BuildInternalKubernetesTarget(ctx context.Context, kubeClient client.Client, namespace, name string, ...) (*lsv1alpha1.Target, error)
- func BuildTargetAndSecretFromKubernetesTarget(target *lsv1alpha1.Target) (*lsv1alpha1.Target, *corev1.Secret, error)
- func CheckConfigMap(ctx context.Context, state *envtest.State, name string, ...) error
- func CheckDataObjectMap(ctx context.Context, state *envtest.State, name string, ...) error
- func CheckDataObjectString(ctx context.Context, state *envtest.State, name string, expectedValue string) error
- func CheckDeployment(deployment *appsv1.Deployment) error
- func CreateBlueprintFromFile(filePath, contentPath string) *blueprints.Blueprint
- func CreateContextFromFile(ctx context.Context, state *envtest.State, contxt *lsv1alpha1.Context, ...) error
- func CreateDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, ...) error
- func CreateDefaultContext(ctx context.Context, kubeClient client.Client, ...) error
- func CreateExampleDefaultContext(ctx context.Context, kubeClient client.Client, namespaces ...string) error
- func CreateInstallationFromFile(ctx context.Context, state *envtest.State, inst *lsv1alpha1.Installation, ...) error
- func CreateKubernetesTarget(namespace, name string, restConfig *rest.Config) (*lsv1alpha1.Target, error)
- func CreateKubernetesTargetFromSecret(namespace, name string, secret *corev1.Secret) (*lsv1alpha1.Target, error)
- func CreateNamespaceDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, ...) error
- func CreateOrUpdateTarget(ctx context.Context, client client.Client, namespace, name, ttype string, ...) (*lsv1alpha1.Target, error)
- func DefaultRepositoryContext(baseUrl string) *cdv2.UnstructuredTypedObject
- func DeleteDeployItemForNewReconcile(ctx context.Context, kubeClient client.Client, di *v1alpha1.DeployItem, ...) error
- func DeleteExecutionForNewReconcile(ctx context.Context, kubeClient client.Client, exec *v1alpha1.Execution, ...) error
- func DeleteObject(ctx context.Context, kubeClient client.Client, obj client.Object, ...) error
- func ExampleRepositoryContext() *cdv2.UnstructuredTypedObject
- func ExpectNoError(err error, extra ...interface{})
- func ExpectNoErrorWithOffset(offset int, err error, extra ...interface{})
- func GetDataObjectData(do *lsv1alpha1.DataObject, data interface{})
- func GetDeployItemsOfInstallation(ctx context.Context, kubeClient client.Client, inst *lsv1alpha1.Installation) ([]*lsv1alpha1.DeployItem, error)
- func GetNextCounter() string
- func GetTargetConfiguration(target *lsv1alpha1.Target, config interface{})
- func InjectImageTagIntoValues(values *json.RawMessage, imageTag string)
- func InjectTargetSelectorIntoValues(values *json.RawMessage, targetSelector []lsv1alpha1.TargetSelector)
- func LocalRemoteBlueprintRef(resourceName string) lsv1alpha1.BlueprintDefinition
- func LocalRepositoryContext(baseurl string) *cdv2.UnstructuredTypedObject
- func MakeRepositoryContext(rc cdv2.TypedObjectAccessor) *cdv2.UnstructuredTypedObject
- func MimicKCMServiceAccount(ctx context.Context, client client.Client, args MimicKCMServiceAccountArgs)
- func MimicKCMServiceAccountTokenGeneration(ctx context.Context, client client.Client, args MimicKCMServiceAccountArgs)
- func ReadAndCreateOrUpdateDeployItem(ctx context.Context, testenv *envtest.Environment, state *envtest.State, ...) *lsv1alpha1.DeployItem
- func ReadBlueprintFromFile(testfile string) (*lsv1alpha1.Blueprint, error)
- func ReadChartFrom(path string) ([]byte, func())
- func ReadResourceFromFile(obj runtime.Object, testfile string) error
- func ReadValuesFromFile(path string) json.RawMessage
- func Request(name, namespace string) reconcile.Request
- func RequestFromObject(obj client.Object) reconcile.Request
- func SetDaemonSetReady(ctx context.Context, client client.Client, ds *appsv1.DaemonSet) error
- func SetDataObjectData(do *lsv1alpha1.DataObject, data interface{})
- func SetDeploymentReady(ctx context.Context, client client.Client, dp *appsv1.Deployment) error
- func SetPodReady(ctx context.Context, client client.Client, pod *corev1.Pod) error
- func SetReadyStatus(ctx context.Context, c client.Client, u *unstructured.Unstructured) error
- func SetReplicaSetReady(ctx context.Context, client client.Client, rs *appsv1.ReplicaSet) error
- func SetReplicationControllerReady(ctx context.Context, client client.Client, rc *corev1.ReplicationController) error
- func SetStatefulSetReady(ctx context.Context, client client.Client, sts *appsv1.StatefulSet) error
- func ShouldNotReconcile(ctx context.Context, reconciler reconcile.Reconciler, req reconcile.Request, ...) error
- func ShouldReconcile(ctx context.Context, reconciler reconcile.Reconciler, req reconcile.Request, ...)
- func ShouldReconcileButRetry(ctx context.Context, reconciler reconcile.Reconciler, req reconcile.Request, ...)
- func UpdateDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, ...) error
- func UpdateInstallationFromFile(ctx context.Context, state *envtest.State, inst *lsv1alpha1.Installation, ...) error
- func UpdateJobIdForDeployItem(ctx context.Context, testenv *envtest.Environment, di *lsv1alpha1.DeployItem, ...) error
- func UpdateJobIdForDeployItemC(ctx context.Context, cl client.Client, di *lsv1alpha1.DeployItem, ...) error
- func UpdateJobIdForExecution(ctx context.Context, testenv *envtest.Environment, exec *lsv1alpha1.Execution) error
- func UpdateJobIdForExecutionC(ctx context.Context, cl client.Client, exec *lsv1alpha1.Execution) error
- func UpdateJobIdForInstallation(ctx context.Context, testenv *envtest.Environment, ...) error
- func WaitForContextToBeReady(ctx context.Context, logger utils.Logger, kubeClient client.Client, ...) error
- func WaitForDeploymentToBeReady(ctx context.Context, logger utils.Logger, kubeClient client.Client, ...) error
- func WaitForObjectDeletion(ctx context.Context, kubeClient client.Client, obj client.Object, ...) error
- type MimicKCMSecretController
- type MimicKCMServiceAccountArgs
- type MimicKCMServiceAccountController
- type TestInstallationConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationForDeployItem ¶
func AddAnnotationForDeployItem(ctx context.Context, testenv *envtest.Environment, di *lsv1alpha1.DeployItem, annotation, value string) error
func AddMimicKCMSecretControllerToManager ¶
AddMimicKCMSecretControllerToManager adds the mock kcm controller to a manager.
func AddMimicKCMServiceAccountControllerToManager ¶
AddMimicKCMServiceAccountControllerToManager adds the mock kcm controller to a manager.
func AddReconcileAnnotation ¶
func AddReconcileAnnotation(ctx context.Context, testenv *envtest.Environment, inst *lsv1alpha1.Installation) error
func BuildContainerDeployItem ¶
func BuildContainerDeployItem(configuration *containerv1alpha1.ProviderConfiguration) *lsv1alpha1.DeployItem
BuildContainerDeployItem builds a new deploy item of type container.
func BuildInternalKubernetesTarget ¶
func BuildInternalKubernetesTarget(ctx context.Context, kubeClient client.Client, namespace, name string, restConfig *rest.Config, internal bool) (*lsv1alpha1.Target, error)
BuildInternalKubernetesTarget creates a new target of type kubernetes whereas the hostname of the cluster will be set to the cluster internal host. It is expected that the controller runs inside the same cluster where it also deploys to.
func BuildTargetAndSecretFromKubernetesTarget ¶
func BuildTargetAndSecretFromKubernetesTarget(target *lsv1alpha1.Target) (*lsv1alpha1.Target, *corev1.Secret, error)
func CheckConfigMap ¶
func CheckDataObjectMap ¶
func CheckDataObjectString ¶
func CheckDeployment ¶
func CheckDeployment(deployment *appsv1.Deployment) error
CheckDeployment checks whether the given Deployment is healthy. A deployment is considered healthy if the controller observed its current revision and if the number of updated replicas is equal to the number of replicas.
func CreateBlueprintFromFile ¶
func CreateBlueprintFromFile(filePath, contentPath string) *blueprints.Blueprint
CreateBlueprintFromFile reads a blueprint from the given file and creates a internal blueprint object.
func CreateContextFromFile ¶
func CreateDataObjectFromFile ¶
func CreateDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, path string) error
func CreateDefaultContext ¶
func CreateDefaultContext(ctx context.Context, kubeClient client.Client, repoCtx cdv2.TypedObjectAccessor, namespaces ...string) error
CreateDefaultContext creates default context with a given repository context.
func CreateExampleDefaultContext ¶
func CreateExampleDefaultContext(ctx context.Context, kubeClient client.Client, namespaces ...string) error
CreateExampleDefaultContext creates default context with the example repository.
func CreateInstallationFromFile ¶
func CreateInstallationFromFile(ctx context.Context, state *envtest.State, inst *lsv1alpha1.Installation, path string) error
func CreateKubernetesTarget ¶
func CreateKubernetesTarget(namespace, name string, restConfig *rest.Config) (*lsv1alpha1.Target, error)
CreateKubernetesTarget creates a new target of type kubernetes
func CreateKubernetesTargetFromSecret ¶
func CreateKubernetesTargetFromSecret(namespace, name string, secret *corev1.Secret) (*lsv1alpha1.Target, error)
CreateKubernetesTargetFromSecret creates a new target of type kubernetes from a secret
func CreateNamespaceDataObjectFromFile ¶
func CreateNamespaceDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, path string) error
func CreateOrUpdateTarget ¶
func CreateOrUpdateTarget(ctx context.Context, client client.Client, namespace, name, ttype string, config interface{}) (*lsv1alpha1.Target, error)
CreateOrUpdateTarget creates or updates a target with specific name, namespace and type
func DefaultRepositoryContext ¶
func DefaultRepositoryContext(baseUrl string) *cdv2.UnstructuredTypedObject
DefaultRepositoryContext creates a new oci registry repository context.
func DeleteObject ¶
func DeleteObject( ctx context.Context, kubeClient client.Client, obj client.Object, timeout time.Duration) error
DeleteObject deletes a object and waits until the given object is deleted
func ExampleRepositoryContext ¶
func ExampleRepositoryContext() *cdv2.UnstructuredTypedObject
ExampleRepositoryContext creates a new example repository context.
func ExpectNoError ¶
func ExpectNoError(err error, extra ...interface{})
func ExpectNoErrorWithOffset ¶
func GetDataObjectData ¶
func GetDataObjectData(do *lsv1alpha1.DataObject, data interface{})
func GetDeployItemsOfInstallation ¶
func GetDeployItemsOfInstallation(ctx context.Context, kubeClient client.Client, inst *lsv1alpha1.Installation) ([]*lsv1alpha1.DeployItem, error)
func GetNextCounter ¶
func GetNextCounter() string
func GetTargetConfiguration ¶
func GetTargetConfiguration(target *lsv1alpha1.Target, config interface{})
func InjectImageTagIntoValues ¶
func InjectImageTagIntoValues(values *json.RawMessage, imageTag string)
InjectImageTagIntoValues injects (and potentially overwrites) an Image tag into a values JSON raw message
func InjectTargetSelectorIntoValues ¶
func InjectTargetSelectorIntoValues(values *json.RawMessage, targetSelector []lsv1alpha1.TargetSelector)
InjectTargetSelectorIntoValues injects (and potentially overwrites) a TargetSelector into a values JSON raw message
func LocalRemoteBlueprintRef ¶
func LocalRemoteBlueprintRef(resourceName string) lsv1alpha1.BlueprintDefinition
LocalRemoteBlueprintRef creates a new default local remote blueprint reference
func LocalRepositoryContext ¶
func LocalRepositoryContext(baseurl string) *cdv2.UnstructuredTypedObject
LocalRepositoryContext returns a new 'local' repository context.
func MakeRepositoryContext ¶
func MakeRepositoryContext(rc cdv2.TypedObjectAccessor) *cdv2.UnstructuredTypedObject
MakeRepositoryContext creates a new oci registry repository context.
func MimicKCMServiceAccount ¶
func MimicKCMServiceAccount(ctx context.Context, client client.Client, args MimicKCMServiceAccountArgs)
MimicKCMServiceAccount mimics the kube controller manager behavior for service accounts. The apiserver is watched for service accounts and a account secret is created.
func MimicKCMServiceAccountTokenGeneration ¶
func MimicKCMServiceAccountTokenGeneration(ctx context.Context, client client.Client, args MimicKCMServiceAccountArgs)
MimicKCMServiceAccountTokenGeneration mimics the kube controller manager behavior for service accounts. The apiserver is watched for secrets of a service account, and a token is added to the secret.
func ReadAndCreateOrUpdateDeployItem ¶
func ReadAndCreateOrUpdateDeployItem(ctx context.Context, testenv *envtest.Environment, state *envtest.State, diName, file string) *lsv1alpha1.DeployItem
ReadAndCreateOrUpdateDeployItem reads a deploy item from the given file and creates or updated the deploy item
func ReadBlueprintFromFile ¶
func ReadBlueprintFromFile(testfile string) (*lsv1alpha1.Blueprint, error)
ReadBlueprintFromFile reads a file and parses it to a Blueprint
func ReadChartFrom ¶
ReadChartFrom reads a Helm chart from a filesystem path and returns it as raw bytes array
func ReadResourceFromFile ¶
ReadResourceFromFile reads a file and parses it to the given object
func ReadValuesFromFile ¶
func ReadValuesFromFile(path string) json.RawMessage
ReadValuesFromFile reads Helm values from a file and returns them as JSON raw message
func RequestFromObject ¶
RequestFromObject creates a new reconcile.for a object
func SetDaemonSetReady ¶
SetDaemonSetReady sets a DaemonSet status to Ready.
func SetDataObjectData ¶
func SetDataObjectData(do *lsv1alpha1.DataObject, data interface{})
func SetDeploymentReady ¶
SetDeploymentReady sets a Deployment status to Ready.
func SetPodReady ¶
SetPodReady sets a Pod status to Ready.
func SetReadyStatus ¶
func SetReadyStatus(ctx context.Context, c client.Client, u *unstructured.Unstructured) error
SetReadyStatus sets the object status to Ready for workload type resources.
func SetReplicaSetReady ¶
SetReplicaSetReady sets a ReplicaSet status to Ready.
func SetReplicationControllerReady ¶
func SetReplicationControllerReady(ctx context.Context, client client.Client, rc *corev1.ReplicationController) error
SetReplicationControllerReady sets a ReplicationController status to Ready.
func SetStatefulSetReady ¶
SetStatefulSetReady sets a StatefulSet status to Ready.
func ShouldNotReconcile ¶
func ShouldNotReconcile(ctx context.Context, reconciler reconcile.Reconciler, req reconcile.Request, optionalDescription ...interface{}) error
ShouldNotReconcile reconciles the given reconciler with the given request and expects that an error occurred
func ShouldReconcile ¶
func ShouldReconcile(ctx context.Context, reconciler reconcile.Reconciler, req reconcile.Request, optionalDescription ...interface{})
ShouldReconcile reconciles the given reconciler with the given request and expects that no error occurred
func ShouldReconcileButRetry ¶
func UpdateDataObjectFromFile ¶
func UpdateDataObjectFromFile(ctx context.Context, state *envtest.State, do *lsv1alpha1.DataObject, path string) error
func UpdateInstallationFromFile ¶
func UpdateInstallationFromFile(ctx context.Context, state *envtest.State, inst *lsv1alpha1.Installation, path string) error
func UpdateJobIdForDeployItem ¶
func UpdateJobIdForDeployItem(ctx context.Context, testenv *envtest.Environment, di *lsv1alpha1.DeployItem, time metav1.Time) error
func UpdateJobIdForDeployItemC ¶
func UpdateJobIdForDeployItemC(ctx context.Context, cl client.Client, di *lsv1alpha1.DeployItem, time metav1.Time) error
func UpdateJobIdForExecution ¶
func UpdateJobIdForExecution(ctx context.Context, testenv *envtest.Environment, exec *lsv1alpha1.Execution) error
func UpdateJobIdForInstallation ¶
func UpdateJobIdForInstallation(ctx context.Context, testenv *envtest.Environment, inst *lsv1alpha1.Installation) error
func WaitForContextToBeReady ¶
func WaitForContextToBeReady(ctx context.Context, logger utils.Logger, kubeClient client.Client, objKey types.NamespacedName, timeout time.Duration) error
WaitForContextToBeReady waits for a context to be ready
Types ¶
type MimicKCMSecretController ¶
type MimicKCMSecretController struct {
// contains filtered or unexported fields
}
MimicKCMSecretController is a controller that mimics the service account token secret handling of the KCM.
type MimicKCMServiceAccountArgs ¶
type MimicKCMServiceAccountArgs struct { Name string Namespace string Token string Timeout time.Duration }
MimicKCMServiceAccountArgs describes the configuration for mimicing the service account behavior of the MimicKCMServiceAccount func.
type MimicKCMServiceAccountController ¶
type MimicKCMServiceAccountController struct {
// contains filtered or unexported fields
}
MimicKCMServiceAccountController is a controller that mimics the service account token creation of the KCM.
type TestInstallationConfig ¶
type TestInstallationConfig struct { // +optional MockClient *k8smock.MockClient // Defines the installation that should be used to create a blueprint and operations // If it is not defined a default one is created with the given name and namespace // +optional Installation *lsv1alpha1.Installation // Configures the default created installation InstallationName string InstallationNamespace string RemoteBlueprintComponentName string RemoteBlueprintResourceName string RemoteBlueprintVersion string RemoteBlueprintBaseURL string BlueprintContentPath string // BlueprintFilePath defines the filepath to the blueprint definition. // Will be defaulted to <BlueprintContentPath>/blueprint.yaml if not defined. BlueprintFilePath string }
TestInstallationConfig defines a installation configuration which can be used to create a test environment with a installation, a blueprint and a operation.