Documentation
¶
Index ¶
- Constants
- func GetCapabilitiesFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, ...) ([]types.Capability, error)
- func GetDescription(annotation map[string]string) string
- func GetInstalledCapabilityWithCapName(capT types.CapType, capName string) (types.Capability, error)
- func GetSubDir(dir string, capT types.CapType) string
- func GetTraitsFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, ...) ([]types.Capability, []error, error)
- func GetWorkloadsFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, ...) ([]types.Capability, []error, error)
- func HandleDefinition(name, syncDir, crdName string, annotation map[string]string, ...) (types.Capability, error)
- func HandleTemplate(in *runtime.RawExtension, name, syncDir string) (types.Capability, error)
- func LoadAllInstalledCapability() ([]types.Capability, error)
- func LoadCapabilityByName(name string) (types.Capability, error)
- func LoadCapabilityFromSyncedCenter(dir string) ([]types.Capability, error)
- func LoadInstalledCapabilityWithType(capT types.CapType) ([]types.Capability, error)
- func ParseAndSyncCapability(data []byte, syncDir string) (types.Capability, error)
- func RemoveLegacyTemps(retainedTemps []types.Capability, dir string) int
- func SinkTemp2Local(templates []types.Capability, dir string) int
- func StoreRepos(repos []CapCenterConfig) error
- type CapCenterConfig
- type CenterClient
- type GithubCenter
- type GithubContent
- type RemoteCapabilities
- type RemoteCapability
Constants ¶
const DescriptionUndefined = "description not defined"
nolint
const TypeGithub = "github"
TypeGithub represents github
const TypeUnknown = "unknown"
TypeUnknown represents parse failed
Variables ¶
This section is empty.
Functions ¶
func GetCapabilitiesFromCluster ¶
func GetCapabilitiesFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, selector labels.Selector) ([]types.Capability, error)
GetCapabilitiesFromCluster will get capability from K8s cluster
func GetDescription ¶ added in v0.0.8
GetDescription get description from annotation
func GetInstalledCapabilityWithCapName ¶ added in v0.2.0
func GetInstalledCapabilityWithCapName(capT types.CapType, capName string) (types.Capability, error)
GetInstalledCapabilityWithCapName will get cap by alias
func GetTraitsFromCluster ¶
func GetTraitsFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, selector labels.Selector) ([]types.Capability, []error, error)
GetTraitsFromCluster will get capability from K8s cluster
func GetWorkloadsFromCluster ¶
func GetWorkloadsFromCluster(ctx context.Context, namespace string, c types.Args, syncDir string, selector labels.Selector) ([]types.Capability, []error, error)
GetWorkloadsFromCluster will get capability from K8s cluster
func HandleDefinition ¶
func HandleDefinition(name, syncDir, crdName string, annotation map[string]string, extension *runtime.RawExtension, tp types.CapType, applyTo []string) (types.Capability, error)
HandleDefinition will handle definition to capability
func HandleTemplate ¶
func HandleTemplate(in *runtime.RawExtension, name, syncDir string) (types.Capability, error)
HandleTemplate will handle definition template to capability
func LoadAllInstalledCapability ¶
func LoadAllInstalledCapability() ([]types.Capability, error)
LoadAllInstalledCapability will list all capability
func LoadCapabilityByName ¶
func LoadCapabilityByName(name string) (types.Capability, error)
LoadCapabilityByName will load capability from local by name
func LoadCapabilityFromSyncedCenter ¶
func LoadCapabilityFromSyncedCenter(dir string) ([]types.Capability, error)
LoadCapabilityFromSyncedCenter will load capability from dir
func LoadInstalledCapabilityWithType ¶
func LoadInstalledCapabilityWithType(capT types.CapType) ([]types.Capability, error)
LoadInstalledCapabilityWithType will load cap list by type
func ParseAndSyncCapability ¶
func ParseAndSyncCapability(data []byte, syncDir string) (types.Capability, error)
ParseAndSyncCapability will convert config from remote center to capability
func RemoveLegacyTemps ¶ added in v0.0.7
func RemoveLegacyTemps(retainedTemps []types.Capability, dir string) int
RemoveLegacyTemps will remove capability definitions under `dir` but not included in `retainedTemps`.
func SinkTemp2Local ¶
func SinkTemp2Local(templates []types.Capability, dir string) int
SinkTemp2Local will sink template to local file
func StoreRepos ¶
func StoreRepos(repos []CapCenterConfig) error
StoreRepos will store cap center repo locally
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)
LoadRepos will load all cap center repos 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
}
CenterClient defines an interface for cap center client
func NewCenterClient ¶
func NewCenterClient(ctx context.Context, name, address, token string) (CenterClient, error)
NewCenterClient create a client from type
type GithubCenter ¶
type GithubCenter struct {
// contains filtered or unexported fields
}
GithubCenter implementation of cap center
func NewGithubCenter ¶
func NewGithubCenter(ctx context.Context, token, centerName string, r *GithubContent) (*GithubCenter, error)
NewGithubCenter will create client by github center implementation
func (*GithubCenter) SyncCapabilityFromCenter ¶
func (g *GithubCenter) SyncCapabilityFromCenter() error
SyncCapabilityFromCenter will sync capability from github cap center 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"` }
GithubContent for cap center
type RemoteCapabilities ¶
type RemoteCapabilities []RemoteCapability
RemoteCapabilities is slice of cap center