Documentation ¶
Index ¶
- Constants
- func ReadKubernetesYaml(src YamlSrc, fs afero.Afero) ([]interface{}, error)
- type DevfileObj
- func (d DevfileObj) AddEnvVars(containerEnvMap map[string][]v1.EnvVar) error
- func (d DevfileObj) GetMemory() string
- func (d DevfileObj) GetMetadataName() string
- func (d DevfileObj) HasPorts() bool
- func (d DevfileObj) RemoveEnvVars(containerEnvMap map[string][]string) (err error)
- func (d DevfileObj) RemovePorts(containerPortsMap map[string][]string) error
- func (d DevfileObj) SetMemory(memory string) error
- func (d DevfileObj) SetMetadataName(name string) error
- func (d DevfileObj) SetPorts(containerPortsMap map[string][]string) error
- func (d *DevfileObj) WriteYamlDevfile() error
- type KubernetesResources
- type ParserArgs
- type YamlSrc
Constants ¶
const ( Name = "Name" Ports = "Ports" Memory = "Memory" PortsDescription = "Ports to be opened in all component containers" MemoryDescription = "The Maximum memory all the component containers can consume" NameDescription = "The name of the component" )
const ( OutputDevfileYamlPath = "devfile.yaml" K8sLikeComponentOriginalURIKey = "api.devfile.io/k8sLikeComponent-originalURI" )
Default filenames for create devfile
Variables ¶
This section is empty.
Functions ¶
func ReadKubernetesYaml ¶ added in v1.3.0
ReadKubernetesYaml reads a yaml Kubernetes file from either the Path, URL or Data provided. It returns all the parsed Kubernetes objects as an array of interface. Consumers interested in the Kubernetes resources are expected to Unmarshal it to the struct of the respective Kubernetes resource.
Types ¶
type DevfileObj ¶
type DevfileObj struct { // Ctx has devfile context info Ctx devfileCtx.DevfileCtx // Data has the devfile data Data data.DevfileData }
DevfileObj is the runtime devfile object
func Parse ¶
func Parse(path string) (d DevfileObj, err error)
Parse func populates the flattened devfile data, parses and validates the devfile integrity. Creates devfile context and runtime objects Deprecated, use ParseDevfile() instead
func ParseDevfile ¶
func ParseDevfile(args ParserArgs) (d DevfileObj, err error)
ParseDevfile func populates the devfile data, parses and validates the devfile integrity. Creates devfile context and runtime objects
func ParseFromData ¶
func ParseFromData(data []byte) (d DevfileObj, err error)
ParseFromData func parses and validates the devfile integrity. Creates devfile context and runtime objects Deprecated, use ParseDevfile() instead
func ParseFromURL ¶
func ParseFromURL(url string) (d DevfileObj, err error)
ParseFromURL func parses and validates the devfile integrity. Creates devfile context and runtime objects Deprecated, use ParseDevfile() instead
func ParseRawDevfile ¶
func ParseRawDevfile(path string) (d DevfileObj, err error)
ParseRawDevfile populates the raw devfile data without overriding and merging Deprecated, use ParseDevfile() instead
func (DevfileObj) AddEnvVars ¶
func (d DevfileObj) AddEnvVars(containerEnvMap map[string][]v1.EnvVar) error
AddEnvVars accepts a map of container name mapped to an array of the env vars to be set; it adds the envirnoment variables to a given container name, and writes to the devfile Example of containerEnvMap : {"runtime": {{Name: "Foo", Value: "Bar"}}}
func (DevfileObj) GetMemory ¶
func (d DevfileObj) GetMemory() string
GetMemory gets memoryLimit from devfile container
func (DevfileObj) GetMetadataName ¶
func (d DevfileObj) GetMetadataName() string
GetMetadataName gets metadata name from a devfile
func (DevfileObj) HasPorts ¶
func (d DevfileObj) HasPorts() bool
HasPorts checks if a devfile contains container endpoints
func (DevfileObj) RemoveEnvVars ¶
func (d DevfileObj) RemoveEnvVars(containerEnvMap map[string][]string) (err error)
RemoveEnvVars accepts a map of container name mapped to an array of environment variables to be removed; it removes the env vars from the specified container name and writes it to the devfile
func (DevfileObj) RemovePorts ¶
func (d DevfileObj) RemovePorts(containerPortsMap map[string][]string) error
RemovePorts accepts a map of container name mapped to an array of port numbers to be removed; it removes the container endpoints with the specified port numbers of the specified container, and writes to the devfile Example of containerPortsMap: {"runtime": {"8080", "9000"}, "wildfly": {"12956"}}
func (DevfileObj) SetMemory ¶
func (d DevfileObj) SetMemory(memory string) error
SetMemory sets memoryLimit in devfile container
func (DevfileObj) SetMetadataName ¶
func (d DevfileObj) SetMetadataName(name string) error
SetMetadataName set metadata name in a devfile
func (DevfileObj) SetPorts ¶
func (d DevfileObj) SetPorts(containerPortsMap map[string][]string) error
SetPorts accepts a map of container name mapped to an array of port numbers to be set; it converts ports to endpoints, sets the endpoint to a given container name, and writes to the devfile Example of containerPortsMap: {"runtime": {"8080", "9000"}, "wildfly": {"12956"}}
func (*DevfileObj) WriteYamlDevfile ¶
func (d *DevfileObj) WriteYamlDevfile() error
WriteYamlDevfile creates a devfile.yaml file
type KubernetesResources ¶ added in v1.3.0
type KubernetesResources struct { Deployments []appsv1.Deployment Services []corev1.Service Routes []routev1.Route Ingresses []extensionsv1.Ingress }
KubernetesResources struct contains the Deployments, Services, Routes and Ingresses resources
func ParseKubernetesYaml ¶ added in v1.3.0
func ParseKubernetesYaml(values []interface{}) (KubernetesResources, error)
ParseKubernetesYaml Unmarshals the interface array of the Kubernetes resources and returns it as a KubernetesResources struct. Only Deployment, Service, Route and Ingress are processed. Consumers interested in other Kubernetes resources are expected to parse the values interface array an Unmarshal it to their desired Kuberenetes struct
type ParserArgs ¶
type ParserArgs struct { // Path is a relative or absolute devfile path. Path string // URL is the URL address of the specific devfile. URL string // Data is the devfile content in []byte format. Data []byte // FlattenedDevfile defines if the returned devfileObj is flattened content (true) or raw content (false). // The value is default to be true. FlattenedDevfile *bool // ConvertKubernetesContentInUri defines if the kubernetes resources definition from uri will be converted to inlined in devObj(true) or not (false). // The value is default to be true. ConvertKubernetesContentInUri *bool // RegistryURLs is a list of registry hosts which parser should pull parent devfile from. // If registryUrl is defined in devfile, this list will be ignored. RegistryURLs []string // DefaultNamespace is the default namespace to use // If namespace is defined under devfile's parent kubernetes object, this namespace will be ignored. DefaultNamespace string // Context is the context used for making Kubernetes requests Context context.Context // K8sClient is the Kubernetes client instance used for interacting with a cluster K8sClient client.Client // ExternalVariables override variables defined in the Devfile ExternalVariables map[string]string // HTTPTimeout overrides the request and response timeout values for reading a parent devfile reference from the registry. If a negative value is specified, the default timeout will be used. HTTPTimeout *int }
ParserArgs is the struct to pass into parser functions which contains required info for parsing devfile. It accepts devfile path, devfile URL or devfile content in []byte format.