Documentation
¶
Index ¶
- Constants
- func ConditionIsReady(condition *apis.Condition) error
- func DefaultConvertRuntimeToClientobjectFunc(runtimeObj runtime.Object) (obj client.Object, err error)
- func DeleteResources(file string, clt client.Client) (err error)
- func GetDefaultEnv(key string, defaultValue string) string
- func LoadJSON(file string, obj interface{}) (err error)
- func LoadKubeResources(file string, clt client.Client, ...) (err error)
- func LoadKubeResourcesAsUnstructured(file string) (objs []unstructured.Unstructured, err error)
- func LoadMultiYamlOrJson[T any](file string, list *[]T) (err error)
- func LoadObjectOrDie(g *WithT, file string, obj metav1.Object, patches ...func(metav1.Object)) metav1.Object
- func LoadObjectReferenceOrDie(g *WithT, file string, obj *corev1.ObjectReference, ...) *corev1.ObjectReference
- func LoadResourceFromFile(scheme *runtime.Scheme, path string) (obj runtime.Object, err error)
- func LoadResourcesFromFile(scheme *runtime.Scheme, path string) (objs []runtime.Object, err error)
- func LoadYAML(file string, obj interface{}) (err error)
- func MustLoadFileBytes(file string) []byte
- func MustLoadFileString(file string, content *string)
- func MustLoadJSON(file string, obj interface{})
- func MustLoadMultiYamlOrJson[T any](file string, list *[]T)
- func MustLoadReturnObjectFromYAML(file string, obj interface{}) interface{}
- func MustLoadYaml(file string, obj interface{})
- func ReflectName(obj interface{}) string
- func RestoreDirectories(fs embed.FS, dirName string, targetDir string)
- func RuntimeObjectFromUnstructured(scheme *runtime.Scheme, u *unstructured.Unstructured) (runtime.Object, error)
- func SetName(name string) func(metav1.Object)
- func ToObjectList[T client.Object](list []T) []client.Object
- func UnstructedToTyped(from unstructured.Unstructured, to interface{}) error
- func WarningOnError(logger *zap.SugaredLogger, err error, message string)
- type ConditionBuilder
- func (c *ConditionBuilder) Done() *apis.Condition
- func (c *ConditionBuilder) SetReasonMessage(reason, message string, formtKeyValues ...interface{}) *ConditionBuilder
- func (c *ConditionBuilder) SetStatus(stat corev1.ConditionStatus) *ConditionBuilder
- func (c *ConditionBuilder) SetType(ct apis.ConditionType) *ConditionBuilder
- type ConvertRuntimeObjctToClientObjectFunc
- type ScriptResult
Constants ¶
const DefaultScriptOutputPrefix = "##output##"
DefaultScriptOutputPrefix the prefix of script output
Variables ¶
This section is empty.
Functions ¶
func ConditionIsReady ¶ added in v0.7.0
ConditionIsReady returns an error if the condition status is not True useful for Eventually checks
func DefaultConvertRuntimeToClientobjectFunc ¶ added in v0.7.0
func DefaultConvertRuntimeToClientobjectFunc(runtimeObj runtime.Object) (obj client.Object, err error)
DefaultConvertRuntimeToClientobjectFunc convert runtime.Object to client.Object be similar to convertFromUnstructuredIfNecessary
func DeleteResources ¶
DeleteResources delete resources contained in the file
func GetDefaultEnv ¶ added in v0.10.0
GetDefaultEnv get the parameter from env, if not set it use the defaultValue instead
func LoadKubeResources ¶
func LoadKubeResources(file string, clt client.Client, converts ...ConvertRuntimeObjctToClientObjectFunc) (err error)
LoadKubeResources loading kubernetes resources
func LoadKubeResourcesAsUnstructured ¶
func LoadKubeResourcesAsUnstructured(file string) (objs []unstructured.Unstructured, err error)
func LoadMultiYamlOrJson ¶ added in v0.7.0
LoadMultiYamlOrJson loads multi yamls
func LoadObjectOrDie ¶
func LoadObjectOrDie(g *WithT, file string, obj metav1.Object, patches ...func(metav1.Object)) metav1.Object
LoadObjectOrDie loads object from yaml and returns
func LoadObjectReferenceOrDie ¶
func LoadObjectReferenceOrDie(g *WithT, file string, obj *corev1.ObjectReference, patches ...func(*corev1.ObjectReference)) *corev1.ObjectReference
LoadObjectReferenceOrDie loads object reference from yaml and returns
func LoadResourceFromFile ¶
func LoadResourcesFromFile ¶
func MustLoadFileBytes ¶ added in v0.10.0
MustLoadFileBytes loads a file as []bytes will panic if if failes ONLY FOR TEST USAGE
func MustLoadFileString ¶ added in v0.7.0
MustLoadFileString loads a file as string will panic if if failes ONLY FOR TEST USAGE
func MustLoadJSON ¶ added in v0.7.0
func MustLoadJSON(file string, obj interface{})
MustLoadJSON loads json or panics if the parse fails.
func MustLoadMultiYamlOrJson ¶ added in v0.7.0
MustLoadMultiYamlOrJson loads multi yamls or panics if the parse fails.
func MustLoadReturnObjectFromYAML ¶ added in v0.7.0
func MustLoadReturnObjectFromYAML(file string, obj interface{}) interface{}
MustLoadReturnObjectFromYAML loads and object from yaml file and returns as interface{} if any loading errors happen will panic TO BE USED IN TESTS, DO NOT USE IN PRODUCTION CODE
func MustLoadYaml ¶ added in v0.7.0
func MustLoadYaml(file string, obj interface{})
MustLoadYaml loads yaml or panics if the parse fails.
func ReflectName ¶ added in v0.10.0
func ReflectName(obj interface{}) string
ReflectName reflect the type name of the object
func RestoreDirectories ¶ added in v0.10.0
RestoreDirectories restore directories from embed.FS to targetDir
func RuntimeObjectFromUnstructured ¶
func RuntimeObjectFromUnstructured(scheme *runtime.Scheme, u *unstructured.Unstructured) (runtime.Object, error)
RuntimeObjectFromUnstructured converts an unstructured to a runtime object
func ToObjectList ¶ added in v0.7.0
ToObjectList converts resource list to a list of client.Object
func UnstructedToTyped ¶
func UnstructedToTyped(from unstructured.Unstructured, to interface{}) error
UnstructedToTyped converts an unstructured object into a object Warning: This SHOULD never be used in production code, only in test code
func WarningOnError ¶
func WarningOnError(logger *zap.SugaredLogger, err error, message string)
WarningOnError set a warning on error
Types ¶
type ConditionBuilder ¶
ConditionBuilder builds a conditions in a builder pattern
func BuildCondition ¶
func BuildCondition() *ConditionBuilder
BuildCondition starts a condition builder object useful for unit tests that require validating multiple conditions
func (*ConditionBuilder) Done ¶
func (c *ConditionBuilder) Done() *apis.Condition
SetReasonMessage returns a condition
func (*ConditionBuilder) SetReasonMessage ¶
func (c *ConditionBuilder) SetReasonMessage(reason, message string, formtKeyValues ...interface{}) *ConditionBuilder
SetReasonMessage sets the message for the condition
func (*ConditionBuilder) SetStatus ¶
func (c *ConditionBuilder) SetStatus(stat corev1.ConditionStatus) *ConditionBuilder
SetStatus sets the status for the condition
func (*ConditionBuilder) SetType ¶
func (c *ConditionBuilder) SetType(ct apis.ConditionType) *ConditionBuilder
SetType sets the type for the condition
type ConvertRuntimeObjctToClientObjectFunc ¶ added in v0.3.0
type ScriptResult ¶ added in v0.10.0
type ScriptResult struct {
OutputDataPrefix string
// contains filtered or unexported fields
}
ScriptResult the result of script execution
func ExecBashScript ¶ added in v0.10.0
func ExecBashScript(script string, params ...string) *ScriptResult
ExecBashScript exec bash script with params
func ExecScript ¶ added in v0.10.0
func ExecScript(name string, arg ...string) *ScriptResult
ExecScript exec script with params
func (*ScriptResult) Error ¶ added in v0.10.0
func (p *ScriptResult) Error() error
Error get the error of a script execution
func (*ScriptResult) ExitCode ¶ added in v0.10.0
func (p *ScriptResult) ExitCode() int
ExitCode get the exit code of a script execution
func (*ScriptResult) ExitMessage ¶ added in v0.10.0
func (p *ScriptResult) ExitMessage() string
ExitMessage get the exit message of a script execution
func (*ScriptResult) OutputData ¶ added in v0.10.0
func (p *ScriptResult) OutputData(dataPrefix string) string
OutputData get the output of a script execution, it can be a structured data, e.g: json string
func (*ScriptResult) Stderr ¶ added in v0.10.0
func (p *ScriptResult) Stderr() string
Stderr get the error output of a script execution
func (*ScriptResult) Stdout ¶ added in v0.10.0
func (p *ScriptResult) Stdout() string
Stdout get the output of a script execution
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock contains useful functionality for testing
|
Package mock contains useful functionality for testing |
|
github.com/katanomi/pkg
Package sharedmain is a generated GoMock package.
|
Package sharedmain is a generated GoMock package. |
|
github.com/katanomi/pkg/apis/meta/v1alpha1
Package apis is a generated GoMock package.
|
Package apis is a generated GoMock package. |
|
github.com/katanomi/pkg/conditioner
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
|
github.com/katanomi/pkg/multicluster
Package multicluster is a generated GoMock package.
|
Package multicluster is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/client
Package client is a generated GoMock package.
|
Package client is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage
Package storage is a generated GoMock package.
|
Package storage is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage/capabilities/archive/v1alpha1
Package v1alpha1 is a generated GoMock package.
|
Package v1alpha1 is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage/capabilities/filestore/v1alpha1
Package v1alpha1 is a generated GoMock package.
|
Package v1alpha1 is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage/client
Package v1alpha1 is a generated GoMock package.
|
Package v1alpha1 is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage/client/versioned/archive/v1alpha1
Package v1alpha1 is a generated GoMock package.
|
Package v1alpha1 is a generated GoMock package. |
|
github.com/katanomi/pkg/plugin/storage/client/versioned/filestore/v1alpha1
Package v1alpha1 is a generated GoMock package.
|
Package v1alpha1 is a generated GoMock package. |
|
github.com/katanomi/pkg/webhook/admission
Package admission is a generated GoMock package.
|
Package admission is a generated GoMock package. |
|
github.com/minio/minio-go
Package pkg is a generated GoMock package.
|
Package pkg is a generated GoMock package. |
|
k8s.io/cli-runtime/pkg/genericclioptions
Package genericclioptions is a generated GoMock package.
|
Package genericclioptions is a generated GoMock package. |
|
k8s.io/client-go/kubernetes
Package kubernetes is a generated GoMock package.
|
Package kubernetes is a generated GoMock package. |
|
k8s.io/client-go/tools/clientcmd
Package clientcmd is a generated GoMock package.
|
Package clientcmd is a generated GoMock package. |
|
knative.dev/pkg/apis
Package apis is a generated GoMock package.
|
Package apis is a generated GoMock package. |
|
sigs.k8s.io/controller-runtime/pkg/client
Package client is a generated GoMock package.
|
Package client is a generated GoMock package. |
|
sigs.k8s.io/controller-runtime/pkg/manager
Package manager is a generated GoMock package.
|
Package manager is a generated GoMock package. |
|
testing/fake
Package fake is a generated GoMock package.
|
Package fake is a generated GoMock package. |