Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyPolicyAndCreateAllComponents(client *clients.Settings, policy ocm.PolicyBuilder, policySetName string, ...) error
- func BoolAddr(b bool) *bool
- func CleanupNamespace(clients []*clients.Settings, ns string) error
- func CleanupTestResourcesOnClient(client *clients.Settings, cguName string, policyName string, nsName string, ...) []error
- func CleanupTestResourcesOnClients(clients []*clients.Settings, cguName string, policyName string, ...) []error
- func CreateCguAndWait(client *clients.Settings, clusterGroupUpgrade cgu.CguBuilder) error
- func CreatePolicyAndCgu(client *clients.Settings, object runtime.Object, ...) error
- func CreatePolicyAndWait(client *clients.Settings, policy ocm.PolicyBuilder) error
- func CreatePolicyWithAllComponents(client *clients.Settings, object runtime.Object, ...) error
- func CreateTalmTestNamespace() error
- func DeleteTalmTestNamespace(allowNotFound bool) error
- func FilterMissingResourceErrors(err error) error
- func GetAllTestClients() []*clients.Settings
- func GetCguDefinition(cguName string, clusterList []string, canaryList []string, ...) cgu.CguBuilder
- func GetConfigurationPolicyDefinition(policyName string, complianceType configurationPolicyv1.ComplianceType, ...) configurationPolicyv1.ConfigurationPolicy
- func GetPlacementBindingDefinition(placementBindingName string, policySetName string, placementRuleName string, ...) ocm.PlacementBindingBuilder
- func GetPlacementFieldDefinition(clusters []string, clusterSelector metav1.LabelSelector) placementrulev1.GenericPlacementFields
- func GetPlacementRuleDefinition(placementRuleName string, namespace string, ...) ocm.PlacementRuleBuilder
- func GetPolicyDefinition(policyName string, namespace string, object runtime.Object, ...) ocm.PolicyBuilder
- func GetPolicySetDefinition(policySetName string, policyList []policiesv1beta1.NonEmptyString, ...) ocm.PolicySetBuilder
- func IsCguExist(client *clients.Settings, cguName string, namespace string) (bool, error)
- func IsClusterInProgressInCgu(client *clients.Settings, cguName string, clusterName string, namespace string) (bool, error)
- func IsClusterStartedInCgu(client *clients.Settings, cguName string, clusterName string, namespace string) (bool, error)
- func IsPolicyExist(client *clients.Settings, policyName string, namespace string) (bool, error)
- func VerifyTalmIsInstalled() error
- func WaitForCguInCondition(client *clients.Settings, cguName string, namespace string, ...) error
- func WaitForCguToFinishSuccessfully(cguName string, namespace string, timeout time.Duration) error
- func WaitForClusterInProgressInCgu(client *clients.Settings, cguName string, clusterName string, namespace string, ...) error
- func WaitUntilObjectExists(client *clients.Settings, objectName string, namespace string, ...) error
Constants ¶
const ( CguName string = "talm-cgu" Namespace string = "ztp-install" PlacementBindingName string = "talm-placement-binding" PlacementRule string = "talm-placement-rule" PolicyName string = "talm-policy" PolicySetName string = "talm-policyset" CatalogSourceName string = "talm-catsrc" Talm411TimeoutMessage string = "The ClusterGroupUpgrade CR policies are taking too long to complete" Talm412TimeoutMessage string = "Policy remediation took too long" TemporaryNamespaceName string = Namespace + "-temp" ProgressingType string = "Progressing" ReadyType string = "Ready" SucceededType string = "Succeeded" ValidatedType string = "Validated" ConditionReasonCompleted string = "Completed" ConditionReasonUpgradeCompleted string = "UpgradeCompleted" )
talm consts.
Variables ¶
Functions ¶
func ApplyPolicyAndCreateAllComponents ¶
func ApplyPolicyAndCreateAllComponents( client *clients.Settings, policy ocm.PolicyBuilder, policySetName string, placementBindingName string, placementRuleName string, namespace string, clusters []string, clusterSelector metav1.LabelSelector, ) error
ApplyPolicyAndCreateAllComponents is used only apply already created policy and all the required components for applying that policy such as policyset, placementrule, placement binding, etc.
func CleanupNamespace ¶
CleanupNamespace is used to cleanup a namespace on multiple clients.
func CleanupTestResourcesOnClient ¶
func CleanupTestResourcesOnClient( client *clients.Settings, cguName string, policyName string, nsName string, placementBinding string, placementRule string, policySet string, catsrcName string, deleteNs bool, ) []error
CleanupTestResourcesOnClient is used to delete everything on a specific cluster.
func CleanupTestResourcesOnClients ¶
func CleanupTestResourcesOnClients( clients []*clients.Settings, cguName string, policyName string, createdNamespace string, placementBinding string, placementRule string, policySet string, catsrcName string) []error
CleanupTestResourcesOnClients is used to delete all references to specified cgu, policy, and namespace on all clusters specified in the client list.
func CreateCguAndWait ¶
func CreateCguAndWait( client *clients.Settings, clusterGroupUpgrade cgu.CguBuilder) error
CreateCguAndWait is used to create a CGU with the provided clusters list and managed policies. No policies, placements, bindings, policysets, etc will be created.
func CreatePolicyAndCgu ¶
func CreatePolicyAndCgu( client *clients.Settings, object runtime.Object, complianceType configurationPolicyv1.ComplianceType, remediationAction configurationPolicyv1.RemediationAction, policyName string, policySetName string, placementBindingName string, placementRule string, namespace string, clusterSelector metav1.LabelSelector, clusterGroupUpgrade cgu.CguBuilder) error
CreatePolicyAndCgu is used to create a simplified CGU to cover the most common use case. This will automatically create a single policy enforcing the compliance type on the provided object. If you require multiple policies to be managed then consider CreateCgu() instead.
func CreatePolicyAndWait ¶
func CreatePolicyAndWait(client *clients.Settings, policy ocm.PolicyBuilder) error
CreatePolicyAndWait is used to create a policy and wait for it to exist.
func CreatePolicyWithAllComponents ¶
func CreatePolicyWithAllComponents( client *clients.Settings, object runtime.Object, complianceType configurationPolicyv1.ComplianceType, remediationAction configurationPolicyv1.RemediationAction, policyName string, policySetName string, placementBindingName string, placementRule string, namespace string, clusters []string, clusterSelector metav1.LabelSelector, ) error
CreatePolicyWithAllComponents is used to create a policy and all the requireed components for applying that policy such as policyset, placementrule, placement binding, etc.
func CreateTalmTestNamespace ¶
func CreateTalmTestNamespace() error
CreateTalmTestNamespace deletes the TALM test namespace.
func DeleteTalmTestNamespace ¶
DeleteTalmTestNamespace deletes the TALM test namespace.
func FilterMissingResourceErrors ¶
FilterMissingResourceErrors takes an input error and checks it for a few specific types of errors. If it matches any of the errors that are considered to be a resource not found, then it returns nil. Otherwise it returns the original error.
func GetAllTestClients ¶
GetAllTestClients is used to quickly obtain a list of all the test clients.
func GetCguDefinition ¶
func GetCguDefinition( cguName string, clusterList []string, canaryList []string, managedPolicies []string, namespace string, maxConcurrency int, timeout int) cgu.CguBuilder
GetCguDefinition is used to get a CGU with simplified parameters.
func GetConfigurationPolicyDefinition ¶
func GetConfigurationPolicyDefinition( policyName string, complianceType configurationPolicyv1.ComplianceType, remediationAction configurationPolicyv1.RemediationAction, object runtime.Object) configurationPolicyv1.ConfigurationPolicy
GetConfigurationPolicyDefinition is used to get a configuration policy that contains the provided object.
func GetPlacementBindingDefinition ¶
func GetPlacementBindingDefinition( placementBindingName string, policySetName string, placementRuleName string, namespace string) ocm.PlacementBindingBuilder
GetPlacementBindingDefinition is used to get a placement binding to use with a cgu.
func GetPlacementFieldDefinition ¶
func GetPlacementFieldDefinition( clusters []string, clusterSelector metav1.LabelSelector) placementrulev1.GenericPlacementFields
GetPlacementFieldDefinition is used to get a generic placement field for use with a placement rule.
func GetPlacementRuleDefinition ¶
func GetPlacementRuleDefinition( placementRuleName string, namespace string, placementFields placementrulev1.GenericPlacementFields) ocm.PlacementRuleBuilder
GetPlacementRuleDefinition is used to get a placement rule to use with a cgu.
func GetPolicyDefinition ¶
func GetPolicyDefinition( policyName string, namespace string, object runtime.Object, remediationAction configurationPolicyv1.RemediationAction) ocm.PolicyBuilder
GetPolicyDefinition is used to get a policy that can be used with a CGU.
func GetPolicySetDefinition ¶
func GetPolicySetDefinition( policySetName string, policyList []policiesv1beta1.NonEmptyString, namespace string) ocm.PolicySetBuilder
GetPolicySetDefinition is used to get a policy set for the provided policies.
func IsCguExist ¶
IsCguExist can be used to check if a specific cgu exists.
func IsClusterInProgressInCgu ¶
func IsClusterInProgressInCgu( client *clients.Settings, cguName string, clusterName string, namespace string) (bool, error)
IsClusterInProgressInCgu can be used to check if a particular cluster is actively being remediated in the provided cgu and namespace.
func IsClusterStartedInCgu ¶
func IsClusterStartedInCgu( client *clients.Settings, cguName string, clusterName string, namespace string) (bool, error)
IsClusterStartedInCgu can be used to check if a particular cluster has started being remediated in the provided cgu and namespace.
func IsPolicyExist ¶
IsPolicyExist can be used to check if a specific policy exists.
func VerifyTalmIsInstalled ¶
func VerifyTalmIsInstalled() error
VerifyTalmIsInstalled checks that talm pod+container is present and that CGUs can be fetched.
func WaitForCguInCondition ¶
func WaitForCguInCondition( client *clients.Settings, cguName string, namespace string, conditionType string, expectedMessage string, expectedStatus metav1.ConditionStatus, expectedReason string, timeout time.Duration) error
WaitForCguInCondition waits until a specified condition type matches the provided message and/or status.
func WaitForCguToFinishSuccessfully ¶
WaitForCguToFinishSuccessfully waits until the provided CGU reaches the succeeded state and all clusters were successful message.
func WaitForClusterInProgressInCgu ¶
func WaitForClusterInProgressInCgu( client *clients.Settings, cguName string, clusterName string, namespace string, timeout time.Duration) error
WaitForClusterInProgressInCgu can be used to wait until the provided cluster is actively being remediated in the provided cgu and namespace.
func WaitUntilObjectExists ¶
func WaitUntilObjectExists( client *clients.Settings, objectName string, namespace string, getStatus func(client *clients.Settings, objectName string, namespace string) (bool, error)) error
WaitUntilObjectExists can be called to wait until a specified resource is present. This is called by all of the CreateXAndWait functions in this file.
Types ¶
This section is empty.