util

package
v5.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 70 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// InsecureHTTPTransport is a global insecure http transport
	InsecureHTTPTransport = &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

	// GlobalCARefreshingTransport is a global secure http transport
	GlobalCARefreshingTransport = &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: false},
	}

	// MapStorTypeToMandatoryProperties holds a map of store type -> credentials mandatory properties
	// note that this map holds the mandatory properties for both backingstores and namespacestores
	MapStorTypeToMandatoryProperties = map[string][]string{
		"aws-s3":               {"AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"},
		"s3-compatible":        {"AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"},
		"ibm-cos":              {"IBM_COS_ACCESS_KEY_ID", "IBM_COS_SECRET_ACCESS_KEY"},
		"google-cloud-storage": {"GoogleServiceAccountPrivateKeyJson"},
		"azure-blob":           {"AccountName", "AccountKey"},
		"pv-pool":              {},
		"nsfs":                 {},
	}
)
View Source
var AccessKeyRegexp, _ = regexp.Compile(`^[a-zA-Z0-9]{20}$`)

AccessKeyRegexp validates access keys, which are 20 characters long and may include alphanumeric characters

View Source
var SecretKeyRegexp, _ = regexp.Compile(`^[a-zA-Z0-9+/]{40}$`)

SecretKeyRegexp validates secret keys, which are 40 characters long and may include alphanumeric characters '+' and '/'

Functions

func AddFinalizer

func AddFinalizer(obj metav1.Object, finalizer string) bool

AddFinalizer adds the finalizer to the object if it doesn't contains it already

func AddToRootCAs

func AddToRootCAs(localCertFile string) error

AddToRootCAs adds a local cert file to Our GlobalCARefreshingTransport

func CheckForIdenticalSecretsCreds added in v5.11.0

func CheckForIdenticalSecretsCreds(secret *corev1.Secret, storeTypeStr string) *corev1.Secret

CheckForIdenticalSecretsCreds search and returns a secret name with identical credentials in the provided secret the credentials to compare stored in mandatoryProp

func CombineErrors

func CombineErrors(errs ...error) error

CombineErrors takes a list of errors and combines them to one. Generally it will return the first non-nil error, but if a persistent error is found it will be returned instead of non-persistent errors.

func ComposePredicates

func ComposePredicates(predicates ...predicate.Predicate) predicate.Predicate

ComposePredicates will compose a variable number of predicte and return a predicate that will allow events that are allowed by any of the given predicates.

func Contains

func Contains[T comparable](arr []T, item T) bool

Contains is a generic function that receives a slice and an element from comparable type (sould be from the same type) and returns true if the slice contains the element, otherwise false

func ContainsAny added in v5.13.0

func ContainsAny[T any](arr []T, item T, eq func(T, T) bool) bool

ContainsAny is a generic function that receives a slice, an element and a function to compare and returns true if the function executed on the item and the slice return true

func Context

func Context() context.Context

Context returns a default Context

func CurrentNamespace

func CurrentNamespace() string

CurrentNamespace reads the current namespace from the kube config

func DeleteStorageClass

func DeleteStorageClass(sc *storagev1.StorageClass) error

DeleteStorageClass deletes storage class

func EnsureCommonMetaFields

func EnsureCommonMetaFields(object metav1.Object, finalizer string) bool

EnsureCommonMetaFields ensures that the resource has all mandatory meta fields

func FilterSlice added in v5.13.0

func FilterSlice[V any](slice []V, f func(V) bool) []V

FilterSlice takes in a slice and a filter function which must return false for the all the elements that need to be renoved from the slice

func GetAWSRegion

func GetAWSRegion() (string, error)

GetAWSRegion parses the region from a node's name

func GetAnnotationValue added in v5.17.0

func GetAnnotationValue(annotations map[string]string, name string) (string, bool)

GetAnnotationValue searches for an annotation within a map of strings and returns if it exists and what its value

