oam

package
v0.0.0-...-d46a6ae Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (
	STypeComponent                = "component"
	STypeScope                    = "scope"
	STypeWorkloadType             = "workloadType"
	STypeApplicationConfiguration = "applicationConfiguration"
	STypeTrait                    = "trait"
)

Variables

This section is empty.

Functions

func ControllerOption

func ControllerOption(name SType, opt controller.Options)

func GetMgr

func GetMgr() ctrl.Manager

func InitMgr

func InitMgr(conf *rest.Config, options ctrl.Options)

func Owns

func Owns(name SType, owns ...runtime.Object)

func RegisterHandlers

func RegisterHandlers(name SType, handlers ...Handler)

func RegisterObject

func RegisterObject(tp SType, obj runtime.Object)

func Run

func Run(options ...Option) error

Types

type Action

type Action struct {
	// plugin do action, e.g: k8s, helm, ...
	Provider PType
	// action command, e.g: Create, Update
	Command CmdType
	// action content, for k8s plugin, this is k8s object, for helm plugin, this is helm chart address.
	Plan interface{}
}

type ActionContext

type ActionContext struct {
	PreActions  []Action
	Actions     []Action
	PostActions []Action
	Values      map[string]interface{}
}

func (*ActionContext) Add

func (o *ActionContext) Add(a ...Action)

add actions executed before actions added through AddPost method

func (*ActionContext) AddPost

func (o *ActionContext) AddPost(a ...Action)

func (*ActionContext) AddPre

func (o *ActionContext) AddPre(a ...Action)

add actions executed before actions added through Add method

func (*ActionContext) AddValue

func (o *ActionContext) AddValue(k string, v interface{})

func (*ActionContext) Gather

func (o *ActionContext) Gather() []Action

clear and gather all actions according to action order.

func (*ActionContext) GetValue

func (o *ActionContext) GetValue(k string) interface{}

type CmdType

type CmdType string
const (
	CmdTypeUpdate CmdType = "Update"
	CmdTypeCreate CmdType = "Create"
	CmdTypeDelete CmdType = "Delete"
)

type ControllerContext

type ControllerContext struct {
	// contains filtered or unexported fields
}

type EType

type EType string
const (
	CreateOrUpdate EType = "CreateOrUpdate"
	Delete         EType = "Delete"
)

type Handler

type Handler interface {
	Identity
	Handle(ctx *ActionContext, ac runtime.Object, EventType EType) error
}

type Identity

type Identity interface {
	Id() string
}

type Option

type Option func() error

func WithApplicationConfiguration

func WithApplicationConfiguration() Option

WithApplicationConfiguration registers ApplicationConfiguration reconciler

func WithComponent

func WithComponent() Option

WithComponent registers Component reconciler

func WithScope

func WithScope() Option

WithScpe registers Scpe reconciler

func WithSpec

func WithSpec(tp SType) Option

func WithTrait

func WithTrait() Option

WithTrait registers Trait reconciler

func WithWorkloadType

func WithWorkloadType() Option

WithWorkloadType registers WorkloadType reconciler

type PType

type PType string
const (
	PTypeK8S PType = "k8s"
)

type Reconciler

type Reconciler struct {
	client.Client

	Log               logr.Logger
	Scheme            *runtime.Scheme
	ControllerContext ControllerContext
	// contains filtered or unexported fields
}

Reconciler reconciles a runtime object in oam

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)

+kubebuilder:rbac:groups=*,resources=*,verbs=*

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error

type SType

type SType string

SType for spec type

func (SType) GetRuntimeObj

func (s SType) GetRuntimeObj() (runtime.Object, error)

func (SType) RuntimeObj

func (s SType) RuntimeObj() runtime.Object

RuntimeObj returns one of oam Objects matched the SType

Jump to

Keyboard shortcuts

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