util

package
v0.0.0-...-ea6de2e Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterUidTest              = "cluster-uid-test"
	ClusterNameTest             = "cluster-name-test"
	TestNamespaceName           = "test-namespace"
	OperatorNamespace           = "test-operator-namespace"
	OTelCollectorNamePrefixTest = "unit-test"

	CronJobNamePrefix     = "cronjob"
	DaemonSetNamePrefix   = "daemonset"
	DeploymentNamePrefix  = "deployment"
	JobNamePrefix         = "job"
	PodNamePrefix         = "pod"
	ReplicaSetNamePrefix  = "replicaset"
	StatefulSetNamePrefix = "statefulset"

	OperatorVersionTest                   = "1.2.3"
	OperatorImageTest                     = "some-registry.com:1234/dash0hq/operator-controller:1.2.3"
	InitContainerImageTest                = "some-registry.com:1234/dash0hq/instrumentation:4.5.6"
	CollectorImageTest                    = "some-registry.com:1234/dash0hq/collector:7.8.9"
	ConfigurationReloaderImageTest        = "some-registry.com:1234/dash0hq/configuration-reloader:10.11.12"
	FilelogOffsetSyncImageTest            = "some-registry.com:1234/dash0hq/filelog-offset-sync:13.14.15"
	FilelogOffsetVolumeOwnershipImageTest = "some-registry.com:1234/dash0hq/filelog-offset-volume-ownership:16.17.18"

	OTelCollectorNodeLocalBaseUrlTest = "http://$(DASH0_NODE_IP):40318"
	OTelCollectorServiceBaseUrlTest   = "http://unit-test-opentelemetry-collector-service.test-operator-namespace.svc.cluster.local:4318"
	EndpointDash0Test                 = "endpoint.dash0.com:4317"
	EndpointDash0TestAlternative      = "endpoint-alternative.dash0.com:4317"
	EndpointDash0TestQuoted           = "\"endpoint.dash0.com:4317\""
	EndpointDash0WithProtocolTest     = "https://endpoint.dash0.com:4317"
	EndpointGrpcTest                  = "endpoint.backend.com:4317"
	EndpointGrpcWithProtocolTest      = "dns://endpoint.backend.com:4317"
	EndpointHttpTest                  = "https://endpoint.backend.com:4318"

	ApiEndpointTest   = "https://api.dash0.com"
	DatasetCustomTest = "test-dataset"
)
View Source
const (
	OperatorWebhookServiceName        = "dash0-operator-webhook-service"
	OperatorConfigurationResourceName = "dash0-operator-configuration-test"
)
View Source
const (
	MonitoringResourceName = "dash0-monitoring-test-resource"
)
View Source
const (
	NamePrefix = "unit-test"
)

Variables