func GetAvailabeKubeCli added in v5.10.1

func GetAvailabeKubeCli() string

GetAvailabeKubeCli will check which k8s cli command is availabe in the system: oc or kubectl returns one of: "oc" or "kubectl"

func GetBackingStoreSecret added in v5.11.0

func GetBackingStoreSecret(bs *nbv1.BackingStore) (*corev1.SecretReference, error)

GetBackingStoreSecret returns the secret and adding the namespace if it is missing

func GetBackingStoreSecretByType added in v5.11.0

func GetBackingStoreSecretByType(bs *nbv1.BackingStore) (*corev1.SecretReference, error)

GetBackingStoreSecretByType returns the secret reference of the backing store if it is relevant to the type

func GetBackingStoreTargetBucket added in v5.11.0

func GetBackingStoreTargetBucket(bs *nbv1.BackingStore) (string, error)

GetBackingStoreTargetBucket returns the target bucket of the backing store if it is relevant to the type

func GetBoolFlagPtr added in v5.17.0

func GetBoolFlagPtr(cmd *cobra.Command, flag string) (*bool, error)

GetBoolFlagPtr returns a pointer to the boolean flag value if set, or nil if not set

func GetCmDataHash

func GetCmDataHash(input map[string]string) string

GetCmDataHash calculates a Hash string representing an array of key value strings

func GetContainerStatusLine

func GetContainerStatusLine(cont *corev1.ContainerStatus) string

GetContainerStatusLine returns a one liner status for a container

func GetEndpointByBackingStoreType added in v5.13.0

func GetEndpointByBackingStoreType(bs *nbv1.BackingStore) (string, error)

GetEndpointByBackingStoreType returns the endpoint url the of the backing store if it is relevant to the type

func GetEndpointByNamespaceStoreType added in v5.13.0

func GetEndpointByNamespaceStoreType(ns *nbv1.NamespaceStore) (string, error)

GetEndpointByNamespaceStoreType returns the endpoint url the of the backing store if it is relevant to the type

func GetEnvVariable

func GetEnvVariable(env *[]corev1.EnvVar, name string) *corev1.EnvVar

GetEnvVariable is looking for env variable called name in env and return a pointer to the variable

func GetFlagIntOrPrompt added in v5.10.1

func GetFlagIntOrPrompt(cmd *cobra.Command, flag string) int

GetFlagIntOrPrompt returns flag value but if empty will prompt to read from stdin

func GetFlagStringOrPrompt

func GetFlagStringOrPrompt(cmd *cobra.Command, flag string) string

GetFlagStringOrPrompt returns flag value but if empty will prompt to read from stdin

func GetFlagStringOrPromptPassword

func GetFlagStringOrPromptPassword(cmd *cobra.Command, flag string) string

GetFlagStringOrPromptPassword is like GetFlagStringOrPrompt but does not show the input characters on the terminal to avoid leaking secret data in shell history

func GetIBMRegion

func GetIBMRegion() (string, error)

GetIBMRegion returns the cluster's region in IBM Cloud

func GetKubeVersion added in v5.14.0

func GetKubeVersion() (*semver.Version, error)

GetKubeVersion will fetch the kubernates minor version

func GetNamespaceStoreSecret added in v5.11.0

func GetNamespaceStoreSecret(ns *nbv1.NamespaceStore) (*corev1.SecretReference, error)

GetNamespaceStoreSecret returns the secret and adding the namespace if it is missing

func GetNamespaceStoreSecretByType added in v5.11.0

func GetNamespaceStoreSecretByType(ns *nbv1.NamespaceStore) (*corev1.SecretReference, error)

GetNamespaceStoreSecretByType returns the secret reference of the namespace store if it is relevant to the type

func GetNamespaceStoreTargetBucket added in v5.11.0

func GetNamespaceStoreTargetBucket(ns *nbv1.NamespaceStore) (string, error)

