choreo

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DummyBranch = "dummy"

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(dirname string) error

func Exists

func Exists(filepath string) bool

func HasAPIResource added in v0.0.9

func HasAPIResource(apiResources []*discoverypb.APIResource, gvk schema.GroupVersionKind) bool

func PrintAPIResource added in v0.0.9

func PrintAPIResource(apiResources []*discoverypb.APIResource) bool

Types

type BranchCtx

type BranchCtx struct {
	State    State
	Branch   string
	APIStore *api.APIStore
}

type BranchStore

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

func NewBranchStore

func NewBranchStore(choreo *choreo) *BranchStore

func (*BranchStore) Delete

func (r *BranchStore) Delete(ctx context.Context, branchSet repository.BranchSet) error

func (*BranchStore) GetCheckedOut added in v0.0.9

func (r *BranchStore) GetCheckedOut() (*BranchCtx, error)

func (*BranchStore) GetStore

func (r *BranchStore) GetStore() store.Storer[*BranchCtx]

func (*BranchStore) LoadData

func (r *BranchStore) LoadData(ctx context.Context, branch string) error

func (*BranchStore) Update

func (r *BranchStore) Update(ctx context.Context, branches []*branchpb.BranchObject) error

func (*BranchStore) WatchAPIResources

func (*BranchStore) WatchBranches

func (r *BranchStore) WatchBranches(ctx context.Context, opts ...store.ListOption) (watch.WatchInterface[*BranchCtx], error)

type CheckedOut

type CheckedOut struct {
	Choreo               *choreo
	Client               resourceclient.Client
	ChildChoreoInstances []ChoreoInstance
}

func (*CheckedOut) Activate

func (r *CheckedOut) Activate(ctx context.Context, branchCtx *BranchCtx) error

func (*CheckedOut) DeActivate

func (r *CheckedOut) DeActivate(_ context.Context, branchCtx *BranchCtx) error

func (*CheckedOut) GetCommit

func (r *CheckedOut) GetCommit() *object.Commit

func (*CheckedOut) LoadData

func (r *CheckedOut) LoadData(ctx context.Context, branchCtx *BranchCtx) error

func (*CheckedOut) String

func (r *CheckedOut) String() string

type ChildChoreoInstance

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

func (*ChildChoreoInstance) Destroy added in v0.0.9

func (r *ChildChoreoInstance) Destroy() error

func (*ChildChoreoInstance) GetAPIClient

func (r *ChildChoreoInstance) GetAPIClient() resourceclient.Client

func (*ChildChoreoInstance) GetAPIStore

func (r *ChildChoreoInstance) GetAPIStore() *api.APIStore

func (*ChildChoreoInstance) GetAnnotationVal

func (r *ChildChoreoInstance) GetAnnotationVal() string

func (*ChildChoreoInstance) GetCommit

func (r *ChildChoreoInstance) GetCommit() *object.Commit

func (*ChildChoreoInstance) GetDBPath

func (r *ChildChoreoInstance) GetDBPath() string

func (*ChildChoreoInstance) GetFlags

func (*ChildChoreoInstance) GetName

func (r *ChildChoreoInstance) GetName() string

func (*ChildChoreoInstance) GetPath

func (r *ChildChoreoInstance) GetPath() string

func (*ChildChoreoInstance) GetPathInRepo

func (r *ChildChoreoInstance) GetPathInRepo() string

func (*ChildChoreoInstance) GetRepo

func (*ChildChoreoInstance) GetRepoPath

func (r *ChildChoreoInstance) GetRepoPath() string

func (*ChildChoreoInstance) GetTempPath

func (r *ChildChoreoInstance) GetTempPath() string

func (*ChildChoreoInstance) LoadInternalAPIs

func (r *ChildChoreoInstance) LoadInternalAPIs() error

type Choreo

type Choreo interface {
	Get(ctx context.Context, req *choreopb.Get_Request) (*choreopb.Get_Response, error)
	Apply(ctx context.Context, req *choreopb.Apply_Request) (*choreopb.Apply_Response, error)
	Start(ctx context.Context)
	GetMainChoreoInstance() ChoreoInstance
	GetBranchStore() *BranchStore
	Runner() Runner
	// updates resource (yaml) in the input directory
	Store(obj runtime.Unstructured) error
	// remove resource (yaml) from the input directory
	Destroy(obj runtime.Unstructured) error
}

func New

type ChoreoInstance

type ChoreoInstance interface {
	GetName() string
	GetRepo() repository.Repository
	GetRepoPath() string
	GetPath() string
	GetTempPath() string
	GetPathInRepo() string
	GetDBPath() string
	GetFlags() *genericclioptions.ConfigFlags
	GetAPIStore() *api.APIStore // provides the internal apistore
	GetCommit() *object.Commit
	GetAPIClient() resourceclient.Client
	GetAnnotationVal() string
	Destroy() error
}

func NewChildChoreoInstance