View Source
var (
	ExpectedDaemonSetServiceAccountName             = fmt.Sprintf("%s-opentelemetry-collector-sa", NamePrefix)
	ExpectedDaemonSetCollectorConfigMapName         = fmt.Sprintf("%s-opentelemetry-collector-agent-cm", NamePrefix)
	ExpectedDaemonSetFilelogOffsetSyncConfigMapName = fmt.Sprintf("%s-filelogoffsets-cm", NamePrefix)
	ExpectedDaemonSetClusterRoleName                = fmt.Sprintf("%s-opentelemetry-collector-cr", NamePrefix)
	ExpectedDaemonSetClusterRoleBinding             = fmt.Sprintf("%s-opentelemetry-collector-crb", NamePrefix)
	ExpectedDaemonSetRoleName                       = fmt.Sprintf("%s-opentelemetry-collector-role", NamePrefix)
	ExpectedDaemonSetRoleBindingName                = fmt.Sprintf("%s-opentelemetry-collector-rolebinding", NamePrefix)
	ExpectedDaemonSetServiceName                    = fmt.Sprintf("%s-opentelemetry-collector-service", NamePrefix)
	ExpectedDaemonSetName                           = fmt.Sprintf(
		"%s-opentelemetry-collector-agent-daemonset",
		NamePrefix,
	)
	ExpectedDeploymentServiceAccountName     = fmt.Sprintf("%s-cluster-metrics-collector-sa", NamePrefix)
	ExpectedDeploymentClusterRoleName        = fmt.Sprintf("%s-cluster-metrics-collector-cr", NamePrefix)
	ExpectedDeploymentClusterRoleBindingName = fmt.Sprintf("%s-cluster-metrics-collector-crb", NamePrefix)
	ExpectedDeploymentCollectorConfigMapName = fmt.Sprintf("%s-cluster-metrics-collector-cm", NamePrefix)
	ExpectedDeploymentName                   = fmt.Sprintf("%s-cluster-metrics-collector-deployment", NamePrefix)

	AllClusterMetricsRelatedResources = []expectedResource{
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		expectedResourceDeploymentConfigMap,
		expectedResourceDeployment,
	}
	AllDaemonSetRelatedResources = []expectedResource{
		{/* contains filtered or unexported fields */},
		expectedResourceDaemonSetConfigMap,
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		expectedResourceDaemonSet,
	}
	AllDeploymentRelatedResources = []expectedResource{
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		expectedResourceDeploymentConfigMap,
		expectedResourceDeployment,
	}
	AllExpectedResources = append(
		AllDaemonSetRelatedResources,
		AllDeploymentRelatedResources...,
	)
)
View Source
var (
	AuthorizationTokenTest             = "authorization-token-test"
	AuthorizationHeaderTest            = fmt.Sprintf("Bearer %s", AuthorizationTokenTest)
	AuthorizationTokenTestAlternative  = "authorization-token-test-alternative"
	AuthorizationHeaderTestAlternative = fmt.Sprintf("Bearer %s", AuthorizationTokenTestAlternative)
	AuthorizationTokenTestFromSecret   = "authorization-token-test-from-secret"
	AuthorizationHeaderTestFromSecret  = fmt.Sprintf("Bearer %s", AuthorizationTokenTestFromSecret)
	SecretRefTest                      = dash0common.SecretRef{
		Name: "secret-ref",
		Key:  "key",
	}

	ArbitraryNumer int64 = 1302

	TestImages = util.Images{
		OperatorImage:                               OperatorImageTest,
		InitContainerImage:                          InitContainerImageTest,
		InitContainerImagePullPolicy:                corev1.PullAlways,
		CollectorImage:                              CollectorImageTest,
		CollectorImagePullPolicy:                    corev1.PullAlways,
		ConfigurationReloaderImage:                  ConfigurationReloaderImageTest,
		ConfigurationReloaderImagePullPolicy:        corev1.PullAlways,
		FilelogOffsetSyncImage:                      FilelogOffsetSyncImageTest,
		FilelogOffsetSyncImagePullPolicy:            corev1.PullAlways,
		FilelogOffsetVolumeOwnershipImage:           FilelogOffsetVolumeOwnershipImageTest,
		FilelogOffsetVolumeOwnershipImagePullPolicy: corev1.PullAlways,
	}

	OperatorManagerDeploymentUIDStr = "2f009c75-d69f-4b02-9d9d-fa17e76f5c1d"
	OperatorManagerDeploymentUID    = types.UID(OperatorManagerDeploymentUIDStr)
	OperatorManagerDeploymentName   = "unit-test-dash0-operator-controller"
	OperatorManagerDeployment       = &appsv1.Deployment{
		ObjectMeta: metav1.ObjectMeta{
			Namespace: OperatorNamespace,
			Name:      OperatorManagerDeploymentName,
			UID:       types.UID(OperatorManagerDeploymentUIDStr),
		},
	}

	DanglingEventsTimeoutsTest = util.DanglingEventsTimeouts{
		InitialTimeout: 0 * time.Second,
		Backoff: wait.Backoff{
			Steps:    1,
			Duration: 0 * time.Second,
			Factor:   1,
			Jitter:   0,
		},
	}
)
View Source
var (
	MonitoringResourceQualifiedName = types.NamespacedName{
		Namespace: TestNamespaceName,
		Name:      MonitoringResourceName,
	}
	MonitoringResourceDefaultObjectMeta = metav1.ObjectMeta{
		Namespace: TestNamespaceName,
		Name:      MonitoringResourceName,
	}
	MonitoringResourceObjectMetaWithLabelAndAnnotation = metav1.ObjectMeta{
		Namespace: TestNamespaceName,
		Name:      MonitoringResourceName,
		Labels: map[string]string{
			"test-label": "test-value",
		},
		Annotations: map[string]string{
			"test-annotation": "test-value",
		},
	}
	MonitoringResourceDefaultSpec = dash0v1beta1.Dash0MonitoringSpec{
		InstrumentWorkloads: dash0v1beta1.InstrumentWorkloads{
			LabelSelector: util.DefaultAutoInstrumentationLabelSelector,
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint: EndpointDash0Test,
				Authorization: dash0common.Authorization{
					Token: &AuthorizationTokenTest,
				},
			},
		},
	}

	DefaultNamespaceInstrumentationConfig = util.NamespaceInstrumentationConfig{
		InstrumentationLabelSelector: util.DefaultAutoInstrumentationLabelSelector,
	}
)
View Source
var (
	OperatorConfigurationResourceDefaultObjectMeta = metav1.ObjectMeta{
		Name: OperatorConfigurationResourceName,
	}

	OperatorConfigurationResourceWithoutExport = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
	}

	OperatorConfigurationResourceDash0ExportWithoutApiEndpointWithToken = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint: EndpointDash0Test,
				Authorization: dash0common.Authorization{
					Token: &AuthorizationTokenTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceDash0ExportWithoutApiEndpointWithSecretRef = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint: EndpointDash0Test,
				Authorization: dash0common.Authorization{
					SecretRef: &SecretRefTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceDash0ExportWithApiEndpointWithToken = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint:    EndpointDash0Test,
				ApiEndpoint: ApiEndpointTest,
				Authorization: dash0common.Authorization{
					Token: &AuthorizationTokenTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceDash0ExportWithApiEndpointWithSecretRef = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint:    EndpointDash0Test,
				ApiEndpoint: ApiEndpointTest,
				Authorization: dash0common.Authorization{
					SecretRef: &SecretRefTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceWithoutSelfMonitoringWithToken = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(false),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint:    EndpointDash0Test,
				ApiEndpoint: ApiEndpointTest,
				Authorization: dash0common.Authorization{
					Token: &AuthorizationTokenTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceWithSelfMonitoringWithToken = dash0v1alpha1.Dash0OperatorConfigurationSpec{
		SelfMonitoring: dash0v1alpha1.SelfMonitoring{
			Enabled: ptr.To(true),
		},
		Export: &dash0common.Export{
			Dash0: &dash0common.Dash0Configuration{
				Endpoint: EndpointDash0Test,
				Authorization: dash0common.Authorization{
					Token: &AuthorizationTokenTest,
				},
			},
		},
		KubernetesInfrastructureMetricsCollection: dash0v1alpha1.KubernetesInfrastructureMetricsCollection{
			Enabled: ptr.To(true),
		},
		CollectPodLabelsAndAnnotations: dash0v1alpha1.CollectPodLabelsAndAnnotations{
			Enabled: ptr.To(true),
		},
	}

	OperatorConfigurationResourceDefaultSpec = OperatorConfigurationResourceWithSelfMonitoringWithToken
)
View Source
var (
	PersesDashboardCrdQualifiedName = types.NamespacedName{
		Name: "persesdashboards.perses.dev",
	}

	PrometheusRuleCrdQualifiedName = types.NamespacedName{
		Name: "prometheusrules.monitoring.coreos.com",
	}
)
View Source
var (
	ExpectManagedFields = VerifyOpts{
		VerifyManagedFields: true,
		ExpectManagedFields: true,
	}
	IgnoreManagedFields = VerifyOpts{
		VerifyManagedFields: false,
	}
	VerifyNoManagedFields = VerifyOpts{
		VerifyManagedFields: true,
		ExpectManagedFields: false,
	}
)

Functions

func AddAnnotation

func AddAnnotation(meta *metav1.ObjectMeta, key string, value string)

func AddLabel

func AddLabel(meta *metav1.ObjectMeta, key string, value string)

func AddManagedFields

func AddManagedFields(meta *metav1.ObjectMeta)

func AddOptOutLabel

func AddOptOutLabel(meta *metav1.ObjectMeta)

func BasicCronJob

func BasicCronJob(namespace string, name string) *batchv1.CronJob

func BasicDaemonSet

func BasicDaemonSet(namespace string, name string) *appsv1.DaemonSet

func BasicDeployment

func BasicDeployment(namespace string, name string) *appsv1.Deployment

func BasicJob

func BasicJob(namespace string, name string) *batchv1.Job

func BasicPod

func BasicPod(namespace string, name string) *corev1.Pod

func BasicReplicaSet

func BasicReplicaSet(namespace string, name string) *appsv1.ReplicaSet

func BasicStatefulSet

func BasicStatefulSet(namespace string, name string) *appsv1.StatefulSet

func CreateBasicCronJob

func CreateBasicCronJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.CronJob

func CreateBasicDaemonSet

func CreateBasicDaemonSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.DaemonSet

func CreateBasicDeployment

func CreateBasicDeployment(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.Deployment

func CreateBasicJob

func CreateBasicJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.Job

func CreateBasicPod

func CreateBasicPod(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *corev1.Pod

func CreateBasicReplicaSet

func CreateBasicReplicaSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.ReplicaSet

func CreateBasicStatefulSet

func CreateBasicStatefulSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.StatefulSet

func CreateCronJobWithOptOutLabel

func CreateCronJobWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.CronJob

func CreateDaemonSetWithOptOutLabel

func CreateDaemonSetWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.DaemonSet

func CreateDefaultMonitoringResource

func CreateDefaultMonitoringResource(
	ctx context.Context,
	k8sClient client.Client,
	monitoringResourceName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func CreateDefaultOperatorConfigurationResource

func CreateDefaultOperatorConfigurationResource(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1alpha1.Dash0OperatorConfiguration

func CreateDeploymentWithOptOutLabel

func CreateDeploymentWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.Deployment

func CreateInstrumentedCronJob

func CreateInstrumentedCronJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.CronJob

func CreateInstrumentedDaemonSet

func CreateInstrumentedDaemonSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.DaemonSet

func CreateInstrumentedDeployment

func CreateInstrumentedDeployment(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.Deployment

func CreateInstrumentedJob

func CreateInstrumentedJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.Job

func CreateInstrumentedPod

func CreateInstrumentedPod(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *corev1.Pod

func CreateInstrumentedReplicaSet

func CreateInstrumentedReplicaSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.ReplicaSet

func CreateInstrumentedStatefulSet

func CreateInstrumentedStatefulSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.StatefulSet

func CreateJobForWhichAnInstrumentationAttemptHasFailed

func CreateJobForWhichAnInstrumentationAttemptHasFailed(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.Job

func CreateJobWithOptOutLabel

func CreateJobWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.Job

func CreateMonitoringResource

func CreateMonitoringResource(
	ctx context.Context,
	k8sClient client.Client,
	monitoringResource *dash0v1beta1.Dash0Monitoring,
) *dash0v1beta1.Dash0Monitoring

func CreateMonitoringResourceWithPotentialError

func CreateMonitoringResourceWithPotentialError(
	ctx context.Context,
	k8sClient client.Client,
	monitoringResource *dash0v1beta1.Dash0Monitoring,
) (*dash0v1beta1.Dash0Monitoring, error)

func CreateOperatorConfigurationAutoResource

func CreateOperatorConfigurationAutoResource(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1alpha1.Dash0OperatorConfiguration

func CreateOperatorConfigurationResource

func CreateOperatorConfigurationResource(
	ctx context.Context,
	k8sClient client.Client,
	operatorConfigurationResource *dash0v1alpha1.Dash0OperatorConfiguration,
) (*dash0v1alpha1.Dash0OperatorConfiguration, error)

func CreateOperatorConfigurationResourceWithName

func CreateOperatorConfigurationResourceWithName(
	ctx context.Context,
	k8sClient client.Client,
	resourceName string,
	operatorConfigurationSpec dash0v1alpha1.Dash0OperatorConfigurationSpec,
) *dash0v1alpha1.Dash0OperatorConfiguration

func CreateOperatorConfigurationResourceWithSpec

func CreateOperatorConfigurationResourceWithSpec(
	ctx context.Context,
	k8sClient client.Client,
	operatorConfigurationSpec dash0v1alpha1.Dash0OperatorConfigurationSpec,
) *dash0v1alpha1.Dash0OperatorConfiguration

func CreatePodOwnedByReplicaSet

func CreatePodOwnedByReplicaSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *corev1.Pod

func CreatePodWithOptOutLabel

func CreatePodWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *corev1.Pod

func CreateReplicaSetOwnedByDeployment

func CreateReplicaSetOwnedByDeployment(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.ReplicaSet

func CreateReplicaSetWithOptOutLabel

func CreateReplicaSetWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.ReplicaSet

func CreateStatefulSetWithOptOutLabel

func CreateStatefulSetWithOptOutLabel(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.StatefulSet

func CreateWorkload

func CreateWorkload(ctx context.Context, k8sClient client.Client, workload client.Object) client.Object

func CronJobWithOptOutLabel

func CronJobWithOptOutLabel(namespace string, name string) *batchv1.CronJob

func DaemonSetWithOptOutLabel

func DaemonSetWithOptOutLabel(namespace string, name string) *appsv1.DaemonSet

func Dash0ExportWithEndpointAndSecretRef

func Dash0ExportWithEndpointAndSecretRef() *dash0common.Export

func Dash0ExportWithEndpointAndToken

func Dash0ExportWithEndpointAndToken() *dash0common.Export

func Dash0ExportWithEndpointTokenAndCustomDataset

func Dash0ExportWithEndpointTokenAndCustomDataset() *dash0common.Export

func DefaultMonitoringResource

func DefaultMonitoringResource() *dash0v1beta1.Dash0Monitoring

func DefaultMonitoringResourceWithName

func DefaultMonitoringResourceWithName(monitoringResourceName types.NamespacedName) *dash0v1beta1.Dash0Monitoring

func DefaultOperatorConfigurationResource

func DefaultOperatorConfigurationResource() *dash0v1alpha1.Dash0OperatorConfiguration

func DefaultSecret

func DefaultSecret() *corev1.Secret

func DeleteAllCreatedObjects

func DeleteAllCreatedObjects(
	ctx context.Context,
	k8sClient client.Client,
	createdObjects []client.Object,
) []client.Object

func DeleteAllEvents

func DeleteAllEvents(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
)

func DeleteAllOperatorConfigurationResources

func DeleteAllOperatorConfigurationResources(
	ctx context.Context,
	k8sClient client.Client,
)

func DeleteMonitoringResource

func DeleteMonitoringResource(ctx context.Context, k8sClient client.Client)

func DeleteMonitoringResourceByName

func DeleteMonitoringResourceByName(
	ctx context.Context,
	k8sClient client.Client,
	monitoringResourceName types.NamespacedName,
	failOnErr bool,
)

func DeleteMonitoringResourceIfItExists

func DeleteMonitoringResourceIfItExists(ctx context.Context, k8sClient client.Client)

func DeploymentWithExistingDash0Artifacts

func DeploymentWithExistingDash0Artifacts(namespace string, name string) *appsv1.Deployment

func DeploymentWithMoreBellsAndWhistles

func DeploymentWithMoreBellsAndWhistles(namespace string, name string) *appsv1.Deployment

func DeploymentWithOptOutLabel

func DeploymentWithOptOutLabel(namespace string, name string) *appsv1.Deployment

func EnsureEmptyMonitoringResourceExistsAndIsAvailable

func EnsureEmptyMonitoringResourceExistsAndIsAvailable(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1beta1.Dash0Monitoring

func EnsureKubernetesObjectExists

func EnsureKubernetesObjectExists(
	ctx context.Context,
	k8sClient client.Client,
	qualifiedName types.NamespacedName,
	receiver client.Object,
	blueprint client.Object,
) client.Object

func EnsureMonitoringResourceExists

func EnsureMonitoringResourceExists(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceExistsAndIsAvailable

func EnsureMonitoringResourceExistsAndIsAvailable(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceExistsAndIsDegraded

func EnsureMonitoringResourceExistsAndIsDegraded(
	ctx context.Context,
	k8sClient client.Client,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceExistsInNamespaceAndIsAvailable

func EnsureMonitoringResourceExistsInNamespaceAndIsAvailable(
	ctx context.Context,
	k8sClient client.Client,
	namespacesName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceExistsWithInstrumentWorkloadsMode

func EnsureMonitoringResourceExistsWithInstrumentWorkloadsMode(
	ctx context.Context,
	k8sClient client.Client,
	instrumentWorkloadsMode dash0common.InstrumentWorkloadsMode,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceWithSpecExistsAndIsAvailable

func EnsureMonitoringResourceWithSpecExistsAndIsAvailable(
	ctx context.Context,
	k8sClient client.Client,
	spec dash0v1beta1.Dash0MonitoringSpec,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceWithSpecExistsInNamespace

func EnsureMonitoringResourceWithSpecExistsInNamespace(
	ctx context.Context,
	k8sClient client.Client,
	spec dash0v1beta1.Dash0MonitoringSpec,
	namespacedName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func EnsureMonitoringResourceWithSpecExistsInNamespaceAndIsAvailable

func EnsureMonitoringResourceWithSpecExistsInNamespaceAndIsAvailable(
	ctx context.Context,
	k8sClient client.Client,
	spec dash0v1beta1.Dash0MonitoringSpec,
	namespacesName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func EnsureNamespaceExists

func EnsureNamespaceExists(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
) *corev1.Namespace

func EnsureOperatorNamespaceExists

func EnsureOperatorNamespaceExists(ctx context.Context, k8sClient client.Client) *corev1.Namespace

func EnsurePersesDashboardCrdExists

func EnsurePersesDashboardCrdExists(
	ctx context.Context,
	k8sClient client.Client,
) *apiextensionsv1.CustomResourceDefinition

func EnsurePrometheusRuleCrdExists

func EnsurePrometheusRuleCrdExists(
	ctx context.Context,
	k8sClient client.Client,
) *apiextensionsv1.CustomResourceDefinition

func EnsureTestNamespaceExists

func EnsureTestNamespaceExists(ctx context.Context, k8sClient client.Client) *corev1.Namespace

func FindContainerByName

func FindContainerByName(containers []corev1.Container, name string) *corev1.Container

func FindEnvVarByName

func FindEnvVarByName(envVars []corev1.EnvVar, name string) *corev1.EnvVar

func FindVolumeByName

func FindVolumeByName(volumes []corev1.Volume, name string) *corev1.Volume

func FindVolumeMountByName

func FindVolumeMountByName(volumeMounts []corev1.VolumeMount, name string) *corev1.VolumeMount

func GetCronJob

func GetCronJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.CronJob

func GetDaemonSet

func GetDaemonSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.DaemonSet

func GetDeployment

func GetDeployment(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.Deployment

func GetDeploymentEventually

func GetDeploymentEventually(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	namespace string,
	name string,
) *appsv1.Deployment

func GetJob

func GetJob(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *batchv1.Job

func GetOTelColDaemonSet

func GetOTelColDaemonSet(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
) *appsv1.DaemonSet

func GetOTelColDaemonSetConfigMap

func GetOTelColDaemonSetConfigMap(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
) *corev1.ConfigMap

func GetOTelColDeployment

func GetOTelColDeployment(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
) *appsv1.Deployment

func GetOTelColDeploymentConfigMap

func GetOTelColDeploymentConfigMap(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
) *corev1.ConfigMap

func GetPod

func GetPod(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *corev1.Pod

func GetReplicaSet

func GetReplicaSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.ReplicaSet

func GetStatefulSet

func GetStatefulSet(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	name string,
) *appsv1.StatefulSet

func GrpcExportTest

func GrpcExportTest() *dash0common.Export

func HttpExportTest

func HttpExportTest() *dash0common.Export

func InstrumentedCronJob

func InstrumentedCronJob(namespace string, name string) *batchv1.CronJob

func InstrumentedDaemonSet

func InstrumentedDaemonSet(namespace string, name string) *appsv1.DaemonSet

func InstrumentedDeployment

func InstrumentedDeployment(namespace string, name string) *appsv1.Deployment

func InstrumentedDeploymentWithMoreBellsAndWhistles

func InstrumentedDeploymentWithMoreBellsAndWhistles(namespace string, name string) *appsv1.Deployment

func InstrumentedJob

func InstrumentedJob(namespace string, name string) *batchv1.Job

func InstrumentedPod

func InstrumentedPod(namespace string, name string) *corev1.Pod

func InstrumentedReplicaSet

func InstrumentedReplicaSet(namespace string, name string) *appsv1.ReplicaSet

func InstrumentedReplicaSetOwnedByDeployment

func InstrumentedReplicaSetOwnedByDeployment(namespace string, name string) *appsv1.ReplicaSet

func InstrumentedStatefulSet

func InstrumentedStatefulSet(namespace string, name string) *appsv1.StatefulSet

func JobForWhichAnInstrumentationAttemptHasFailed

func JobForWhichAnInstrumentationAttemptHasFailed(namespace string, name string) *batchv1.Job

func JobWithOptOutLabel

func JobWithOptOutLabel(namespace string, name string) *batchv1.Job

func LoadMonitoringResourceByName

func LoadMonitoringResourceByName(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	monitoringResourceName types.NamespacedName,
	failTestsOnNonExists bool,
) *dash0v1beta1.Dash0Monitoring

func LoadMonitoringResourceByNameIfItExists

func LoadMonitoringResourceByNameIfItExists(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	monitoringResourceName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func LoadMonitoringResourceByNameOrFail

func LoadMonitoringResourceByNameOrFail(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	monitoringResourceName types.NamespacedName,
) *dash0v1beta1.Dash0Monitoring

func LoadMonitoringResourceOrFail

func LoadMonitoringResourceOrFail(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
) *dash0v1beta1.Dash0Monitoring

func LoadMonitoringResourceStatusCondition

func LoadMonitoringResourceStatusCondition(
	ctx context.Context,
	k8sClient client.Client,
	monitoringResourceName types.NamespacedName,
	conditionType dash0common.ConditionType,
) *metav1.Condition

func LoadOperatorConfigurationResourceByName

func LoadOperatorConfigurationResourceByName(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	name string,
	failTestsOnNonExists bool,
) *dash0v1alpha1.Dash0OperatorConfiguration

func LoadOperatorConfigurationResourceByNameIfItExists

func LoadOperatorConfigurationResourceByNameIfItExists(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	name string,
) *dash0v1alpha1.Dash0OperatorConfiguration

func LoadOperatorConfigurationResourceByNameOrFail

func LoadOperatorConfigurationResourceByNameOrFail(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	name string,
) *dash0v1alpha1.Dash0OperatorConfiguration

func LoadOperatorConfigurationResourceOrFail

func LoadOperatorConfigurationResourceOrFail(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
) *dash0v1alpha1.Dash0OperatorConfiguration

func LoadOperatorConfigurationResourceStatusCondition

func LoadOperatorConfigurationResourceStatusCondition(
	ctx context.Context,
	k8sClient client.Client,
	operatorConfigurationResourceName string,
	conditionType dash0common.ConditionType,
) *metav1.Condition

func MatchEnvVar

func MatchEnvVar(name string, value string, args ...interface{}) gomega.OmegaMatcher

func MatchEvent

func MatchEvent(
	namespace string,
	resourceName string,
	reason util.Reason,
	message string,
	args ...interface{},
) gomega.OmegaMatcher

func MatchVolume

func MatchVolume(name string, args ...interface{}) gomega.OmegaMatcher

func MatchVolumeMount

func MatchVolumeMount(name string, mountPath string, args ...interface{}) gomega.OmegaMatcher

func Namespace

func Namespace(name string) *corev1.Namespace

func NoExport

func NoExport() *dash0common.Export

func PodOwnedByReplicaSet

func PodOwnedByReplicaSet(namespace string, name string) *corev1.Pod

func PodWithOptOutLabel

func PodWithOptOutLabel(namespace string, name string) *corev1.Pod

func RemoveLabel

func RemoveLabel(meta *metav1.ObjectMeta, key string)

func RemoveOperatorConfigurationResource

func RemoveOperatorConfigurationResource(ctx context.Context, k8sClient client.Client)

func RemoveOperatorConfigurationResourceByName

func RemoveOperatorConfigurationResourceByName(
	ctx context.Context,
	k8sClient client.Client,
	name string,
)

func RemoveOptOutLabel

func RemoveOptOutLabel(meta *metav1.ObjectMeta)

func ReplicaSetOwnedByDeployment

func ReplicaSetOwnedByDeployment(namespace string, name string) *appsv1.ReplicaSet

func ReplicaSetWithOptOutLabel

func ReplicaSetWithOptOutLabel(namespace string, name string) *appsv1.ReplicaSet

func StatefulSetWithOptOutLabel

func StatefulSetWithOptOutLabel(namespace string, name string) *appsv1.StatefulSet

func UniqueName

func UniqueName(prefix string) string

func UpdateInstrumentWorkloadsLabelSelector

func UpdateInstrumentWorkloadsLabelSelector(
	ctx context.Context,
	k8sClient client.Client,
	autoInstrumentationLabelSelector string,
)

func UpdateInstrumentWorkloadsMode

func UpdateInstrumentWorkloadsMode(
	ctx context.Context,
	k8sClient client.Client,
	instrumentWorkloads dash0common.InstrumentWorkloadsMode,
)

func UpdateInstrumentWorkloadsTraceContextPropagators

func UpdateInstrumentWorkloadsTraceContextPropagators(
	ctx context.Context,
	k8sClient client.Client,
	traceContextPropagators *string,
)

func UpdateLabel

func UpdateLabel(meta *metav1.ObjectMeta, key string, value string)

func UpdateWorkload

func UpdateWorkload(ctx context.Context, k8sClient client.Client, workload client.Object) client.Object

func VerifyAllResourcesExist

func VerifyAllResourcesExist(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
)

func VerifyCollectorDaemonSet

func VerifyCollectorDaemonSet(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
	authorizationToken string,

) *appsv1.DaemonSet

func VerifyCollectorDeployment

func VerifyCollectorDeployment(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
)

func VerifyCollectorResources

func VerifyCollectorResources(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
	dash0Endpoint string,
	authorizationToken string,
)

func VerifyCollectorResourcesDoNotExist

func VerifyCollectorResourcesDoNotExist(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
)

func VerifyCronJobWithOptOutLabel

func VerifyCronJobWithOptOutLabel(resource *batchv1.CronJob)

func VerifyDaemonSetCollectorConfigMap

func VerifyDaemonSetCollectorConfigMap(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
	dash0Endpoint string,
)

func VerifyDaemonSetWithOptOutLabel

func VerifyDaemonSetWithOptOutLabel(resource *appsv1.DaemonSet)

func VerifyDeploymentCollectorConfigMap

func VerifyDeploymentCollectorConfigMap(
	ctx context.Context,
	k8sClient client.Client,
	operatorNamespace string,
)

func VerifyDeploymentWithOptOutLabel

func VerifyDeploymentWithOptOutLabel(resource *appsv1.Deployment)

func VerifyEnvVar

func VerifyEnvVar(expectation EnvVarExpectation, actualEnvVars []corev1.EnvVar, name string, containerName string)

func VerifyEnvVarOrUnset

func VerifyEnvVarOrUnset(
	expectation *EnvVarExpectation,
	actualEnvVars []corev1.EnvVar,
	name string,
	containerName string,
)

func VerifyEnvVarsFromMap

func VerifyEnvVarsFromMap(
	expectedEnvVars map[string]*EnvVarExpectation,
	actualEnvVars []corev1.EnvVar,
)

func VerifyExpectedResourceDoesNotExist

func VerifyExpectedResourceDoesNotExist(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	expectedResource expectedResource,
)

func VerifyExpectedResourceExists

func VerifyExpectedResourceExists(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	expectedResource expectedResource,
) client.Object

func VerifyFailedInstrumentationEvent

func VerifyFailedInstrumentationEvent(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
	resourceName string,
	message string,
) *corev1.Event

func VerifyFailedUninstrumentationEvent

func VerifyFailedUninstrumentationEvent(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
	resourceName string,
	message string,
) *corev1.Event

func VerifyImmutableJobCouldNotBeModified

func VerifyImmutableJobCouldNotBeModified(resource *batchv1.Job)

func VerifyInstrumentationViaHigherOrderWorkloadEvent

func VerifyInstrumentationViaHigherOrderWorkloadEvent(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
	resourceName string,
	eventSource string,
) *corev1.Event

func VerifyJobWithOptOutLabel

func VerifyJobWithOptOutLabel(resource *batchv1.Job)

func VerifyModifiedCronJob

func VerifyModifiedCronJob(resource *batchv1.CronJob, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedDaemonSet

func VerifyModifiedDaemonSet(resource *appsv1.DaemonSet, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedDeployment

func VerifyModifiedDeployment(resource *appsv1.Deployment, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedJob

func VerifyModifiedJob(resource *batchv1.Job, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedJobAfterUnsuccessfulOptOut

func VerifyModifiedJobAfterUnsuccessfulOptOut(resource *batchv1.Job)

func VerifyModifiedPod

func VerifyModifiedPod(resource *corev1.Pod, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedReplicaSet

func VerifyModifiedReplicaSet(resource *appsv1.ReplicaSet, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyModifiedStatefulSet

func VerifyModifiedStatefulSet(resource *appsv1.StatefulSet, expectations PodSpecExpectations, opts ...VerifyOpts)

func VerifyMonitoringResourceByNameDoesNotExist

func VerifyMonitoringResourceByNameDoesNotExist(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	MonitoringResourceName types.NamespacedName,
)

func VerifyMonitoringResourceDoesNotExist

func VerifyMonitoringResourceDoesNotExist(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
)

func VerifyNoEvents

func VerifyNoEvents(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
)

func VerifyOperatorConfigurationResourceByNameDoesNotExist

func VerifyOperatorConfigurationResourceByNameDoesNotExist(
	ctx context.Context,
	k8sClient client.Client,
	g Gomega,
	name string,
)

func VerifyPodWithOptOutLabel

func VerifyPodWithOptOutLabel(resource *corev1.Pod)

func VerifyReplicaSetWithOptOutLabel

func VerifyReplicaSetWithOptOutLabel(resource *appsv1.ReplicaSet)

func VerifyResourceDoesNotExist

func VerifyResourceDoesNotExist(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	expectedName string,
	receiver client.Object,
)

func VerifyResourceExists

func VerifyResourceExists(
	ctx context.Context,
	k8sClient client.Client,
	namespace string,
	expectedName string,
	receiver client.Object,
) client.Object

func VerifyResourceStatusCondition

func VerifyResourceStatusCondition(
	g Gomega,
	condition *metav1.Condition,
	expectedStatus metav1.ConditionStatus,
	expectedReason string,
	expectedMessage string,
)

func VerifyRevertedDeployment

func VerifyRevertedDeployment(resource *appsv1.Deployment, expectations PodSpecExpectations)

func VerifyStatefulSetWithOptOutLabel

func VerifyStatefulSetWithOptOutLabel(resource *appsv1.StatefulSet)

func VerifySuccessfulInstrumentationEvent

func VerifySuccessfulInstrumentationEvent(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
	resourceName string,
	eventSource string,
) *corev1.Event

func VerifySuccessfulUninstrumentationEvent

func VerifySuccessfulUninstrumentationEvent(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	namespace string,
	resourceName string,
	eventSource string,
) *corev1.Event

func VerifySuccessfulUninstrumentationEventEventually

func VerifySuccessfulUninstrumentationEventEventually(
	ctx context.Context,
	clientset *kubernetes.Clientset,
	g Gomega,
	namespace string,
	resourceName string,
	eventSource string,
) *corev1.Event

func VerifyUnmodifiedCronJob

func VerifyUnmodifiedCronJob(resource *batchv1.CronJob)

func VerifyUnmodifiedDaemonSet

func VerifyUnmodifiedDaemonSet(resource *appsv1.DaemonSet)

func VerifyUnmodifiedDeployment

func VerifyUnmodifiedDeployment(resource *appsv1.Deployment)

func VerifyUnmodifiedDeploymentEventually

func VerifyUnmodifiedDeploymentEventually(g Gomega, resource *appsv1.Deployment)

func VerifyUnmodifiedJob

func VerifyUnmodifiedJob(resource *batchv1.Job)

func VerifyUnmodifiedPod

func VerifyUnmodifiedPod(resource *corev1.Pod)

func VerifyUnmodifiedReplicaSet

func VerifyUnmodifiedReplicaSet(resource *appsv1.ReplicaSet)

func VerifyUnmodifiedStatefulSet

func VerifyUnmodifiedStatefulSet(resource *appsv1.StatefulSet)

func VerifyWebhookIgnoreOnceLabelIsAbsent

func VerifyWebhookIgnoreOnceLabelIsAbsent(objectMeta *metav1.ObjectMeta)

func VerifyWebhookIgnoreOnceLabelIsPresent

func VerifyWebhookIgnoreOnceLabelIsPresent(objectMeta *metav1.ObjectMeta)

func VerifyWebhookIgnoreOnceLabelIsPresentEventually

func VerifyWebhookIgnoreOnceLabelIsPresentEventually(g Gomega, objectMeta *metav1.ObjectMeta)

func WebhookService

func WebhookService() corev1.Service

func WebhookServiceEndpointSlice

func WebhookServiceEndpointSlice(withPort bool, withReadyCondition bool) discoveryv1.EndpointSlice

func WrapConfigureCronJobFnAsTestableWorkload

func WrapConfigureCronJobFnAsTestableWorkload(
	fn func(string, string) *batchv1.CronJob,
) func(string, string) TestableWorkload

func WrapConfigureDaemonSetFnAsTestableWorkload

func WrapConfigureDaemonSetFnAsTestableWorkload(
	fn func(string, string) *appsv1.DaemonSet,
) func(string, string) TestableWorkload

func WrapConfigureDeploymentFnAsTestableWorkload

func WrapConfigureDeploymentFnAsTestableWorkload(
	fn func(string, string) *appsv1.Deployment,
) func(string, string) TestableWorkload

func WrapConfigureJobFnAsTestableWorkload

func WrapConfigureJobFnAsTestableWorkload(
	fn func(string, string) *batchv1.Job,
) func(string, string) TestableWorkload

func WrapConfigurePodFnAsTestableWorkload

func WrapConfigurePodFnAsTestableWorkload(
	fn func(string, string) *corev1.Pod,
) func(string, string) TestableWorkload

func WrapConfigureReplicaSetFnAsTestableWorkload

func WrapConfigureReplicaSetFnAsTestableWorkload(
	fn func(string, string) *appsv1.ReplicaSet,
) func(string, string) TestableWorkload

func WrapConfigureStatefulSetFnAsTestableWorkload

func WrapConfigureStatefulSetFnAsTestableWorkload(
	fn func(string, string) *appsv1.StatefulSet,
) func(string, string) TestableWorkload

Types

type CapturingLogSink

type CapturingLogSink struct {
	// contains filtered or unexported fields
}

func NewCapturingLogger

func NewCapturingLogger() (logr.Logger, *CapturingLogSink)

func (*CapturingLogSink) Enabled

func (s *CapturingLogSink) Enabled(_ int) bool

func (*CapturingLogSink) Error

func (s *CapturingLogSink) Error(err error, msg string, keysAndValues ...interface{})

func (*CapturingLogSink) HasLogMessage

func (s *CapturingLogSink) HasLogMessage(g Gomega, message string)

func (*CapturingLogSink) Info

func (s *CapturingLogSink) Info(level int, msg string, keysAndValues ...interface{})

func (*CapturingLogSink) Init

func (s *CapturingLogSink) Init(info logr.RuntimeInfo)

func (*CapturingLogSink) Reset

func (s *CapturingLogSink) Reset()

func (*CapturingLogSink) WithName

func (s *CapturingLogSink) WithName(_ string) logr.LogSink

func (*CapturingLogSink) WithValues

func (s *CapturingLogSink) WithValues(_ ...interface{}) logr.LogSink

type ContainerExpectations

type ContainerExpectations struct {
	ContainerName       string
	VolumeMounts        int
	Dash0VolumeMountIdx int
	EnvVars             map[string]*EnvVarExpectation
}

type CronJobTestableWorkload

type CronJobTestableWorkload struct {
	// contains filtered or unexported fields
}

func (CronJobTestableWorkload) Get

func (CronJobTestableWorkload) GetObjectMeta

func (w CronJobTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (CronJobTestableWorkload) GetPodSpec

func (w CronJobTestableWorkload) GetPodSpec() *corev1.PodSpec

type DaemonSetTestableWorkload

type DaemonSetTestableWorkload struct {
	// contains filtered or unexported fields
}

func (DaemonSetTestableWorkload) Get

func (DaemonSetTestableWorkload) GetObjectMeta

func (w DaemonSetTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (DaemonSetTestableWorkload) GetPodSpec

func (w DaemonSetTestableWorkload) GetPodSpec() *corev1.PodSpec

type DeploymentTestableWorkload

type DeploymentTestableWorkload struct {
	// contains filtered or unexported fields
}

func (DeploymentTestableWorkload) Get

func (DeploymentTestableWorkload) GetObjectMeta

func (w DeploymentTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (DeploymentTestableWorkload) GetPodSpec

func (w DeploymentTestableWorkload) GetPodSpec() *corev1.PodSpec

type DummyAuthTokenClient

type DummyAuthTokenClient struct {
	SetAuthTokenCalls    int
	RemoveAuthTokenCalls int
	AuthToken            string
}

func (*DummyAuthTokenClient) RemoveAuthToken

func (c *DummyAuthTokenClient) RemoveAuthToken(_ context.Context, _ *logr.Logger)

func (*DummyAuthTokenClient) Reset

func (c *DummyAuthTokenClient) Reset()

func (*DummyAuthTokenClient) ResetCallCounts

func (c *DummyAuthTokenClient) ResetCallCounts()

func (*DummyAuthTokenClient) SetAuthToken

func (c *DummyAuthTokenClient) SetAuthToken(_ context.Context, authToken string, _ *logr.Logger)

type DummyLeaderElectionAware

type DummyLeaderElectionAware struct {
	Leader bool
}

func (*DummyLeaderElectionAware) IsLeader

func (l *DummyLeaderElectionAware) IsLeader() bool

type DummySelfMonitoringMetricsClient

type DummySelfMonitoringMetricsClient struct {
	InitializeSelfMonitoringMetricsCalls int
}

func (*DummySelfMonitoringMetricsClient) InitializeSelfMonitoringMetrics

func (c *DummySelfMonitoringMetricsClient) InitializeSelfMonitoringMetrics(
	_ otelmetric.Meter,
	_ string,
	_ *logr.Logger,
)

func (*DummySelfMonitoringMetricsClient) Reset

func (*DummySelfMonitoringMetricsClient) ResetCallCounts

func (c *DummySelfMonitoringMetricsClient) ResetCallCounts()

type EnvVarExpectation

type EnvVarExpectation struct {
	Value                         string
	ValueFrom                     string
	UnorderedCommaSeparatedValues []string
}

type JobTestableWorkload

type JobTestableWorkload struct {
	// contains filtered or unexported fields
}

func (JobTestableWorkload) Get

func (JobTestableWorkload) GetObjectMeta

func (w JobTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (JobTestableWorkload) GetPodSpec

func (w JobTestableWorkload) GetPodSpec() *corev1.PodSpec

type LeaderElectionAwareMock

type LeaderElectionAwareMock struct {
	// contains filtered or unexported fields
}

func NewLeaderElectionAwareMock

func NewLeaderElectionAwareMock(isLeader bool) *LeaderElectionAwareMock

func (*LeaderElectionAwareMock) IsLeader

func (l *LeaderElectionAwareMock) IsLeader() bool

func (*LeaderElectionAwareMock) NeedLeaderElection

func (l *LeaderElectionAwareMock) NeedLeaderElection() bool

func (*LeaderElectionAwareMock) SetLeader

func (l *LeaderElectionAwareMock) SetLeader(isLeader bool)

type MatchEnvVarMatcher

type MatchEnvVarMatcher struct {
	Name  string
	Value string
	Args  []interface{}
}

func (*MatchEnvVarMatcher) FailureMessage

func (matcher *MatchEnvVarMatcher) FailureMessage(actual interface{}) (message string)

func (*MatchEnvVarMatcher) Match

func (matcher *MatchEnvVarMatcher) Match(actual interface{}) (success bool, err error)

func (*MatchEnvVarMatcher) NegatedFailureMessage

func (matcher *MatchEnvVarMatcher) NegatedFailureMessage(actual interface{}) (message string)

type MatchEnvVarValueFromSecretMatcher

type MatchEnvVarValueFromSecretMatcher struct {
	Name       string
	SecretName string
	SecretKey  string
	Args       []interface{}
}

func (*MatchEnvVarValueFromSecretMatcher) FailureMessage

func (matcher *MatchEnvVarValueFromSecretMatcher) FailureMessage(actual interface{}) (message string)

func (*MatchEnvVarValueFromSecretMatcher) Match

func (matcher *MatchEnvVarValueFromSecretMatcher) Match(actual interface{}) (success bool, err error)

func (*MatchEnvVarValueFromSecretMatcher) NegatedFailureMessage

func (matcher *MatchEnvVarValueFromSecretMatcher) NegatedFailureMessage(actual interface{}) (message string)

type MatchEventMatcher

type MatchEventMatcher struct {
	Namespace    string
	ResourceName string
	Reason       string
	Message      string
	Args         []interface{}
}

func (*MatchEventMatcher) FailureMessage

func (matcher *MatchEventMatcher) FailureMessage(actual interface{}) (message string)

func (*MatchEventMatcher) Match

func (matcher *MatchEventMatcher) Match(actual interface{}) (success bool, err error)

func (*MatchEventMatcher) NegatedFailureMessage

func (matcher *MatchEventMatcher) NegatedFailureMessage(actual interface{}) (message string)

type MatchVolumeMatcher

type MatchVolumeMatcher struct {
	Name string
	Args []interface{}
}

func (*MatchVolumeMatcher) FailureMessage

func (matcher *MatchVolumeMatcher) FailureMessage(actual interface{}) (message string)

func (*MatchVolumeMatcher) Match

func (matcher *MatchVolumeMatcher) Match(actual interface{}) (success bool, err error)

func (*MatchVolumeMatcher) NegatedFailureMessage

func (matcher *MatchVolumeMatcher) NegatedFailureMessage(actual interface{}) (message string)

type MatchVolumeMountMatcher

type MatchVolumeMountMatcher struct {
	Name      string
	MountPath string
	Args      []interface{}
}

func (*MatchVolumeMountMatcher) FailureMessage

func (matcher *MatchVolumeMountMatcher) FailureMessage(actual interface{}) (message string)

func (*MatchVolumeMountMatcher) Match

func (matcher *MatchVolumeMountMatcher) Match(actual interface{}) (success bool, err error)

func (*MatchVolumeMountMatcher) NegatedFailureMessage

func (matcher *MatchVolumeMountMatcher) NegatedFailureMessage(actual interface{}) (message string)

type PodSpecExpectations

type PodSpecExpectations struct {
	Volumes               int
	Dash0VolumeIdx        int
	InitContainers        int
	Dash0InitContainerIdx int
	Containers            []ContainerExpectations
}

func BasicInstrumentedPodSpecExpectations

func BasicInstrumentedPodSpecExpectations() PodSpecExpectations

type PodTestableWorkload

type PodTestableWorkload struct {
	// contains filtered or unexported fields
}

func (PodTestableWorkload) Get

func (PodTestableWorkload) GetObjectMeta

func (w PodTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (PodTestableWorkload) GetPodSpec

func (w PodTestableWorkload) GetPodSpec() *corev1.PodSpec

type ReplicaSetTestableWorkload

type ReplicaSetTestableWorkload struct {
	// contains filtered or unexported fields
}

func (ReplicaSetTestableWorkload) Get

func (ReplicaSetTestableWorkload) GetObjectMeta

func (w ReplicaSetTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (ReplicaSetTestableWorkload) GetPodSpec

func (w ReplicaSetTestableWorkload) GetPodSpec() *corev1.PodSpec

type StatefulSetTestableWorkload

type StatefulSetTestableWorkload struct {
	// contains filtered or unexported fields
}

func (StatefulSetTestableWorkload) Get

func (StatefulSetTestableWorkload) GetObjectMeta

func (w StatefulSetTestableWorkload) GetObjectMeta() *metav1.ObjectMeta

func (StatefulSetTestableWorkload) GetPodSpec

func (w StatefulSetTestableWorkload) GetPodSpec() *corev1.PodSpec

type TestableWorkload

type TestableWorkload interface {
	Get() client.Object
	GetObjectMeta() *metav1.ObjectMeta
	GetPodSpec() *corev1.PodSpec
}

type VerifyOpts

type VerifyOpts struct {
	VerifyManagedFields bool
	ExpectManagedFields bool
}

type WorkloadTestConfig

type WorkloadTestConfig struct {
	WorkloadNamePrefix string
	ConfigureFn        func(string, string) TestableWorkload
	CreateFn           func(context.Context, client.Client, string, string) TestableWorkload
	GetFn              func(context.Context, client.Client, string, string) TestableWorkload
	VerifyPreFn        func(TestableWorkload)
	VerifyFn           func(TestableWorkload)
}

Jump to

Keyboard shortcuts

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