GetNamespaceStoreTargetBucket returns the target bucket of the namespace store if it is relevant to the type

func GetPodLogs

func GetPodLogs(pod corev1.Pod) (map[string]io.ReadCloser, error)

GetPodLogs info

func GetPodStatusLine

func GetPodStatusLine(pod *corev1.Pod) string

GetPodStatusLine returns a one liner status for a pod

func GetSecretFromSecretReference added in v5.11.0

func GetSecretFromSecretReference(secretRef *corev1.SecretReference) (*corev1.Secret, error)

GetSecretFromSecretReference search and retruns a secret obj from a provided secret reference

func GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the namespace the operator should be watching for changes this was implemented in operator-sdk v0.17 and removed. copied from here: https://github.com/operator-framework/operator-sdk/blob/53b00d125fb12515cd74fb169149913b401c8995/pkg/k8sutil/k8sutil.go#L45

func HasNodeInclusionPolicyInPodTopologySpread added in v5.17.0

func HasNodeInclusionPolicyInPodTopologySpread() bool

HasNodeInclusionPolicyInPodTopologySpread checks if the cluster supports the spread topology policy

func HumanizeDuration

func HumanizeDuration(duration time.Duration) string

HumanizeDuration humanizes time.Duration output to a meaningful value - will show days/years

func IgnoreError

func IgnoreError(err error)

IgnoreError do nothing if err is not nil

func IgnoreIfNotInNamespace added in v5.13.0

func IgnoreIfNotInNamespace(ns string) *predicate.Funcs

IgnoreIfNotInNamespace returns a predicate function that ignores the object if it is not in the given namespace

func InitLogger

func InitLogger(lvl logrus.Level)

InitLogger initializes the logrus logger with defaults

func IsAWSPlatform

func IsAWSPlatform() bool

IsAWSPlatform returns true if this cluster is running on AWS

func IsAzurePlatformNonGovernment added in v5.10.1

func IsAzurePlatformNonGovernment() bool

IsAzurePlatformNonGovernment returns true if this cluster is running on Azure and also not on azure government\DOD cloud

func IsDevEnv added in v5.15.0

func IsDevEnv() bool

IsDevEnv checks for DEV_ENV env var existance and equality to true and returns true or false accordingly

func IsFusionHCIWithScale added in v5.17.0

func IsFusionHCIWithScale() bool

IsFusionHCIWithScale checks if the noobaa is deployed on HCI platform and using Spectrum Scale storage.

func IsGCPPlatform

func IsGCPPlatform() bool

IsGCPPlatform returns true if this cluster is running on GCP

func IsIBMPlatform

func IsIBMPlatform() bool

IsIBMPlatform returns true if this cluster is running on IBM Cloud

func IsOwnedByNoobaa added in v5.11.0

func IsOwnedByNoobaa(ownerReferences []metav1.OwnerReference) bool

IsOwnedByNoobaa receives an array of owner references and returns true if one of them is of a noobaa resource

func IsPersistentError

func IsPersistentError(err error) bool

IsPersistentError checks if the provided error is persistent.

func IsRemoteClientNoobaa added in v5.17.0

func IsRemoteClientNoobaa(annotations map[string]string) bool

IsRemoteClientNoobaa checks for the existance and value of the remote-client-noobaa annotation within an annotation map, if the annotation doesnt exist it's the same as if its value is false.

func IsSTSClusterBS added in v5.10.1

func IsSTSClusterBS(bs *nbv1.BackingStore) bool

IsSTSClusterBS returns true if it is running on an STS cluster

func IsSTSClusterNS added in v5.12.4

func IsSTSClusterNS(ns *nbv1.NamespaceStore) bool

IsSTSClusterNS returns true if it is running on an STS cluster

func IsStringArrayUnorderedEqual added in v5.10.1

func IsStringArrayUnorderedEqual(stringsArrayA, stringsArrayB []string) bool