func NewChildChoreoInstance(ctx context.Context, repo repository.Repository, pathInRepo string, flags *genericclioptions.ConfigFlags, commit *object.Commit, annotationVal string) (ChoreoInstance, error)

func NewMainChoreoInstance

func NewMainChoreoInstance(ctx context.Context, config *Config) (ChoreoInstance, error)

type ChoreoStatus added in v0.0.9

type ChoreoStatus struct {
	Status             bool
	Reason             string
	MainChoreoInstance ChoreoInstance
	ChoreoCtx          *choreopb.ChoreoContext
}

func Failed added in v0.0.9

func Failed(msg string) ChoreoStatus

func Initializing added in v0.0.9

func Initializing() ChoreoStatus

func Success added in v0.0.9

func Success(c ChoreoInstance, choreoCtx *choreopb.ChoreoContext) ChoreoStatus

type Config added in v0.0.9

type Config struct {
	Path       string
	Repo       repository.Repository
	Commit     *object.Commit
	PathInRepo string
	Flags      *genericclioptions.ConfigFlags
}

type Event

type Event int
const (
	Activate Event = iota
	DeActivate
)

func (Event) String

func (r Event) String() string

type MainChoreoInstance

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

func (*MainChoreoInstance) Destroy added in v0.0.9

func (r *MainChoreoInstance) Destroy() error

func (*MainChoreoInstance) GetAPIClient

func (r *MainChoreoInstance) GetAPIClient() resourceclient.Client

func (*MainChoreoInstance) GetAPIStore

func (r *MainChoreoInstance) GetAPIStore() *api.APIStore

func (*MainChoreoInstance) GetAnnotationVal

func (r *MainChoreoInstance) GetAnnotationVal() string

func (*MainChoreoInstance) GetCommit

func (r *MainChoreoInstance) GetCommit() *object.Commit

func (*MainChoreoInstance) GetDBPath

func (r *MainChoreoInstance) GetDBPath() string

func (*MainChoreoInstance) GetFlags

func (*MainChoreoInstance) GetName

func (r *MainChoreoInstance) GetName() string

func (*MainChoreoInstance) GetPath

func (r *MainChoreoInstance) GetPath() string

func (*MainChoreoInstance) GetPathInRepo

func (r *MainChoreoInstance) GetPathInRepo() string

func (*MainChoreoInstance) GetRepo

func (*MainChoreoInstance) GetRepoPath

func (r *MainChoreoInstance) GetRepoPath() string

func (*MainChoreoInstance) GetTempPath

func (r *MainChoreoInstance) GetTempPath() string

func (*MainChoreoInstance) LoadInternalAPIs

func (r *MainChoreoInstance) LoadInternalAPIs() error

type NotCheckedOut

type NotCheckedOut struct {
	Commit *object.Commit
	Choreo *choreo
	Client resourceclient.Client
}

func (*NotCheckedOut) Activate

func (r *NotCheckedOut) Activate(ctx context.Context, branchCtx *BranchCtx) error

func (*NotCheckedOut) DeActivate

func (r *NotCheckedOut) DeActivate(_ context.Context, branchCtx *BranchCtx) error

func (*NotCheckedOut) GetCommit

func (r *NotCheckedOut) GetCommit() *object.Commit

func (*NotCheckedOut) LoadData

func (r *NotCheckedOut) LoadData(_ context.Context, branchCtx *BranchCtx) error

func (*NotCheckedOut) String

func (r *NotCheckedOut) String() string

type Runner added in v0.0.9

type Runner interface {
	AddResourceClientAndContext(ctx context.Context, client resourceclient.Client)
	Start(ctx context.Context, bctx *BranchCtx) (*choreopb.Start_Response, error)
	Stop()
	RunOnce(ctx context.Context, bctx *BranchCtx) (*choreopb.Once_Response, error)
}

func NewRunner added in v0.0.9

func NewRunner(choreo Choreo) Runner

type RunnerStatus added in v0.0.9

type RunnerStatus int
const (
	RunnerStatus_Stopped RunnerStatus = iota
	RunnerStatus_Running
	RunnerStatus_Once
)

func (RunnerStatus) String added in v0.0.9

func (rs RunnerStatus) String() string

type State

type State interface {
	String() string
	Activate(ctx context.Context, branchCtx *BranchCtx) error
	DeActivate(ctx context.Context, branchCtx *BranchCtx) error
	LoadData(ctx context.Context, branchCtx *BranchCtx) error
	GetCommit() *object.Commit
}

type Status added in v0.0.9

type Status struct {
	ChoreoStatus
	// contains filtered or unexported fields
}

func (*Status) Changed added in v0.0.9

func (r *Status) Changed(newChoreoCtx *choreopb.ChoreoContext) bool

func (*Status) Get added in v0.0.9

func (r *Status) Get() ChoreoStatus

func (*Status) Set added in v0.0.9

func (r *Status) Set(s ChoreoStatus)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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