utils

package
v0.0.0-...-365d84a Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClusterRole

func CreateClusterRole(c client.Client) error

func CreateClusterRoleBinding

func CreateClusterRoleBinding(c client.Client) error

func CreateMinioObjectStorageSecret

func CreateMinioObjectStorageSecret() error

func CreatePrometheus

func CreatePrometheus(c client.Client) error

func CreateServiceAccount

func CreateServiceAccount(c client.Client) error

create service account for prometheus

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is

func InstallCertManager

func InstallCertManager() error

InstallCertManager installs the cert manager bundle.

func InstallMinIO

func InstallMinIO() error

InstallMinIO installs the object store

func InstallPrometheusOperator

func InstallPrometheusOperator() error

InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(name string) error

LoadImageToKindClusterWithName loads a local docker image to the kind cluster

func RemoteWrite

func RemoteWrite(req RemoteWriteRequest, roundTripper http.RoundTripper, headers map[string]string) error

RemoteWrite sends a remote write request to the remote write endpoint which is running on localhost.

func Run

func Run(cmd *exec.Cmd) ([]byte, error)

Run executes the provided command within this context

func SetUpPrometheus

func SetUpPrometheus(c client.Client) error

func StartPortForward

func StartPortForward(ctx context.Context, port intstr.IntOrString, scheme, name, ns string) (func(), error)

StartPortForward initiates a port forwarding connection to a pod on the localhost interface. It returns a closer function that should be invoked to stop the proxy server. The function blocks until the port forwarding proxy server is ready to receive connections or the context is canceled.

func UninstallCertManager

func UninstallCertManager()

UninstallCertManager uninstalls the cert manager

func UninstallMinIO

func UninstallMinIO()

UninstallMinIO uninstalls the object store

func UninstallPrometheusOperator

func UninstallPrometheusOperator()

UninstallPrometheusOperator uninstalls the prometheus

func ValidateHasLabels

func ValidateHasLabels(t *testing.T, obj client.Object, labels map[string]string)

func ValidateIsNamedPodDisruptionBudget

func ValidateIsNamedPodDisruptionBudget(t *testing.T, obj client.Object, b manifests.Buildable, namespace string, matching client.Object)

func ValidateIsNamedServiceAccount

func ValidateIsNamedServiceAccount(t *testing.T, obj client.Object, b manifests.Buildable, namespace string)

func ValidateLabelsMatch

func ValidateLabelsMatch(t *testing.T, objWithSelector client.Object, matches client.Object)

func ValidateNameAndNamespace

func ValidateNameAndNamespace(t *testing.T, obj client.Object, name, namespace string)

func ValidateNameNamespaceAndLabels

func ValidateNameNamespaceAndLabels(t *testing.T, obj client.Object, name, namespace string, labels map[string]string)

func ValidateObjectLabelsEqual

func ValidateObjectLabelsEqual(t *testing.T, wantLabels map[string]string, onObjs ...client.Object)

func ValidateObjectsEqual

func ValidateObjectsEqual(t *testing.T, got client.Object, want client.Object)

func VerifyCfgMapOrSecretEnvVarExists

func VerifyCfgMapOrSecretEnvVarExists(c client.Client, obj client.Object, name, ns string, containerIndex int, envVarName string, key string, cfgOrSecret string) bool

func VerifyConfigMapContents

func VerifyConfigMapContents(c client.Client, name, namespace, key, expect string) bool

func VerifyConfigMapExists

func VerifyConfigMapExists(c client.Client, name, namespace string) bool

func VerifyDeploymentArgs

func VerifyDeploymentArgs(c client.Client, name string, namespace string, containerIndex int, containsArg string) bool

func VerifyDeploymentExists

func VerifyDeploymentExists(c client.Client, name string, namespace string) bool

func VerifyDeploymentReplicasRunning

func VerifyDeploymentReplicasRunning(c client.Client, expect int, name string, namespace string) bool

func VerifySecretExists

func VerifySecretExists(c client.Client, name string, namespace string) bool

func VerifyServiceAccountExists

func VerifyServiceAccountExists(c client.Client, name string, namespace string) bool

func VerifyServiceExists

func VerifyServiceExists(c client.Client, name string, namespace string) bool

func VerifyServiceMonitorExists

func VerifyServiceMonitorExists(c client.Client, name, ns string) bool

func VerifyStatefulSetArgs

func VerifyStatefulSetArgs(
	c client.Client,
	name string,
	namespace string,
	containerIndex int,
	containsArg string,
) bool

func VerifyStatefulSetExists

func VerifyStatefulSetExists(c client.Client, name string, namespace string) bool

func VerifyStatefulSetReplicas

func VerifyStatefulSetReplicas(c client.Client, expect int, name string, namespace string) bool

func VerifyStatefulSetReplicasRunning

func VerifyStatefulSetReplicasRunning(c client.Client, expect int, name string, namespace string) bool

Types

type PrometheusResponse

type PrometheusResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string `json:"resultType"`
		Result     []struct {
			Metric map[string]string `json:"metric"`
			Value  []interface{}     `json:"value"` // Use interface{} because value can be mixed types
		} `json:"result"`
	} `json:"data"`
}

func QueryPrometheus

func QueryPrometheus(query string) (*PrometheusResponse, error)

type RemoteWriteRequest

type RemoteWriteRequest struct {
	Data   []byte
	Labels map[string]string
}

RemoteWriteRequest is a struct that represents the request to be sent to the remote write endpoint.

func DefaultRemoteWriteRequest

func DefaultRemoteWriteRequest() RemoteWriteRequest

DefaultRemoteWriteRequest returns a default RemoteWriteRequest.

type Verifier

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

func (Verifier) Verify

func (v Verifier) Verify(c client.Client, name, ns string) bool

func (Verifier) WithConfigMap

func (v Verifier) WithConfigMap() Verifier

func (Verifier) WithDeployment

func (v Verifier) WithDeployment() Verifier

func (Verifier) WithSecret

func (v Verifier) WithSecret() Verifier

func (Verifier) WithService

func (v Verifier) WithService() Verifier

func (Verifier) WithServiceAccount

func (v Verifier) WithServiceAccount() Verifier

func (Verifier) WithServiceMonitor

func (v Verifier) WithServiceMonitor() Verifier

func (Verifier) WithStatefulSet

func (v Verifier) WithStatefulSet() Verifier

Jump to

Keyboard shortcuts

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