IsStringArrayUnorderedEqual checks if two string arrays has the same members

func IsStringGraphicOrSpacesCharsOnly

func IsStringGraphicOrSpacesCharsOnly(s string) bool

IsStringGraphicOrSpacesCharsOnly returns true only if all the chars are graphic or spaces

func IsTestEnv added in v5.13.0

func IsTestEnv() bool

IsTestEnv checks for TEST_ENV env var existance and equality to true and returns true or false accordingly

func IsValidS3BucketName

func IsValidS3BucketName(name string) bool

IsValidS3BucketName checks the name according to https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html

func IsValidationError added in v5.10.1

func IsValidationError(err error) bool

IsValidationError check if err is of type ValidationError

func KubeApply

func KubeApply(obj client.Object) bool

KubeApply will check if the object exists and will create/update accordingly and report the object status.

func KubeCheck

func KubeCheck(obj client.Object) bool

KubeCheck checks if the object exists and reports the object status.

func KubeCheckOptional

func KubeCheckOptional(obj client.Object) bool

KubeCheckOptional checks if the object exists and reports the object status. It detects the situation of a missing CRD and reports it as an optional feature.

func KubeCheckQuiet

func KubeCheckQuiet(obj client.Object) bool

KubeCheckQuiet checks if the object exists fills the given object if found. returns true if the object was found. It does not print any status

func KubeClient

func KubeClient() client.Client

KubeClient resturns a controller-runtime client We use a lazy mapper and a specialized implementation of fast mapper in order to avoid lags when running a CLI client to a far away cluster.

func KubeConfig

func KubeConfig() *rest.Config

KubeConfig loads kubernetes client config from default locations (flags, user dir, etc)

func KubeCreateFailExisting

func KubeCreateFailExisting(obj client.Object) bool

KubeCreateFailExisting will check if the object exists and will create/skip accordingly and report the object status.

func KubeCreateOptional

func KubeCreateOptional(obj client.Object) bool

KubeCreateOptional will check if the object exists and will create/skip accordingly It detects the situation of a missing CRD and reports it as an optional feature.

func KubeCreateSkipExisting

func KubeCreateSkipExisting(obj client.Object) bool

KubeCreateSkipExisting will try to create an object returns true of the object exist or was created returns false otherwise

func KubeDelete

func KubeDelete(obj client.Object, opts ...client.DeleteOption) bool

KubeDelete deletes an object and reports the object status.

func KubeDeleteAllOf

func KubeDeleteAllOf(obj client.Object, opts ...client.DeleteAllOfOption) bool

KubeDeleteAllOf deletes an list of objects and reports the status.

func KubeDeleteNoPolling

func KubeDeleteNoPolling(obj client.Object, opts ...client.DeleteOption) bool

KubeDeleteNoPolling deletes an object without waiting for acknowledgement the object got deleted

func KubeGet

func KubeGet(obj client.Object) (name string, kind string, err error)

KubeGet gets a client.Object, fills the given object and returns the name and kind returns error on failure

func KubeList

func KubeList(list client.ObjectList, options ...client.ListOption) bool

KubeList returns a list of objects.

func KubeObject

func KubeObject(text string) runtime.Object

KubeObject loads a text yaml/json to a kubernetes object.

func KubeUpdate

func KubeUpdate(obj client.Object) bool

KubeUpdate updates an object and reports the object status.

func LoadConfigurationJSON added in v5.16.0

func LoadConfigurationJSON(configurationJSONPath string) (string, error)

LoadConfigurationJSON loads the bucket replication from a json file

func LogError

func LogError(err error)

LogError prints the error to the log and continue

func Logger

func Logger() *logrus.Entry

Logger returns a default logger

func MapAlternateKeysValue added in v5.13.0

func MapAlternateKeysValue(stringData map[string]string, key string) string

MapAlternateKeysValue scans the map, returning the alternative key name's value if present the canonical key name value otherwise used to map values from secrets using alternative names

