commontestutils

package
v0.0.0-...-e993711 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KLMPodPrefix    = "klm-controller-manager"
	KLMPodContainer = "manager"
)

Variables

View Source
var (
	ErrDeploymentNotReady = errors.New("deployment is not ready")
	ErrDeploymentUpdating = errors.New("deployment is still updating")
)
View Source
var (
	ErrPodNotFound = errors.New("could not find pod")
	ErrLogNotFound = errors.New("logMsg was not found in log")
)
View Source
var (
	ErrSecretNotFound      = errors.New("secret does not exist")
	ErrCertificateNotFound = errors.New("certificate does not exist")
)
View Source
var ErrMetricNotFound = errors.New("metric was not found")
View Source
var ErrStatefulSetNotReady = errors.New("statefulset is not ready")

Functions

func AssertKymaStateMetricNotFound

func AssertKymaStateMetricNotFound(ctx context.Context, kymaName string, state shared.State) error

func CertificateExists

func CertificateExists(ctx context.Context, certificateName types.NamespacedName, k8sClient client.Client) error

func CertificateSecretExists

func CertificateSecretExists(ctx context.Context, secretName types.NamespacedName, k8sClient client.Client) error

func CertificateSecretIsCreatedAfter

func CertificateSecretIsCreatedAfter(ctx context.Context,
	secretName types.NamespacedName, k8sClient client.Client, notBeforeTime *apimetav1.Time,
) error

func CertificateSecretIsSyncedToSkrCluster

func CertificateSecretIsSyncedToSkrCluster(ctx context.Context,
	kcpSecretName types.NamespacedName, kcpClient client.Client,
	skrSecretName types.NamespacedName, skrClient client.Client,
) error

func CheckPodLogs

func CheckPodLogs(ctx context.Context,
	namespace, podPrefix, container, logMsg string,
	restConfig *rest.Config,
	k8sClient client.Client,
	logsSince *apimetav1.Time,
) error

func DeleteCertificateSecret

func DeleteCertificateSecret(ctx context.Context, secret types.NamespacedName, k8sClient client.Client,
) error

func DeploymentIsReady

func DeploymentIsReady(ctx context.Context, clnt client.Client, name, namespace string) error

func EnableDeployment

func EnableDeployment(ctx context.Context, clnt client.Client,
	name, namespace string,
) error

func GatewaySecretCreationTimeIsUpdated

func GatewaySecretCreationTimeIsUpdated(ctx context.Context, oldTime time.Time, kcpClient client.Client) error

func GetCACertificate

func GetCACertificate(ctx context.Context, namespacedCertName types.NamespacedName, k8sClient client.Client,
) (*certmanagerv1.Certificate, error)

func GetClusterRoleBindingPolicyRules

func GetClusterRoleBindingPolicyRules(ctx context.Context, clnt client.Client, roleName string,
	clusterRoleBindings apirbacv1.ClusterRoleBindingList,
) ([]apirbacv1.PolicyRule, error)

func GetDeployment

func GetDeployment(ctx context.Context, clnt client.Client,
	name, namespace string,
) (*apiappsv1.Deployment, error)

func GetGatewaySecret

func GetGatewaySecret(ctx context.Context, clnt client.Client) (*apicorev1.Secret, error)

func GetKymaStateMetricCount

func GetKymaStateMetricCount(ctx context.Context, kymaName string, state shared.State) (int, error)

func GetLastModifiedTimeFromAnnotation

func GetLastModifiedTimeFromAnnotation(secret *apicorev1.Secret) (time.Time, error)

func GetMaintenanceWindowGauge

func GetMaintenanceWindowGauge(ctx context.Context) (int, error)

func GetMandatoryModuleStateMetric

func GetMandatoryModuleStateMetric(ctx context.Context, kymaName, moduleName, state string) (int, error)

func GetMandatoryModuleTemplateCountMetric

func GetMandatoryModuleTemplateCountMetric(ctx context.Context) (int, error)

func GetModuleStateMetricCount

func GetModuleStateMetricCount(ctx context.Context, kymaName, moduleName string, state shared.State) (int, error)

func GetRequeueReasonCount

func GetRequeueReasonCount(ctx context.Context,
	requeueReason, requeueType string,
) (int, error)

func GetRoleBindingRolePolicyRules

func GetRoleBindingRolePolicyRules(ctx context.Context, clnt client.Client, roleName, namespace string,
	roleBindings apirbacv1.RoleBindingList,
) ([]apirbacv1.PolicyRule, error)

func GetRoleBindingwithClusterRolePolicyRules

func GetRoleBindingwithClusterRolePolicyRules(ctx context.Context, clnt client.Client, roleName string,
	roleBindings apirbacv1.RoleBindingList,
) ([]apirbacv1.PolicyRule, error)

func GetSelfSignedCertNotRenewMetricsGauge

func GetSelfSignedCertNotRenewMetricsGauge(ctx context.Context, kymaName string) (int, error)

func GetStatefulSet

func GetStatefulSet(ctx context.Context, clnt client.Client,
	name, namespace string,
) (*apiappsv1.StatefulSet, error)

func GetTLSSecret

func GetTLSSecret(ctx context.Context, namespacedSecretName types.NamespacedName, k8sClient client.Client,
) (*apicorev1.Secret, error)

func IsManifestRequeueReasonCountIncreased

func IsManifestRequeueReasonCountIncreased(ctx context.Context, requeueReason, requeueType string) (bool,
	error,
)

func IstioGatewaySecretIsSyncedToRootCA

func IstioGatewaySecretIsSyncedToRootCA(ctx context.Context,
	rootCASecretName types.NamespacedName, kcpClient client.Client,
) error

func ListKlmClusterRoleBindings

func ListKlmClusterRoleBindings(clnt client.Client, ctx context.Context,
	serviceAccountName string,
) (apirbacv1.ClusterRoleBindingList, error)

func ListKlmRoleBindings

func ListKlmRoleBindings(clnt client.Client, ctx context.Context,
	serviceAccountName, namespace string,
) (apirbacv1.RoleBindingList, error)

func PurgeMetricsAreAsExpected

func PurgeMetricsAreAsExpected(ctx context.Context,
	timeShouldBeMoreThan float64,
	expectedRequests int,
) bool

func StatefulSetIsReady

func StatefulSetIsReady(ctx context.Context, clnt client.Client, name, namespace string) error

func StopDeployment

func StopDeployment(ctx context.Context, clnt client.Client,
	name, namespace string,
) error

func TLSSecretRotated

func TLSSecretRotated(ctx context.Context, oldValue time.Time,
	namespacedSecretName types.NamespacedName, kcpClient client.Client,
) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL