utils

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCapp

func CreateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp) *cappv1alpha1.Capp

CreateCapp creates a new Capp instance with a unique name and returns it.

func CreateCappWithHTTPHostname

func CreateCappWithHTTPHostname(k8sClient client.Client) (*cappv1alpha1.Capp, string)

CreateCappWithHTTPHostname creates a Capp with a Hostname.

func CreateCappWithLogger

func CreateCappWithLogger(logType cappv1alpha1.LogType, client client.Client) *cappv1alpha1.Capp

CreateCappWithLogger creates a Capp instance with the specified logger type and returns the created Capp object.

func CreateCredentialsSecret

func CreateCredentialsSecret(logType cappv1alpha1.LogType, client client.Client)

CreateCredentialsSecret creates a Kubernetes secret containing credentials for the specified logger type.

func CreateExcludedServiceAccount

func CreateExcludedServiceAccount(k8sClient client.Client)

CreateExcludedServiceAccount configures a service account that should be excluded from the mutating webhook.

func CreateHTTPSCapp

func CreateHTTPSCapp(k8sClient client.Client) (*cappv1alpha1.Capp, string)

CreateHTTPSCapp creates a Capp with a Hostname, TLS Enabled and TLSSecret.

func CreateSecret

func CreateSecret(k8sClient client.Client, secret *corev1.Secret)

CreateSecret creates a new secret.

func CreateTestUser

func CreateTestUser(k8sClient client.Client, namespace string)

CreateTestUser creates a test user with the specified Kubernetes client and namespace.

func DeleteCapp

func DeleteCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)

DeleteCapp deletes an existing Capp instance.

func DeleteExcludedServiceAccount

func DeleteExcludedServiceAccount(k8sClient client.Client)

DeleteExcludedServiceAccount deletes the excluded user created in the specified namespace.

func DeleteTestUser

func DeleteTestUser(k8sClient client.Client, namespace string)

DeleteTestUser deletes the test user created in the specified namespace.

func DoesResourceExist

func DoesResourceExist(k8sClient client.Client, obj client.Object) bool

DoesResourceExist checks if a given Kubernetes object exists in the cluster.

func GenerateCappName

func GenerateCappName() string

GenerateCappName generates a new name for Capp.

func GenerateCertSecretName

func GenerateCertSecretName(hostname string) string

GenerateCertSecretName generates a capp cert secret name.

func GenerateResourceName

func GenerateResourceName(hostname, suffix string) string

GenerateResourceName generates the hostname based on the provided suffix and a dot (".") trailing character. It returns the adjusted hostname, where the suffix (minus the trailing character) is added if not already present.

func GenerateRouteHostname

func GenerateRouteHostname() string

GenerateRouteHostname generates a new route hostname by calling generateName with the predefined RouteHostname as the baseName.

func GenerateSecretName

func GenerateSecretName() string

GenerateSecretName generates a new secret name by calling generateName with the predefined RouteTlsSecret as the baseName.

func GenerateUniqueCappName

func GenerateUniqueCappName(baseCappName string) string

GenerateUniqueCappName generates a unique Capp name.

func GetCapp

func GetCapp(k8sClient client.Client, name string, namespace string) *cappv1alpha1.Capp

GetCapp fetches and returns an existing instance of a Capp.

func GetCappConfig

func GetCappConfig(k8sClient client.Client, name string, namespace string) *cappv1alpha1.CappConfig

GetCappConfig fetches and returns an existing instance of an existing cappConfig

func GetCappRevision

func GetCappRevision(k8sClient client.Client, cappRevisionName, namespace string) *cappv1alpha1.CappRevision

GetCappRevision retrieves a CappRevision by name.

func GetCappRevisions

func GetCappRevisions(ctx context.Context, k8sClient client.Client, capp cappv1alpha1.Capp) ([]cappv1alpha1.CappRevision, error)

GetCappRevisions retrieves a list of CappRevision resources filtered by labels matching a specific Capp, returning the list and any error encountered.

func GetCertificate

func GetCertificate(k8sClient client.Client, name string, namespace string) *cmapi.Certificate

GetCertificate fetches and returns an existing instance of a Certificate.

func GetClusterResource

func GetClusterResource(k8sClient client.Client, obj client.Object, name string)

GetClusterResource fetches an existing Cluster resource and returns an instance of it.

func GetDNSRecord

func GetDNSRecord(k8sClient client.Client, name, namespace string) *dnsrecordv1alpha1.CNAMERecord

GetDNSRecord fetches and returns an existing instance of a CNAMERecord.

func GetDomainMapping

func GetDomainMapping(k8sClient client.Client, name string, namespace string) *knativev1beta1.DomainMapping

GetDomainMapping fetches and returns an existing instance of a DomainMapping.

func GetKSVC

func GetKSVC(k8sClient client.Client, name string, namespace string) *knativev1.Service

GetKSVC fetches and returns an existing instance of a Knative Serving.

func GetNFSPVC

func GetNFSPVC(k8sClient client.Client, name string, namespace string) *nfspvcv1alpha1.NfsPvc

GetNFSPVC fetches and returns an existing instance of a NFSPVC.

func GetNextRevisionName

func GetNextRevisionName(currentRevision string) string

GetNextRevisionName generates the name for the next revision based on the current revision name.

func GetResource

func GetResource(k8sClient client.Client, obj client.Object, name, namespace string)

GetResource fetches an existing resource and returns an instance of it.

func GetRevision

func GetRevision(k8sClient client.Client, name string, namespace string) *knativev1.Revision

GetRevision fetches and returns an existing instance of a Knative Revision.

func GetSecret

func GetSecret(k8sClient client.Client, name string, namespace string) *corev1.Secret

GetSecret fetches and returns an existing instance of a Secret.

func GetSyslogNGFlow

func GetSyslogNGFlow(k8sClient client.Client, name string, namespace string) *loggingv1beta1.SyslogNGFlow

GetSyslogNGFlow fetches existing and returns an instance of a SyslogNGFlow.

func GetSyslogNGOutput

func GetSyslogNGOutput(k8sClient client.Client, name string, namespace string) *loggingv1beta1.SyslogNGOutput

GetSyslogNGOutput fetches existing and returns an instance of a SyslogNGOutput.

func NewRetryOnConflictBackoff

func NewRetryOnConflictBackoff() wait.Backoff

NewRetryOnConflictBackoff returns a preconfigured backoff for RetryOnConflict.

func RandomName

func RandomName(prefix string) string

RandomName generates random names like kafka-source-x7k9p2

func SwitchUser

func SwitchUser(k8sClient *client.Client, cfg *rest.Config, namespace string, scheme *runtime.Scheme, serviceAccountName string)

SwitchUser switches the Kubernetes client's user context to the given serviceAccountName if it's not empty. If serviceAccountName is empty, it reverts to the original context.

func UpdateCapp

func UpdateCapp(k8sClient client.Client, capp *cappv1alpha1.Capp)

UpdateCapp updates the provided Capp instance in the Kubernetes cluster, and returns it.

func UpdateResource

func UpdateResource(k8sClient client.Client, object client.Object) error

UpdateResource updates an existing resource.

Types

This section is empty.

Jump to

Keyboard shortcuts

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