util

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPTimeout = 15 * time.Second

Functions

func CheckSum

func CheckSum(s []byte) string

func DeleteValue

func DeleteValue(values map[string]interface{}, fields ...string)

func DiffStr added in v0.3.2

func DiffStr(expected interface{}, actual interface{}) string

DiffStr returns a diff of both values as long as both are of the same type and are a struct, map, slice, array or string. Otherwise it returns an empty string. ref: github.com/stretchr/testify/assert:diff()

func GetBoolValue

func GetBoolValue(values map[string]interface{}, fields ...string) (bool, bool)

func GetGitRepoRootDir added in v0.2.0

func GetGitRepoRootDir() string

func GetHostPort

func GetHostPort(endpoint string) (string, int32)

func GetTemplatedValues

func GetTemplatedValues(templateConfig string, values interface{}) ([]byte, error)

func HTTPGetBytes added in v0.3.0

func HTTPGetBytes(url string) ([]byte, error)

func JoinErrors

func JoinErrors(errs []error) string

func MergeValues

func MergeValues(origin, patch map[string]interface{})

func SetStringSlice

func SetStringSlice(values map[string]interface{}, v []string, fields ...string)

func SetValue

func SetValue(values map[string]interface{}, v interface{}, fields ...string)

only contains types bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil

Types

type K8sClient added in v0.3.0

type K8sClient interface {
	Exist(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (bool, error)

	// Create creates resources from manifest
	Create(ctx context.Context, manifest []byte) error

	// Delete delete resources from manifest
	Delete(ctx context.Context, manifest []byte) error

	// ListCRDs list all CRDs
	ListCRDs(ctx context.Context) (*apiextensionsv1.CustomResourceDefinitionList, error)

	// GetCRDVersionsByNames returns map[crdName]crdVersion
	GetCRDVersionsByNames(ctx context.Context, crdNames []string) (map[string]string, error)

	// WaitDeploymentReady
	WaitDeploymentsReadyByNamespace(ctx context.Context, namespace string) error
}

K8sClient wrap functions by k8s clients

type K8sClients added in v0.3.0

type K8sClients struct {
	ClientSet     kubernetes.Interface
	ExtClientSet  clientset.Interface
	DynamicClient dynamic.Interface
}

func NewK8sClientsForConfig added in v0.3.0

func NewK8sClientsForConfig(config *rest.Config) (*K8sClients, error)

func (K8sClients) Create added in v0.3.0

func (clis K8sClients) Create(ctx context.Context, manifest []byte) error

Create creates resource from manifest

func (K8sClients) Delete added in v0.3.0

func (clis K8sClients) Delete(ctx context.Context, manifest []byte) error

Delete delete resource from manifest

func (K8sClients) Exist added in v0.3.0

func (clis K8sClients) Exist(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (bool, error)

func (*K8sClients) GetCRDVersionsByNames added in v0.3.0

func (clis *K8sClients) GetCRDVersionsByNames(ctx context.Context, crdNames []string) (map[string]string, error)

func (*K8sClients) ListCRDs added in v0.3.0

ListCRDs list all CRDs

func (K8sClients) WaitDeploymentsReadyByNamespace added in v0.3.0

func (clis K8sClients) WaitDeploymentsReadyByNamespace(ctx context.Context, namespace string) error

Jump to

Keyboard shortcuts

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