util

package
v0.4.2-rc2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EncoderConfig = zapcore.EncoderConfig{
	MessageKey:       "M",
	LevelKey:         "L",
	TimeKey:          "T",
	NameKey:          "N",
	CallerKey:        "C",
	FunctionKey:      "",
	StacktraceKey:    "S",
	ConsoleSeparator: " ",
	EncodeLevel:      zapcore.CapitalColorLevelEncoder,
	EncodeCaller: func(ec zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {
		enc.AppendString(chalk.Dim.TextStyle(ec.TrimmedPath()))
	},
	EncodeName: func(name string, enc zapcore.PrimitiveArrayEncoder) {
		enc.AppendString(chalk.Dim.TextStyle(
			strings.Replace(name, "controller-runtime.manager.", "", 1)))
	},
	EncodeTime: func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
		enc.AppendString(t.Format("[15:04:05]"))
	},
	EncodeDuration: zapcore.SecondsDurationEncoder,
}
View Source
var ErrUnsupportedProtocolScheme = errors.New("unsupported protocol scheme")
View Source
var Version string

Functions

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object) error

func DecodeStruct added in v0.4.1

func DecodeStruct[T any](input interface{}) (*T, error)

func DeepCopy added in v0.4.1

func DeepCopy[T any](in *T) *T

func DeepCopyInto added in v0.4.1

func DeepCopyInto[T any](out, in *T)

func GenerateRandomString added in v0.3.1

func GenerateRandomString(length int) []byte

func LoadClientMTLSConfig added in v0.4.1

func LoadClientMTLSConfig(certs *v1beta1.MTLSSpec) (*tls.Config, error)

func LoadServingCertBundle added in v0.4.1

func LoadServingCertBundle(certsSpec v1beta1.CertsSpec) (*tls.Certificate, *x509.CertPool, error)

func Must added in v0.4.1

func Must[T any](t T, err ...error) T

func NewK8sClient added in v0.4.1

func NewK8sClient(options ClientOptions) (client.Client, error)

func NewProtocolListener added in v0.4.1

func NewProtocolListener(addr string) (net.Listener, error)

func NewTestLogger

func NewTestLogger() logr.Logger

func ParsePEMEncodedCert added in v0.4.1

func ParsePEMEncodedCert(data []byte) (*x509.Certificate, error)

func ParsePEMEncodedCertChain added in v0.4.1

func ParsePEMEncodedCertChain(chain []byte) ([]*x509.Certificate, error)

func Pointer added in v0.4.1

func Pointer[T any](t T) *T

Types

type ClientOptions added in v0.4.1

type ClientOptions struct {
	Kubeconfig *string
	RestConfig *rest.Config
	Scheme     *runtime.Scheme
}

type DelimiterCodec added in v0.4.1

type DelimiterCodec struct {
	// contains filtered or unexported fields
}

Implements rbac.Codec

func NewDelimiterCodec added in v0.4.1

func NewDelimiterCodec(key string, delimiter string) DelimiterCodec

func (DelimiterCodec) Decode added in v0.4.1

func (d DelimiterCodec) Decode(s string) []string

func (DelimiterCodec) Encode added in v0.4.1

func (d DelimiterCodec) Encode(ids []string) string

func (DelimiterCodec) Key added in v0.4.1

func (d DelimiterCodec) Key() string

type Future added in v0.4.1

type Future[T any] struct {
	// contains filtered or unexported fields
}

func NewFuture added in v0.4.1

func NewFuture[T any]() *Future[T]

func (*Future[T]) Get added in v0.4.1

func (f *Future[T]) Get() T

func (*Future[T]) GetContext added in v0.4.1

func (f *Future[T]) GetContext(ctx context.Context) (_ T, err error)

func (*Future[T]) Set added in v0.4.1

func (f *Future[T]) Set(object T)

type RequeueOp

type RequeueOp struct {
	// contains filtered or unexported fields
}

func DoNotRequeue

func DoNotRequeue() RequeueOp

func LoadResult

func LoadResult(result *reconcile.Result, err error) RequeueOp

func Requeue

func Requeue() RequeueOp

func RequeueAfter

func RequeueAfter(d time.Duration) RequeueOp

func RequeueErr

func RequeueErr(err error) RequeueOp

func (RequeueOp) Result

func (r RequeueOp) Result() (ctrl.Result, error)

func (RequeueOp) ResultPtr added in v0.4.1

func (r RequeueOp) ResultPtr() (result *ctrl.Result, err error)

func (RequeueOp) ShouldRequeue

func (r RequeueOp) ShouldRequeue() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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