v0.0.0-...-1155021 Latest Latest

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0




View Source
const (
	UnknownErrorType                     = "UnknownError"
	BackendNotImplementedErrorType       = "BackendNotImplementedError"
	BackendSecretNotFoundErrorType       = "BackendSecretNotFoundError"
	BackendSecretTypeNotSupportErrorType = "BackendSecretTypeNotSupportError"
	EmptySecretKeyErrorType              = "EmptySeretKeyError"

The errors that might occur when parsing and validating a token

View Source
const (
	BinaryType   = "binary"
	REGIONID_TAG = "region-id"
	RAM          = "ram/"


View Source
var (
	ErrInvalidKey     = errors.New("key is invalid")
	ErrInvalidKeyType = errors.New("key is of invalid type")

Error constants


func CheckInstanceRam

func CheckInstanceRam() (bool, error)

CheckInstanceRam check if instance not bind workerrole

func Contains

func Contains(list []string, s string) bool

func GetConfigFromSecret

func GetConfigFromSecret(ctx context.Context, r client.Client, secretRef *v1alpha1.SecretRef) ([]byte, error)

func GetKubernetesClients

func GetKubernetesClients() (dynamic.Interface, error)

getKubernetesClients returns all the required clients(token CRD client and origin k8s cli) to communicate with

func GetMetaData

func GetMetaData(resource string) (int, string, error)

GetMetaData get metadata

func GetRegion

func GetRegion() (string, error)

GetRegion Get regionid

func IgnoreNotFoundError

func IgnoreNotFoundError(err error) error

Ignore not found errors

func IsBackendNotImplemented

func IsBackendNotImplemented(err error) bool

IsBackendNotImplemented returns true if the error is type of BackendNotImplementedError and false otherwise

func IsBackendSecretNotFound

func IsBackendSecretNotFound(err error) bool

IsBackendSecretNotFound returns true if the error is type of BackendSecretNotFound and false otherwise

func IsClusterNamespace

func IsClusterNamespace(s string) bool

func IsEmptySecretKey

func IsEmptySecretKey(err error) bool

IsEmptySecretKey returns true if the error is type of EmptySecretKeyError and false otherwise

func JsonStr

func JsonStr(o interface{}) string

func Remove

func Remove(list []string, s string) []string

func Retry

func Retry(interval time.Duration, maxRetries int, f ConditionFunc) error

Retry retries f every interval until after maxRetries. The interval won't be affected by how long f takes. For example, if interval is 3s, f takes 1s, another f will be called 2s later. However, if f takes longer than interval, it will be delayed.


type BackendNotImplementedError

type BackendNotImplementedError struct {
	ErrType string
	Backend string

BackendNotImplementedError will be raised if the selected backend is not implemented

func (BackendNotImplementedError) Error

type BackendSecretNotFoundError

type BackendSecretNotFoundError struct {
	ErrType string
	Key     string

BackendSecretNotFoundError will be raised if secret is not found in the selected backend

func (BackendSecretNotFoundError) Error

type BackendSecretTypeNotSupportError

type BackendSecretTypeNotSupportError struct {
	ErrType string
	Key     string

BackendSecretTypeNotSupportError will be raised if the secret data type not support

func (BackendSecretTypeNotSupportError) Error

type ConditionFunc

type ConditionFunc func() (bool, error)

type EmptySecretKeyError

type EmptySecretKeyError struct {
	ErrType string

EmptySecretKeyError will be raised if the selected encoding is not implemented

func (EmptySecretKeyError) Error

func (e EmptySecretKeyError) Error() string

Jump to

Keyboard shortcuts

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