func MapperProvider

func MapperProvider(config *rest.Config, httpClient *http.Client) (meta.RESTMapper, error)

MapperProvider creates RESTMapper

func MergeEnvArrays

func MergeEnvArrays(envA, envB *[]corev1.EnvVar)

MergeEnvArrays takes two Env variables arrays and merge them into the first

func MergeVolumeList

func MergeVolumeList(existing, template *[]corev1.Volume)

MergeVolumeList takes two Volume arrays and merge them into the first

func MergeVolumeMountList

func MergeVolumeMountList(existing, template *[]corev1.VolumeMount)

MergeVolumeMountList takes two VolumeMount arrays and merge them into the first

func NewFastRESTMapper

func NewFastRESTMapper(dc discovery.DiscoveryInterface, filter APIGroupFilterFunc) meta.RESTMapper

NewFastRESTMapper initializes a FastRESTMapper

func NoGroupFilter

func NoGroupFilter(*metav1.APIGroup) bool

NoGroupFilter is a filtering function that includes all the server groups

func NooBaaCondStatus added in v5.10.1

func NooBaaCondStatus(noobaa *nbv1.NooBaa, s corev1.ConditionStatus) bool

NooBaaCondStatus waits for requested NooBaa CR KMS condition status returns false if timeout

func NooBaaCondition added in v5.10.1

func NooBaaCondition(noobaa *nbv1.NooBaa, t conditionsv1.ConditionType, s corev1.ConditionStatus) bool

NooBaaCondition waits for requested NooBaa CR KMS condition type & status returns false if timeout

func NoobaaStatus added in v5.10.1

func NoobaaStatus(nb *nbv1.NooBaa, t conditionsv1.ConditionType, status corev1.ConditionStatus) bool

NoobaaStatus returns true if NooBaa condition type and status matches returns false otherwise

func ObjectKey

func ObjectKey(obj client.Object) client.ObjectKey

ObjectKey returns the objects key (namespace + name)

func Panic

func Panic(err error)

Panic is conveniently calling panic only if err is not nil

func PrettyPrint added in v5.12.4

func PrettyPrint(key string, strArray []string)

PrettyPrint the string array in multiple lines, if length greater than 1

func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop

func PrintThisNoteWhenFinishedApplyingAndStartWaitLoop()

PrintThisNoteWhenFinishedApplyingAndStartWaitLoop is a common log task

func RandomBase64

func RandomBase64(numBytes int) string

RandomBase64 creates a random buffer with numBytes and returns it encoded in base64 Returned string length is 4*math.Ceil(numBytes/3)

func RandomHex

func RandomHex(numBytes int) string

RandomHex creates a random buffer with numBytes and returns it encoded in hex Returned string length is 2*numBytes

func ReflectEnvVariable

func ReflectEnvVariable(env *[]corev1.EnvVar, name string)

ReflectEnvVariable will add, update or remove an env variable base on the existence and value of an env variable with the same name on the container running this function.

func RemoveFinalizer

func RemoveFinalizer(obj metav1.Object, finalizer string) bool

RemoveFinalizer modifies the object and removes the finalizer

func SaveCRsToFile

func SaveCRsToFile(crs runtime.Object, path string) error

SaveCRsToFile info

func SaveStreamToFile

func SaveStreamToFile(body io.ReadCloser, path string) error

SaveStreamToFile info

func SecretResetStringDataFromData

func SecretResetStringDataFromData(obj runtime.Object)

SecretResetStringDataFromData reads the secret data into string data to streamline the paths that use the secret values as strings.

func SetAvailableCondition

func SetAvailableCondition(conditions *[]conditionsv1.Condition, reason string, message string)

SetAvailableCondition updates the status conditions to available state

func SetBackingStoreSecretRef added in v5.11.0

func SetBackingStoreSecretRef(bs *nbv1.BackingStore, ref *corev1.SecretReference) error

