utils

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCapp

func CreateCapp(g Gomega, 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(g Gomega, k8sClient client.Client) (*cappv1alpha1.Capp, string)

CreateCappWithHTTPHostname creates a Capp with a Hostname.

func CreateCappWithLogger

func CreateCappWithLogger(g Gomega, logType cappv1alpha1.LogType, k8sClient 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, k8sClient 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(g Gomega, 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, ignoring AlreadyExists errors.

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(g Gomega, 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 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 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 GetPingSource added in v0.9.0

func GetPingSource(k8sClient client.Client, name string, namespace string) *sourcesv1.PingSource

GetPingSource fetches and returns an existing instance of a Knative PingSource.

func GetResource

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

GetResource fetches a resource into obj. NotFound is silently ignored so the caller receives a zero-value obj; any other API error fails the test.

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 ResourceExists added in v0.9.2

func ResourceExists(k8sClient client.Client, obj client.Object) (bool, error)

ResourceExists checks if a given Kubernetes object exists in the cluster. Returns (false, nil) when the object is not found, and (false, err) on any other API error.

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 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