Documentation ¶
Index ¶
- func BuildConfig(kubecfgPath string, ctx string) (*rest.Config, error)
- func CompareObject(objA, objB *Object) (string, error)
- func CompareObjects(objsA, objsB Objects) (string, string, string)
- func OverlayObject(base *unstructured.Unstructured, overlay *unstructured.Unstructured) error
- type CtlClient
- type CtlClientOption
- type CtlClientOptions
- type Object
- type Objects
- type PortForward
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildConfig ¶
BuildConfig loading rules: 1. kubeconfig if it not empty string 2. Config(s) in KUBECONFIG environment variable 3. In cluster config if running in-cluster 4. Use $HOME/.kube/config
func CompareObject ¶
CompareObject compares two objects and returns diff.
func CompareObjects ¶
CompareObjects compares object lists and returns diff, add, err using util.DiffYAML. It compares objects with same hash value(Namespace:Kind:Name) and returns diff. For objects that only one list have, it returns add. For objects that could not be parsed successfully, it returns err. Refer to TestCompareObjects for examples.
func OverlayObject ¶
func OverlayObject(base *unstructured.Unstructured, overlay *unstructured.Unstructured) error
OverlayObject uses JSON patch strategy to overlay two unstructured objects
Types ¶
type CtlClient ¶
CtlClient wraps controller-runtime client and is used by dubboctl
func NewCtlClient ¶
func NewCtlClient(opts ...CtlClientOption) (*CtlClient, error)
func (*CtlClient) ApplyManifest ¶
ApplyManifest applies manifest to certain namespace If there is not this namespace, create it first
func (*CtlClient) ApplyObject ¶
func (cli *CtlClient) ApplyObject(obj *unstructured.Unstructured) error
ApplyObject creates or updates unstructured object
func (*CtlClient) RemoveManifest ¶
func (*CtlClient) RemoveObject ¶
func (cli *CtlClient) RemoveObject(obj *unstructured.Unstructured) error
type CtlClientOption ¶
type CtlClientOption func(*CtlClientOptions)
func WithCli ¶
func WithCli(cli client.Client) CtlClientOption
func WithContext ¶
func WithContext(ctx string) CtlClientOption
func WithKubeConfigPath ¶
func WithKubeConfigPath(path string) CtlClientOption
type CtlClientOptions ¶
type Object ¶
type Object struct { Namespace string Name string Group string Kind string // contains filtered or unexported fields }
Object wraps k8s Unstructured and exposes the fields we need
func NewObject ¶
func NewObject(obj *unstructured.Unstructured, yamlStr string) *Object
func ParseObjectFromManifest ¶
ParseObjectFromManifest parse Object from manifest which represents a single K8s object
func (*Object) SetNamespace ¶
func (*Object) Unstructured ¶
func (obj *Object) Unstructured() *unstructured.Unstructured
type Objects ¶
type Objects []*Object
func ParseObjectsFromManifest ¶
ParseObjectsFromManifest parse Objects from manifest which divided by YAML separator "\n---\n"
type PortForward ¶
type PortForward struct {
// contains filtered or unexported fields
}
func NewPortForward ¶
func (*PortForward) Run ¶
func (pf *PortForward) Run() error
func (*PortForward) Wait ¶
func (pf *PortForward) Wait()
Wait wait for closing stopCh which means that Stop function is the only way to trigger