Documentation ¶
Index ¶
- Variables
- 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 AdminComponent
- type Component
- func NewAdminComponent(spec *v1alpha1.AdminSpec, opts ...ComponentOption) (Component, error)
- func NewGrafanaComponent(spec *v1alpha1.GrafanaSpec, opts ...ComponentOption) (Component, error)
- func NewNacosComponent(spec *v1alpha1.NacosSpec, opts ...ComponentOption) (Component, error)
- func NewPrometheusComponent(spec *v1alpha1.PrometheusSpec, opts ...ComponentOption) (Component, error)
- func NewSkywalkingComponent(spec *v1alpha1.SkywalkingSpec, opts ...ComponentOption) (Component, error)
- func NewZipkinComponent(spec *v1alpha1.ZipkinSpec, opts ...ComponentOption) (Component, error)
- func NewZookeeperComponent(spec *v1alpha1.ZookeeperSpec, opts ...ComponentOption) (Component, error)
- type ComponentName
- type ComponentOption
- type ComponentOptions
- type CtlClient
- func (cli *CtlClient) ApplyManifest(manifest string, ns string, name ComponentName) error
- func (cli *CtlClient) ApplyObject(obj *unstructured.Unstructured) error
- func (cli *CtlClient) CreateNamespace(ns string) error
- func (cli *CtlClient) RemoveManifest(manifest string, ns string) error
- func (cli *CtlClient) RemoveObject(obj *unstructured.Unstructured) error
- type CtlClientOption
- type CtlClientOptions
- type DubboOperator
- type GrafanaComponent
- type NacosComponent
- type Object
- type Objects
- type PortForward
- type PrometheusComponent
- type SkywalkingComponent
- type ZipkinComponent
- type ZookeeperComponent
Constants ¶
This section is empty.
Variables ¶
var ComponentMap = map[string]ComponentName{ "admin": Admin, "grafana": Grafana, "nacos": Nacos, "zookeeper": Zookeeper, "prometheus": Prometheus, "skywalking": Skywalking, "zipkin": Zipkin, }
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 AdminComponent ¶
type AdminComponent struct {
// contains filtered or unexported fields
}
func (*AdminComponent) RenderManifest ¶
func (ac *AdminComponent) RenderManifest() (string, error)
func (*AdminComponent) Run ¶
func (ac *AdminComponent) Run() error
type Component ¶
Component is used to represent dubbo control plane module, eg: zookeeper
func NewAdminComponent ¶
func NewAdminComponent(spec *v1alpha1.AdminSpec, opts ...ComponentOption) (Component, error)
func NewGrafanaComponent ¶
func NewGrafanaComponent(spec *v1alpha1.GrafanaSpec, opts ...ComponentOption) (Component, error)
func NewNacosComponent ¶
func NewNacosComponent(spec *v1alpha1.NacosSpec, opts ...ComponentOption) (Component, error)
func NewPrometheusComponent ¶
func NewPrometheusComponent(spec *v1alpha1.PrometheusSpec, opts ...ComponentOption) (Component, error)
func NewSkywalkingComponent ¶
func NewSkywalkingComponent(spec *v1alpha1.SkywalkingSpec, opts ...ComponentOption) (Component, error)
func NewZipkinComponent ¶
func NewZipkinComponent(spec *v1alpha1.ZipkinSpec, opts ...ComponentOption) (Component, error)
func NewZookeeperComponent ¶
func NewZookeeperComponent(spec *v1alpha1.ZookeeperSpec, opts ...ComponentOption) (Component, error)
type ComponentName ¶
type ComponentName string
const ( Admin ComponentName = "admin" Grafana ComponentName = "grafana" Nacos ComponentName = "nacos" Zookeeper ComponentName = "zookeeper" Prometheus ComponentName = "prometheus" Skywalking ComponentName = "skywalking" Zipkin ComponentName = "zipkin" )
type ComponentOption ¶
type ComponentOption func(*ComponentOptions)
func WithChartPath ¶
func WithChartPath(path string) ComponentOption
func WithNamespace ¶
func WithNamespace(namespace string) ComponentOption
func WithRepoURL ¶
func WithRepoURL(url string) ComponentOption
func WithVersion ¶
func WithVersion(version string) ComponentOption
type ComponentOptions ¶
type CtlClient ¶
CtlClient wraps controller-runtime clientgen and is used by dubboctl
func NewCtlClient ¶
func NewCtlClient(opts ...CtlClientOption) (*CtlClient, error)
func (*CtlClient) ApplyManifest ¶
func (cli *CtlClient) ApplyManifest(manifest string, ns string, name ComponentName) error
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) CreateNamespace ¶
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 DubboOperator ¶
type DubboOperator struct {
// contains filtered or unexported fields
}
func NewDubboOperator ¶
func NewDubboOperator(spec *v1alpha1.DubboConfigSpec, cli *CtlClient) (*DubboOperator, error)
NewDubboOperator accepts cli directly for testing and normal use. For now, every related command needs a dedicated DubboOperator.
func (*DubboOperator) ApplyManifest ¶
func (do *DubboOperator) ApplyManifest(manifestMap map[ComponentName]string) error
ApplyManifest apply bootstrap manifests to k8s cluster
func (*DubboOperator) RemoveManifest ¶
func (do *DubboOperator) RemoveManifest(manifestMap map[ComponentName]string) error
RemoveManifest removes resources represented by bootstrap manifests
func (*DubboOperator) RenderManifest ¶
func (do *DubboOperator) RenderManifest() (map[ComponentName]string, error)
RenderManifest renders bootstrap manifests specified by DubboConfigSpec.
func (*DubboOperator) Run ¶
func (do *DubboOperator) Run() error
Run must be invoked before invoking other functions.
type GrafanaComponent ¶
type GrafanaComponent struct {
// contains filtered or unexported fields
}
func (*GrafanaComponent) RenderManifest ¶
func (gc *GrafanaComponent) RenderManifest() (string, error)
func (*GrafanaComponent) Run ¶
func (gc *GrafanaComponent) Run() error
type NacosComponent ¶
type NacosComponent struct {
// contains filtered or unexported fields
}
func (*NacosComponent) RenderManifest ¶
func (nc *NacosComponent) RenderManifest() (string, error)
func (*NacosComponent) Run ¶
func (nc *NacosComponent) Run() error
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
type PrometheusComponent ¶
type PrometheusComponent struct {
// contains filtered or unexported fields
}
func (*PrometheusComponent) RenderManifest ¶
func (pc *PrometheusComponent) RenderManifest() (string, error)
func (*PrometheusComponent) Run ¶
func (pc *PrometheusComponent) Run() error
type SkywalkingComponent ¶
type SkywalkingComponent struct {
// contains filtered or unexported fields
}
func (*SkywalkingComponent) RenderManifest ¶
func (sc *SkywalkingComponent) RenderManifest() (string, error)
func (*SkywalkingComponent) Run ¶
func (sc *SkywalkingComponent) Run() error
type ZipkinComponent ¶
type ZipkinComponent struct {
// contains filtered or unexported fields
}
func (*ZipkinComponent) RenderManifest ¶
func (zc *ZipkinComponent) RenderManifest() (string, error)
func (*ZipkinComponent) Run ¶
func (zc *ZipkinComponent) Run() error
type ZookeeperComponent ¶
type ZookeeperComponent struct {
// contains filtered or unexported fields
}
func (*ZookeeperComponent) RenderManifest ¶
func (zc *ZookeeperComponent) RenderManifest() (string, error)
func (*ZookeeperComponent) Run ¶
func (zc *ZookeeperComponent) Run() error