SetBackingStoreSecretRef setting a backingstore secret reference to the provided one

func SetErrorCondition

func SetErrorCondition(conditions *[]conditionsv1.Condition, reason string, message string)

SetErrorCondition updates the status conditions to error state

func SetNamespaceStoreSecretRef added in v5.11.0

func SetNamespaceStoreSecretRef(ns *nbv1.NamespaceStore, ref *corev1.SecretReference) error

SetNamespaceStoreSecretRef setting a namespacestore secret reference to the provided one

func SetOwnerReference added in v5.11.0

func SetOwnerReference(owner, dependent metav1.Object, scheme *runtime.Scheme) error

SetOwnerReference setting a owner reference of owner to dependent metadata with the field of blockOwnerDeletion: true controllerutil.SetOwnerReference is doing the same thing but without blockOwnerDeletion: true If a reference to the same object already exists, it'll return an AlreadyOwnedError. see: https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/controller/controllerutil/controllerutil.go#L93

func SetProgressingCondition

func SetProgressingCondition(conditions *[]conditionsv1.Condition, reason string, message string)

SetProgressingCondition updates the status conditions to in-progress state

func Tar

func Tar(src string, writers ...io.Writer) error

Tar takes a source and variable writers and walks 'source' writing each file found to the tar writer; the purpose for accepting multiple writers is to allow for multiple outputs (for example a file, or md5 hash)

func ValidateQuotaConfig added in v5.10.1

func ValidateQuotaConfig(name string, maxSize string, maxObjects string) error

ValidateQuotaConfig maxSize and maxObjects value of obc or bucketclass

func VerifyCredsInSecret

func VerifyCredsInSecret(secretName string, namespace string, mandatoryProperties []string)

VerifyCredsInSecret throws fatal error when a given secret doesn't contain the mandatory properties

func WriteYamlFile

func WriteYamlFile(name string, obj runtime.Object, moreObjects ...runtime.Object) error

WriteYamlFile writes a yaml file from the given objects

Types

type APIGroupFilterFunc

type APIGroupFilterFunc func(*metav1.APIGroup) bool

APIGroupFilterFunc is a filtering function to limit the amount of server groups we load

type FastRESTMapper

type FastRESTMapper struct {
	Discovery discovery.DiscoveryInterface
	Filter    APIGroupFilterFunc
	Mapper    meta.RESTMapper
}

FastRESTMapper loads the mapper data from the server with filter and concurrency and rediscovers the mapping on meta.NoKindMatchError errors See https://github.com/kubernetes-sigs/controller-runtime/issues/537

func (*FastRESTMapper) Discover

func (m *FastRESTMapper) Discover() error

Discover reads server groups and then reads each group to initialize the mapper groups.

func (*FastRESTMapper) DiscoverGroup

func (m *FastRESTMapper) DiscoverGroup(gr *restmapper.APIGroupResources) error

DiscoverGroup reads the server group

func (*FastRESTMapper) DiscoverOnError

func (m *FastRESTMapper) DiscoverOnError(err error) bool

DiscoverOnError check if the error is NoMatchError and calls discover

func (*FastRESTMapper) KindFor

KindFor implements Mapper.KindFor

func (*FastRESTMapper) KindsFor

KindsFor implements Mapper.KindsFor

func (*FastRESTMapper) RESTMapping

func (m *FastRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)

RESTMapping implements Mapper.RESTMapping

func (*FastRESTMapper) RESTMappings

func (m *FastRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error)

RESTMappings implements Mapper.RESTMappings

func (*FastRESTMapper) ResourceFor

ResourceFor implements Mapper.ResourceFor

func (*FastRESTMapper) ResourceSingularizer

func (m *FastRESTMapper) ResourceSingularizer(resource string) (string, error)

ResourceSingularizer implements Mapper.ResourceSingularizer

