common

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 62 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// AddonObservabilityApplication is the application name for Addon Observability
	AddonObservabilityApplication = "addon-observability"
	// AddonObservabilityGrafanaSvc is grafana service name for Addon Observability
	AddonObservabilityGrafanaSvc = "grafana"
)
View Source
const CreateCustomNamespace = "create new namespace"

CreateCustomNamespace display the create namespace message

Variables

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

Functions

func AskToChooseOneNamespace added in v1.2.0

func AskToChooseOneNamespace(c client.Client, envMeta *types.EnvMeta) error

AskToChooseOneNamespace ask for choose one namespace as env

func FilterObjectsByCondition added in v1.5.0

func FilterObjectsByCondition(objs []*unstructured.Unstructured, filter func(unstructured2 *unstructured.Unstructured) bool) (outs []*unstructured.Unstructured)

FilterObjectsByCondition filter object slices by condition function

func GenOpenAPI added in v0.3.0

func GenOpenAPI(val *value.Value) (b []byte, err 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, pd *packages.PackageDiscover) (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 HTTPGetKubernetesObjects added in v1.5.0

func HTTPGetKubernetesObjects(ctx context.Context, url string) ([]*unstructured.Unstructured, error)

HTTPGetKubernetesObjects use HTTP requests to load resources from remote url

func HTTPGetResponse added in v1.5.0

func HTTPGetResponse(ctx context.Context, url string, opts *HTTPOption) (*http.Response, error)

HTTPGetResponse use HTTP option and default client to send request and get raw response

func HTTPGetWithOption added in v1.3.1

func HTTPGetWithOption(ctx context.Context, url string, opts *HTTPOption) ([]byte, error)

HTTPGetWithOption use HTTP option and default client to send get request

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, map[string]*tfconfig.Output, 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 RefineParameterValue added in v1.6.0

func RefineParameterValue(val *value.Value) (cue.Value, error)

RefineParameterValue refines cue value 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 {
	Schema *runtime.Scheme
	// 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) GetConfig added in v1.2.0

func (a *Args) GetConfig() (*rest.Config, error)

GetConfig get config, if not exist, will create

func (*Args) GetDiscoveryClient added in v1.2.4

func (a *Args) GetDiscoveryClient() (*discovery.DiscoveryClient, error)

GetDiscoveryClient return a discovery client from cli args

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) GetFakeClient added in v1.4.0

func (a *Args) GetFakeClient(defs []oam.Object) (client.Client, error)

GetFakeClient returns a fake client with the definition objects preloaded

func (*Args) GetNamespaceFromConfig added in v1.7.0

func (a *Args) GetNamespaceFromConfig() string

GetNamespaceFromConfig will get namespace from kube config

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) GetRawConfig added in v1.7.0

func (a *Args) GetRawConfig() (*api.Config, error)

GetRawConfig get raw kubeconfig, if not exist, will create

func (*Args) SetClient added in v1.2.0

func (a *Args) SetClient(c client.Client)

SetClient set custom client

func (*Args) SetConfig added in v1.0.0

func (a *Args) SetConfig(c *rest.Config) error

SetConfig insert kubeconfig into Args

type HTTPOption added in v1.3.1

type HTTPOption struct {
	Username        string `json:"username,omitempty"`
	Password        string `json:"password,omitempty"`
	CaFile          string `json:"caFile,omitempty"`
	CertFile        string `json:"certFile,omitempty"`
	KeyFile         string `json:"keyFile,omitempty"`
	InsecureSkipTLS bool   `json:"insecureSkipTLS,omitempty"`
}

HTTPOption define the https options

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