Documentation
¶
Index ¶
- Constants
- Variables
- func BoolPtr(val bool) *bool
- func CheckSum(s []byte) string
- func DeepCopyValues(input map[string]interface{}) map[string]interface{}
- func DeleteValue(values map[string]interface{}, fields ...string)
- func DiffStr(expected interface{}, actual interface{}) string
- func DoWithBackoff(name string, fn func() error, maxRetry int, backOff time.Duration) error
- func GetBoolValue(values map[string]interface{}, fields ...string) (bool, bool)
- func GetGitRepoRootDir() string
- func GetHostPort(endpoint string) (string, int32)
- func GetNumberValue(values map[string]interface{}, fields ...string) (float64, bool)
- func GetStringValue(values map[string]interface{}, fields ...string) (string, bool)
- func GetTemplatedValues(templateConfig string, values interface{}) ([]byte, error)
- func HTTPGetBytes(url string) ([]byte, error)
- func JoinErrors(errs []error) string
- func MergeValues(origin, patch map[string]interface{})
- func SetLogger(l logr.Logger)
- func SetStringSlice(values map[string]interface{}, v []string, fields ...string)
- func SetValue(values map[string]interface{}, v interface{}, fields ...string)
- type K8sClient
- type K8sClients
- func (clis K8sClients) Create(ctx context.Context, manifest []byte) error
- func (clis K8sClients) Delete(ctx context.Context, manifest []byte) error
- func (clis K8sClients) Exist(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (bool, error)
- func (clis *K8sClients) GetCRDVersionsByNames(ctx context.Context, crdNames []string) (map[string]string, error)
- func (clis *K8sClients) ListCRDs(ctx context.Context) (*apiextensionsv1.CustomResourceDefinitionList, error)
- func (clis K8sClients) WaitDeploymentsReadyByNamespace(ctx context.Context, namespace string) error
Constants ¶
View Source
const MqTypeConfigKey = "messageQueue"
Variables ¶
View Source
var DefaultBackOffInterval = time.Second * 1
View Source
var DefaultHTTPTimeout = 15 * time.Second
View Source
var DefaultMaxRetry = 3
Functions ¶
func DeepCopyValues ¶
func DeleteValue ¶
func DiffStr ¶
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 DoWithBackoff ¶
func GetGitRepoRootDir ¶
func GetGitRepoRootDir() string
func GetHostPort ¶
func GetNumberValue ¶
GetNumberValue supports int64 / float64 in values return as float64 see https://datatracker.ietf.org/doc/html/rfc8259#section-6
func GetStringValue ¶
func GetTemplatedValues ¶
func HTTPGetBytes ¶
func JoinErrors ¶
func MergeValues ¶
func MergeValues(origin, patch map[string]interface{})
MergeValues merges patch into origin, you have to make sure origin is not nil, otherwise it won't work
func SetStringSlice ¶
Types ¶
type K8sClient ¶
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 ¶
type K8sClients struct {
ClientSet kubernetes.Interface
ExtClientSet clientset.Interface
DynamicClient dynamic.Interface
}
func NewK8sClientsForConfig ¶
func NewK8sClientsForConfig(config *rest.Config) (*K8sClients, error)
func (K8sClients) Create ¶
func (clis K8sClients) Create(ctx context.Context, manifest []byte) error
Create creates resource from manifest
func (K8sClients) Delete ¶
func (clis K8sClients) Delete(ctx context.Context, manifest []byte) error
Delete delete resource from manifest
func (K8sClients) Exist ¶
func (clis K8sClients) Exist(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (bool, error)
func (*K8sClients) GetCRDVersionsByNames ¶
func (*K8sClients) ListCRDs ¶
func (clis *K8sClients) ListCRDs(ctx context.Context) (*apiextensionsv1.CustomResourceDefinitionList, error)
ListCRDs list all CRDs
func (K8sClients) WaitDeploymentsReadyByNamespace ¶
func (clis K8sClients) WaitDeploymentsReadyByNamespace(ctx context.Context, namespace string) error
Click to show internal directories.
Click to hide internal directories.