Documentation ¶
Index ¶
- Constants
- func GetContainerPortsFromStrings(ports []string) ([]corev1.ContainerPort, error)
- func InArray(arr []string, value string) bool
- func Merge(original []v1.EnvVar, other []v1.EnvVar) []v1.EnvVar
- func RemoveEnvVarsFromList(envVarList []v1.EnvVar, keys []string) ([]v1.EnvVar, error)
- type DevfileObj
- func (d DevfileObj) AddEnvVars(otherList []v1.EnvVar) error
- func (d DevfileObj) GetMemory() string
- func (d DevfileObj) GetMetadataName() string
- func (d DevfileObj) HasPorts() bool
- func (d DevfileObj) RemoveEnvVars(keys []string) (err error)
- func (d DevfileObj) RemovePorts() error
- func (d DevfileObj) SetMemory(memory string) error
- func (d DevfileObj) SetMetadataName(name string) error
- func (d DevfileObj) SetPorts(ports ...string) error
- func (d *DevfileObj) WriteJsonDevfile() error
- func (d *DevfileObj) WriteYamlDevfile() error
- type ParserArgs
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 ( OutputDevfileJsonPath = "devfile.json" OutputDevfileYamlPath = "devfile.yaml" )
Default filenames for create devfile
Variables ¶
This section is empty.
Functions ¶
func GetContainerPortsFromStrings ¶
func GetContainerPortsFromStrings(ports []string) ([]corev1.ContainerPort, error)
GetContainerPortsFromStrings generates ContainerPort values from the array of string port values ports is the array containing the string port values
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(otherList []v1.EnvVar) error
AddEnvVars adds environment variables to all the components in a devfile
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(keys []string) (err error)
RemoveEnvVars removes the environment variables which have the keys from all the components in a devfile
func (DevfileObj) RemovePorts ¶
func (d DevfileObj) RemovePorts() error
RemovePorts removes all container endpoints from a devfile
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(ports ...string) error
SetPorts converts ports to endpoints, adds to a devfile
func (*DevfileObj) WriteJsonDevfile ¶
func (d *DevfileObj) WriteJsonDevfile() error
WriteJsonDevfile creates a devfile.json file
func (*DevfileObj) WriteYamlDevfile ¶
func (d *DevfileObj) WriteYamlDevfile() error
WriteYamlDevfile creates a devfile.yaml file
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 // 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 }
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.