common

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 43 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Scheme defines the default KubeVela schema
	Scheme = k8sruntime.NewScheme()
)

Functions

func AskToChooseOneEnvResource added in v1.1.9

func AskToChooseOneEnvResource(app *v1beta1.Application) (*common.ClusterObjectReference, error)

AskToChooseOneEnvResource will ask users to select one applied resource of the application if more than one resources is a map for component to applied resources return the selected ClusterObjectReference

func AskToChooseOnePods added in v1.1.9

func AskToChooseOnePods(podNames []string) (string, error)

AskToChooseOnePods will ask users to select one pods of the resource if more than one

func AskToChooseOneService added in v1.0.0

func AskToChooseOneService(svcNames []string) (string, error)

AskToChooseOneService will ask users to select one service of the application if more than one

func ClusterObject2Map added in v1.1.8

func ClusterObject2Map(refs []common.ClusterObjectReference) map[string]string

ClusterObject2Map convert ClusterObjectReference to a readable map

func GenOpenAPI added in v0.3.0

func GenOpenAPI(inst *cue.Instance) ([]byte, error)

GenOpenAPI generates OpenAPI json schema from cue.Instance

func GenerateUnstructuredObj added in v1.1.0

func GenerateUnstructuredObj(name, ns string, gvk schema.GroupVersionKind) *unstructured.Unstructured

GenerateUnstructuredObj generate UnstructuredObj

func GetCUEParameterValue added in v0.3.0

func GetCUEParameterValue(cueStr string) (cue.Value, error)

GetCUEParameterValue converts definitions to cue format

func GetClient added in v1.1.4

func GetClient() (client.Client, error)

GetClient will K8s client in args

func HTTPGet added in v0.2.0

func HTTPGet(ctx context.Context, url string) ([]byte, error)

HTTPGet will send GET http request with context

func NewK8sClient added in v1.1.0

func NewK8sClient() (client.Client, error)

NewK8sClient init a local k8s client which add oamcore scheme

func ParseTerraformVariables added in v1.0.6

func ParseTerraformVariables(configuration string) (map[string]*tfconfig.Variable, error)

ParseTerraformVariables get variables from Terraform Configuration

func ReadYamlToObject added in v1.0.0

func ReadYamlToObject(path string, object k8sruntime.Object) error

ReadYamlToObject will read a yaml K8s object to runtime.Object

func RealtimePrintCommandOutput added in v0.3.1

func RealtimePrintCommandOutput(cmd *exec.Cmd, logFile string) error

RealtimePrintCommandOutput prints command output in real time If logFile is "", it will prints the stdout, or it will write to local file

func RefineParameterInstance added in v1.1.0

func RefineParameterInstance(inst *cue.Instance) (*cue.Instance, error)

RefineParameterInstance refines cue instance to merely include `parameter` identifier

func SetGlobalClient added in v1.1.4

func SetGlobalClient(clt client.Client) error

SetGlobalClient will set a client for one cli command

func SetSpecObjIntoUnstructuredObj added in v1.1.0

func SetSpecObjIntoUnstructuredObj(spec interface{}, u *unstructured.Unstructured) error

SetSpecObjIntoUnstructuredObj set UnstructuredObj spec field

Types

type Args added in v1.0.0

type Args struct {
	Config *rest.Config
	Schema *runtime.Scheme
	Client client.Client
	// contains filtered or unexported fields
}

Args is args for controller-runtime client

func InitBaseRestConfig

func InitBaseRestConfig() (Args, error)

InitBaseRestConfig will return reset config for create controller runtime client

func (*Args) GetClient added in v1.0.0

func (a *Args) GetClient() (client.Client, error)

GetClient get client if exist

func (*Args) GetDiscoveryMapper added in v1.0.0

func (a *Args) GetDiscoveryMapper() (discoverymapper.DiscoveryMapper, error)

GetDiscoveryMapper get discoveryMapper client if exist, create if not exist.

func (*Args) GetPackageDiscover added in v1.0.0

func (a *Args) GetPackageDiscover() (*packages.PackageDiscover, error)

GetPackageDiscover get PackageDiscover client if exist, create if not exist.

func (*Args) SetConfig added in v1.0.0

func (a *Args) SetConfig() error

SetConfig insert kubeconfig into Args

type ResourceLocation added in v1.1.9

type ResourceLocation struct {
	Cluster   string
	Namespace string
}

ResourceLocation indicates the resource location

Jump to

Keyboard shortcuts

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