func (*FastRESTMapper) ResourcesFor

ResourcesFor implements Mapper.ResourcesFor

type FilterForOwner

type FilterForOwner struct {
	OwnerType runtime.Object
	Scheme    *runtime.Scheme
}

FilterForOwner will only allow events that owned by noobaa

func (FilterForOwner) Create

func (p FilterForOwner) Create(e event.CreateEvent) bool

Create implements the create event trap for FilterForOwner

func (FilterForOwner) Delete

func (p FilterForOwner) Delete(e event.DeleteEvent) bool

Delete implements the delete event trap for FilterForOwner

func (FilterForOwner) Generic

func (p FilterForOwner) Generic(e event.GenericEvent) bool

Generic implements the generic event trap for FilterForOwner

func (FilterForOwner) Update

func (p FilterForOwner) Update(e event.UpdateEvent) bool

Update implements the update event trap for FilterForOwner

type FinalizersChangedPredicate

type FinalizersChangedPredicate struct {
	predicate.Funcs
}

FinalizersChangedPredicate will only allow events that changed Metadata.Finalizers

func (FinalizersChangedPredicate) Update

Update implements the update event trap for FinalizersChangedPredicate

type LabelsChangedPredicate

type LabelsChangedPredicate struct {
	predicate.Funcs
}

LabelsChangedPredicate will only allow events that changed Metadata.Labels

func (LabelsChangedPredicate) Update

Update implements the update event trap for LabelsChangedPredicate

type LogEventsPredicate

type LogEventsPredicate struct {
}

LogEventsPredicate will passthrough events while loging a message for each

func (LogEventsPredicate) Create

Create implements the create event trap for LogEventsPredicate

func (LogEventsPredicate) Delete

Delete implements the delete event trap for LogEventsPredicate

func (LogEventsPredicate) Generic

Generic implements the generic event trap for LogEventsPredicate

func (LogEventsPredicate) Update

Update implements the update event trap for LogEventsPredicate

type OAuth2Endpoints

type OAuth2Endpoints struct {
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
}

OAuth2Endpoints holds OAuth2 endpoints information.

func DiscoverOAuthEndpoints

func DiscoverOAuthEndpoints() (*OAuth2Endpoints, error)

DiscoverOAuthEndpoints uses a well known url to get info on the cluster oauth2 endpoints

type PersistentError

type PersistentError struct {
	Reason  string
	Message string
}

PersistentError is an error type that tells the reconcile to avoid requeueing.

func NewPersistentError

func NewPersistentError(reason string, message string) *PersistentError

NewPersistentError returns a new persistent error.

func (*PersistentError) Error

func (e *PersistentError) Error() string

Error function makes PersistentError implement error interface

type PrintColumn

type PrintColumn struct {
	Items []string
	Width int
}

PrintColumn is a column in PrintTable

func (*PrintColumn) Pad

func (c *PrintColumn) Pad(s string) string

Pad adds padding the provided string to make it print nicely as a table cell

func (*PrintColumn) RecalcWidth

func (c *PrintColumn) RecalcWidth()

RecalcWidth can be called to recalculate the column width after manual updates are made

type PrintTable

type PrintTable struct {
	Columns []PrintColumn
	NumRows int
}

PrintTable is a table for printing with fixed column width and padding

func (*PrintTable) AddRow

func (t *PrintTable) AddRow(items ...string) *PrintTable

AddRow adds a row of headers/values to the table

func (*PrintTable) RecalcWidth

func (t *PrintTable) RecalcWidth() *PrintTable

RecalcWidth can be called to recalculate the columns width after manual updates are made

func (*PrintTable) String

func (t *PrintTable) String() string

type ValidationError added in v5.10.1

type ValidationError struct {
	Msg string
}

ValidationError is a custom error if the validation failed

func (ValidationError) Error added in v5.10.1

func (e ValidationError) Error() string

Error returns the ValidationError message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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