util

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyReplica

func ApplyReplica(workload *unstructured.Unstructured, desireReplica int64, field string) error

ApplyReplica applies the Replica value for the specific field.

func ConvertToClusterOverridePolicy

func ConvertToClusterOverridePolicy(obj *unstructured.Unstructured) (*policyv1alpha1.ClusterOverridePolicy, error)

ConvertToClusterOverridePolicy converts a ClusterOverridePolicy Object from unstructured to typed

func ConvertToClusterValidatePolicy

func ConvertToClusterValidatePolicy(obj *unstructured.Unstructured) (*policyv1alpha1.ClusterValidatePolicy, error)

ConvertToClusterValidatePolicy converts a ClusterValidatePolicy Object from unstructured to typed

func ConvertToDaemonSet

func ConvertToDaemonSet(obj *unstructured.Unstructured) (*appsv1.DaemonSet, error)

ConvertToDaemonSet converts a DaemonSet object from unstructured to typed.

func ConvertToDeployment

func ConvertToDeployment(obj *unstructured.Unstructured) (*appsv1.Deployment, error)

ConvertToDeployment converts a Deployment object from unstructured to typed.

func ConvertToEndpointSlice

func ConvertToEndpointSlice(obj *unstructured.Unstructured) (*discoveryv1.EndpointSlice, error)

ConvertToEndpointSlice converts a EndpointSlice object from unstructured to typed.

func ConvertToIngress

func ConvertToIngress(obj *unstructured.Unstructured) (*extensionsv1beta1.Ingress, error)

ConvertToIngress converts a Service object from unstructured to typed.

func ConvertToJob

func ConvertToJob(obj *unstructured.Unstructured) (*batchv1.Job, error)

ConvertToJob converts a Job object from unstructured to typed.

func ConvertToNode

func ConvertToNode(obj *unstructured.Unstructured) (*corev1.Node, error)

ConvertToNode converts a Node object from unstructured to typed.

func ConvertToOverridePolicy

func ConvertToOverridePolicy(obj *unstructured.Unstructured) (*policyv1alpha1.OverridePolicy, error)

ConvertToOverridePolicy converts a Override Object from unstructured to typed

func ConvertToPod

func ConvertToPod(obj *unstructured.Unstructured) (*corev1.Pod, error)

ConvertToPod converts a Pod object from unstructured to typed.

func ConvertToReplicaSet

func ConvertToReplicaSet(obj *unstructured.Unstructured) (*appsv1.ReplicaSet, error)

ConvertToReplicaSet converts a ReplicaSet object from unstructured to typed.

func ConvertToService

func ConvertToService(obj *unstructured.Unstructured) (*corev1.Service, error)

ConvertToService converts a Service object from unstructured to typed.

func ConvertToStatefulSet

func ConvertToStatefulSet(obj *unstructured.Unstructured) (*appsv1.StatefulSet, error)

ConvertToStatefulSet converts a StatefulSet object from unstructured to typed.

func Exists

func Exists(items []admissionv1.Operation, pattern admissionv1.Operation) bool

func ToUnstructured

func ToUnstructured(obj interface{}) (*unstructured.Unstructured, error)

ToUnstructured converts a typed object to an unstructured object.

Types

type ErrorSet added in v0.4.0

type ErrorSet []error

func NewErrorSet added in v0.4.0

func NewErrorSet() ErrorSet

func (ErrorSet) Err added in v0.4.0

func (es ErrorSet) Err() error

func (ErrorSet) Error added in v0.4.0

func (es ErrorSet) Error() string

type IOStreams

type IOStreams struct {
	// In think, os.Stdin
	In io.Reader
	// Out think, os.Stdout
	Out io.Writer
	// ErrOut think, os.Stderr
	ErrOut io.Writer
}

IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code

func NewDefaultIOStreams

func NewDefaultIOStreams() IOStreams

NewDefaultIOStreams return IOStreams with standard input/output/error

func NewTestIOStreams

func NewTestIOStreams() (IOStreams, *bytes.Buffer)

NewTestIOStreams return IOStreams with empty input and combined buffered output

func (*IOStreams) Error

func (i *IOStreams) Error(a ...interface{})

Error print error info

func (*IOStreams) Errorf

func (i *IOStreams) Errorf(format string, a ...interface{})

Errorf print error info in a specified format

func (*IOStreams) Info

func (i *IOStreams) Info(a ...interface{})

Info print info with new line

func (*IOStreams) Infof

func (i *IOStreams) Infof(format string, a ...interface{})

Infof print info in a specified format

func (*IOStreams) Infonln

func (i *IOStreams) Infonln(a ...interface{})

Infonln compared to Info(), won't print new line

type WaitGroup added in v0.4.0

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

func NewWaitGroup added in v0.4.0

func NewWaitGroup(size int) *WaitGroup

func (*WaitGroup) Add added in v0.4.0

func (w *WaitGroup) Add(f func())

func (*WaitGroup) Done added in v0.4.0

func (w *WaitGroup) Done()

func (*WaitGroup) Wait added in v0.4.0

func (w *WaitGroup) Wait()

Jump to

Keyboard shortcuts

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