Documentation ¶
Index ¶
- Constants
- func GetCommonLabels(contextLabels map[string]string) map[string]string
- func IsCUEParseErr(err error) bool
- type AbstractEngine
- type CUEParseError
- type PackageDiscover
- func (pd *PackageDiscover) Exist(gvk metav1.GroupVersionKind) bool
- func (pd *PackageDiscover) ImportBuiltinPackagesFor(bi *build.Instance)
- func (pd *PackageDiscover) ImportPackagesAndBuildInstance(bi *build.Instance) (inst *cue.Instance, err error)
- func (pd *PackageDiscover) ListPackageKinds() map[string][]VersionKind
- func (pd *PackageDiscover) RefreshKubePackagesFromCluster() error
- type ParseErrType
- type VersionKind
Constants ¶
const ( // BuiltinPackageDomain Specify the domain of the built-in package BuiltinPackageDomain = "kube" // K8sResourcePrefix Indicates that the definition comes from kubernetes K8sResourcePrefix = "io_k8s_api_" // ParseJSONSchemaErr describes the error that occurs when cue parses json ParseJSONSchemaErr ParseErrType = "parse json schema of k8s crds error" )
const ( // OutputFieldName is the name of the struct contains the CR data OutputFieldName = process.OutputFieldName // OutputsFieldName is the name of the struct contains the map[string]CR data OutputsFieldName = process.OutputsFieldName // PatchFieldName is the name of the struct contains the patch of CR data PatchFieldName = "patch" // CustomMessage defines the custom message in definition template CustomMessage = "message" // HealthCheckPolicy defines the health check policy in definition template HealthCheckPolicy = "isHealth" )
const ( // AuxiliaryWorkload defines the extra workload obj from a workloadDefinition, // e.g. a workload composed by deployment and service, the service will be marked as AuxiliaryWorkload AuxiliaryWorkload = "AuxiliaryWorkload" )
Variables ¶
This section is empty.
Functions ¶
func GetCommonLabels ¶ added in v1.0.0
GetCommonLabels will convert context based labels to OAM standard labels
func IsCUEParseErr ¶ added in v1.0.4
IsCUEParseErr returns true if the specified error is CUEParseError type.
Types ¶
type AbstractEngine ¶ added in v0.3.3
type AbstractEngine interface { Complete(ctx process.Context, abstractTemplate string, params interface{}) error HealthCheck(ctx process.Context, cli client.Client, ns string, healthPolicyTemplate string) (bool, error) Status(ctx process.Context, cli client.Client, ns string, customStatusTemplate string) (string, error) }
AbstractEngine defines Definition's Render interface
func NewTraitAbstractEngine ¶ added in v0.3.3
func NewTraitAbstractEngine(name string, pd *PackageDiscover) AbstractEngine
NewTraitAbstractEngine create Trait Definition AbstractEngine
func NewWorkloadAbstractEngine ¶ added in v0.3.3
func NewWorkloadAbstractEngine(name string, pd *PackageDiscover) AbstractEngine
NewWorkloadAbstractEngine create Workload Definition AbstractEngine
type CUEParseError ¶ added in v1.0.4
type CUEParseError struct {
// contains filtered or unexported fields
}
CUEParseError describes an error when CUE parse error
func (CUEParseError) Error ¶ added in v1.0.4
func (cueErr CUEParseError) Error() string
Error implements the Error interface.
type PackageDiscover ¶ added in v1.0.0
type PackageDiscover struct {
// contains filtered or unexported fields
}
PackageDiscover defines the inner CUE packages loaded from K8s cluster
func NewPackageDiscover ¶ added in v1.0.0
func NewPackageDiscover(config *rest.Config) (*PackageDiscover, error)
NewPackageDiscover will create a PackageDiscover client with the K8s config file.
func (*PackageDiscover) Exist ¶ added in v1.0.0
func (pd *PackageDiscover) Exist(gvk metav1.GroupVersionKind) bool
Exist checks if the GVK exists in the built-in packages
func (*PackageDiscover) ImportBuiltinPackagesFor ¶ added in v1.0.0
func (pd *PackageDiscover) ImportBuiltinPackagesFor(bi *build.Instance)
ImportBuiltinPackagesFor will add KubeVela built-in packages into your CUE instance
func (*PackageDiscover) ImportPackagesAndBuildInstance ¶ added in v1.0.3
func (pd *PackageDiscover) ImportPackagesAndBuildInstance(bi *build.Instance) (inst *cue.Instance, err error)
ImportPackagesAndBuildInstance Combine import built-in packages and build cue template together to avoid data race
func (*PackageDiscover) ListPackageKinds ¶ added in v1.0.0
func (pd *PackageDiscover) ListPackageKinds() map[string][]VersionKind
ListPackageKinds list packages and their kinds
func (*PackageDiscover) RefreshKubePackagesFromCluster ¶ added in v1.0.0
func (pd *PackageDiscover) RefreshKubePackagesFromCluster() error
RefreshKubePackagesFromCluster will use K8s client to load/refresh all K8s open API as a reference kube package using in template
type ParseErrType ¶ added in v1.0.4
type ParseErrType string
ParseErrType represents the type of CUEParseError
type VersionKind ¶ added in v1.0.0
VersionKind contains the resource metadata and reference name