types

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// DefaultKubeVelaNS defines the default KubeVela namespace in Kubernetes
	DefaultKubeVelaNS = "vela-system"
	// DefaultKubeVelaReleaseName defines the default name of KubeVela Release
	DefaultKubeVelaReleaseName = "kubevela"
	// DefaultKubeVelaChartName defines the default chart name of KubeVela, this variable MUST align to the chart name of this repo
	DefaultKubeVelaChartName = "vela-core"
	// DefaultKubeVelaVersion defines the default version needed for KubeVela chart
	DefaultKubeVelaVersion = ">0.0.0-0"
	// DefaultEnvName defines the default environment name for Apps created by KubeVela
	DefaultEnvName = "default"
	// DefaultAppNamespace defines the default K8s namespace for Apps created by KubeVela
	DefaultAppNamespace = "default"
)
View Source
const (
	// StatusDeployed represents the App was deployed
	StatusDeployed = "Deployed"
	// StatusStaging represents the App was changed locally and it's spec is diff from the deployed one, or not deployed at all
	StatusStaging = "Staging"
)
View Source
const (
	// TagCommandType used for tag cli category
	TagCommandType = "commandType"
	// TypeStart defines one category
	TypeStart = "Getting Started"
	// TypeApp defines one category
	TypeApp = "Managing Applications"
	// TypeCap defines one category
	TypeCap = "Managing Capabilities"
	// TypeSystem defines one category
	TypeSystem = "System"
)
View Source
const (
	// AnnDescription is the annotation which describe what is the capability used for in a WorkloadDefinition/TraitDefinition Object
	AnnDescription = "definition.oam.dev/description"
)

Variables

View Source
var CapabilityCmpOptions = []cmp.Option{
	cmp.Comparer(func(a, b Parameter) bool {
		if a.Name != b.Name || a.Short != b.Short || a.Required != b.Required ||
			a.Usage != b.Usage || a.Type != b.Type {
			return false
		}

		switch a.Type {
		case cue.IntKind:
			var va, vb int64
			switch vala := a.Default.(type) {
			case int64:
				va = vala
			case json.Number:
				va, _ = vala.Int64()
			case int:
				va = int64(vala)
			case float64:
				va = int64(vala)
			}
			switch valb := b.Default.(type) {
			case int64:
				vb = valb
			case json.Number:
				vb, _ = valb.Int64()
			case int:
				vb = int64(valb)
			case float64:
				vb = int64(valb)
			}
			return va == vb
		case cue.StringKind:
			return a.Default.(string) == b.Default.(string)
		case cue.BoolKind:
			return a.Default.(bool) == b.Default.(bool)
		case cue.NumberKind, cue.FloatKind:
			var va, vb float64
			switch vala := a.Default.(type) {
			case int64:
				va = float64(vala)
			case json.Number:
				va, _ = vala.Float64()
			case int:
				va = float64(vala)
			case float64:
				va = vala
			}
			switch valb := b.Default.(type) {
			case int64:
				vb = float64(valb)
			case json.Number:
				vb, _ = valb.Float64()
			case int:
				vb = float64(valb)
			case float64:
				vb = valb
			}
			return va == vb
		default:

		}
		return true
	})}

CapabilityCmpOptions will set compare option

Functions

func EqualCapability

func EqualCapability(a, b Capability) bool

EqualCapability will check whether two capabilities is equal

func SetFlagBy

func SetFlagBy(flags *pflag.FlagSet, v Parameter)

SetFlagBy set cli flag from Parameter

Types

type Args

type Args struct {
	Config *rest.Config
	Schema *runtime.Scheme
}

Args is args for controller-runtime client

func (*Args) SetConfig

func (a *Args) SetConfig() error

SetConfig insert kubeconfig into Args

type CRDInfo

type CRDInfo struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
}

CRDInfo record the CRD info of the Capability

type CapType

type CapType string

CapType defines the type of capability

const (
	// TypeWorkload represents OAM Workload
	TypeWorkload CapType = "workload"
	// TypeTrait represents OAM Trait
	TypeTrait CapType = "trait"
	// TypeScope represent OAM Scope
	TypeScope CapType = "scope"
)

type Capability

type Capability struct {
	Name           string      `json:"name"`
	Type           CapType     `json:"type"`
	CueTemplate    string      `json:"template,omitempty"`
	CueTemplateURI string      `json:"templateURI,omitempty"`
	Parameters     []Parameter `json:"parameters,omitempty"`
	DefinitionPath string      `json:"definition"`
	CrdName        string      `json:"crdName,omitempty"`
	Center         string      `json:"center,omitempty"`
	Status         string      `json:"status,omitempty"`
	Description    string      `json:"description,omitempty"`

	// trait only
	AppliesTo []string `json:"appliesTo,omitempty"`

	// Plugin Source
	Source  *Source       `json:"source,omitempty"`
	Install *Installation `json:"install,omitempty"`
	CrdInfo *CRDInfo      `json:"crdInfo,omitempty"`
}

Capability defines the content of a capability

type CapabilityCategory added in v0.3.1

type CapabilityCategory string

CapabilityCategory defines the category of a capability

const (
	// TerraformCategory means the capability is in Terraform format
	TerraformCategory CapabilityCategory = "terraform"
)

type Chart

type Chart struct {
	Repo      string                 `json:"repo"`
	URL       string                 `json:"url"`
	Name      string                 `json:"name"`
	Namespace string                 `json:"namespace,omitempty"`
	Version   string                 `json:"version"`
	Values    map[string]interface{} `json:"values"`
}

Chart defines all necessary information to install a whole chart

type EnvMeta

type EnvMeta struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Email     string `json:"email,omitempty"`
	Domain    string `json:"domain,omitempty"`

	// Below are not arguments, should be auto-generated
	Issuer  string `json:"issuer"`
	Current string `json:"current,omitempty"`
}

EnvMeta stores the info for app environment

type Installation

type Installation struct {
	Helm Chart `json:"helm"`
}

Installation defines the installation method for this Capability, currently only helm is supported

type Parameter

type Parameter struct {
	Name     string      `json:"name"`
	Short    string      `json:"short,omitempty"`
	Required bool        `json:"required,omitempty"`
	Default  interface{} `json:"default,omitempty"`
	Usage    string      `json:"usage,omitempty"`
	Type     cue.Kind    `json:"type,omitempty"`
	Alias    string      `json:"alias,omitempty"`
}

Parameter defines a parameter for cli from capability template

type Source

type Source struct {
	RepoName  string `json:"repoName"`
	ChartName string `json:"chartName,omitempty"`
}

Source record the source of Capability

Jump to

Keyboard shortcuts

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