utils

package
v0.0.1-alpha.0...-460f660 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ImageList = []string{"RELATED_IMAGE_MCSP_UTILS", "RELATED_IMAGE_ACCOUNT_IAM", "RELATED_IMAGE_MCSP_IM_CONFIG_JOB", "RELATED_IMAGE_INSTANCE_MANAGEMENT_SERVICE", "RELATED_IMAGE_API_SERVICE"}
)

Functions

func CalculateHashes

func CalculateHashes(fromCluster *unstructured.Unstructured, fromTemplate *unstructured.Unstructured) (string, string, error)

CalculateHashes calculates the hash for the existing cluster resource and the new template resource

func CheckCRD

func CheckCRD(config *rest.Config, apiGroupVersion string, kind string) (bool, error)

CheckCRD returns true if the given crd is existent

func CombineData

func CombineData(dataStructs ...interface{}) map[string]interface{}

func Concat

func Concat(s ...string) string

func GetHost

func GetHost(ctx context.Context, k8sClient client.Client, name string, ns string) (string, error)

Get the host of the route

func GetImage

func GetImage(imageName string) string

func GetOperatorNamespace

func GetOperatorNamespace() string

GetOperatorNamespace returns the Namespace of the operator

func GetSecretData

func GetSecretData(ctx context.Context, k8sClient client.Client, secretName, ns, dataKey string) (string, error)

GetSecretData gets the data from a secret

func GetWatchNamespace

func GetWatchNamespace() string

GetWatchNamespace returns the Namespace of the operator

func IndentCert

func IndentCert(cert string, indentSpaces int) string

indentCertificate to add indentation to each line of the certificate

func InsertColonInURL

func InsertColonInURL(redisURL string) string

InsertColonInRedisURL inserts colon in the redis URL SSL

func MergeCR

func MergeCR(defaultCR, changedCR []byte) map[string]interface{}

MergeCR deep merges two custom resource specs, along with labels and annotations.

func MergeResources

func MergeResources(fromCluster, fromTemplate *unstructured.Unstructured) (*unstructured.Unstructured, error)

MergeResources merges two complete unstructured Kubernetes resources

func NewUnstructured

func NewUnstructured(group, kind, version string) *unstructured.Unstructured

NewUnstructured return Unstructured object

func RandStrings

func RandStrings(lengths ...int) ([][]byte, error)

RandStrings generates series of random strings by given lengths

func ReplaceImages

func ReplaceImages(resource string) (result string)

func ResourceExists

func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error)

ResourceExists returns true if the given resource kind exists in the given api groupversion

func SetHashAnnotation

func SetHashAnnotation(obj *unstructured.Unstructured, hash string)

SetHashAnnotation sets the hash annotation in the object

func WaitForDeploymentReady

func WaitForDeploymentReady(ctx context.Context, k8sClient client.Client, ns, label string) error

WaitForDeploymentReady waits for the deployment to be ready

func WaitForJob

func WaitForJob(ctx context.Context, k8sClient client.Client, ns, name string) error

WaitForJob waits for the job to be succeeded

func WaitForOperandReady

func WaitForOperandReady(ctx context.Context, k8sClient client.Client, opreqName, ns string) error

WaitForOperandReady checks if all services in OperandRequest are ready

func WaitForOperatorReady

func WaitForOperatorReady(ctx context.Context, k8sClient client.Client, opreqName, ns string) error

WaitForOperatorReady check operator status in OperandRequest

func WaitForRediscp

func WaitForRediscp(ctx context.Context, k8sClient client.Client, ns, name, group, kind, version, compStatus string) error

waitForResource waits for the resource to be completed

Types

This section is empty.

Jump to

Keyboard shortcuts

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