plugins

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const TypeGithub = "github"
View Source
const TypeUnknown = "unknown"

Variables

This section is empty.

Functions

func GetCapabilitiesFromCluster

func GetCapabilitiesFromCluster(ctx context.Context, namespace string, c client.Client, syncDir string, selector labels.Selector) ([]types.Capability, error)

func GetInstalledCapabilityWithCapAlias

func GetInstalledCapabilityWithCapAlias(capT types.CapType, capAlias string) (types.Capability, error)

func GetSubDir

func GetSubDir(dir string, capT types.CapType) string

func GetTraitsFromCluster

func GetTraitsFromCluster(ctx context.Context, namespace string, c client.Client, syncDir string, selector labels.Selector) ([]types.Capability, error)

func GetWorkloadsFromCluster

func GetWorkloadsFromCluster(ctx context.Context, namespace string, c client.Client, syncDir string, selector labels.Selector) ([]types.Capability, error)

func HandleDefinition

func HandleDefinition(name, syncDir, crdName string, extention *runtime.RawExtension, tp types.CapType, applyTo []string) (types.Capability, error)

func HandleTemplate

func HandleTemplate(in *runtime.RawExtension, name, syncDir string) (types.Capability, error)

func LoadAllInstalledCapability

func LoadAllInstalledCapability() ([]types.Capability, error)

func LoadCapabilityByName

func LoadCapabilityByName(name string) (types.Capability, error)

func LoadCapabilityFromSyncedCenter

func LoadCapabilityFromSyncedCenter(dir string) ([]types.Capability, error)

func LoadInstalledCapabilityWithType

func LoadInstalledCapabilityWithType(capT types.CapType) ([]types.Capability, error)

func ParseAndSyncCapability

func ParseAndSyncCapability(data []byte, syncDir string) (types.Capability, error)

func SinkTemp2Local

func SinkTemp2Local(templates []types.Capability, dir string) int

func StoreRepos

func StoreRepos(repos []CapCenterConfig) error

Types

type CapCenterConfig

type CapCenterConfig struct {
	Name    string `json:"name"`
	Address string `json:"address"`
	Token   string `json:"token"`
}

CapCenterConfig is used to store cap center config in file

func LoadRepos

func LoadRepos() ([]CapCenterConfig, error)

TODO(wonderflow): we can make default(built-in) repo configurable, then we should make default inside the answer

type CenterClient

type CenterClient interface {
	SyncCapabilityFromCenter() error
}

func NewCenterClient

func NewCenterClient(ctx context.Context, name, address, token string) (CenterClient, error)

type GithubCenter

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

func NewGithubCenter

func NewGithubCenter(ctx context.Context, token, centerName string, r *GithubContent) (*GithubCenter, error)

func (*GithubCenter) SyncCapabilityFromCenter

func (g *GithubCenter) SyncCapabilityFromCenter() error

TODO(wonderflow): currently we only sync by create, we also need to delete which not exist remotely.

type GithubContent

type GithubContent struct {
	Owner string `json:"owner"`
	Repo  string `json:"repo"`
	Path  string `json:"path"`
	Ref   string `json:"ref"`
}

func Parse

func Parse(addr string) (string, *GithubContent, error)

type RemoteCapabilities

type RemoteCapabilities []RemoteCapability

type RemoteCapability

type RemoteCapability struct {
	// Name MUST be xxx.yaml
	Name string `json:"name"`
	URL  string `json:"download_url"`
	Sha  string `json:"sha"`
	// Type MUST be file
	Type string `json:"type"`
}

Jump to

Keyboard shortcuts

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