library

command module
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

Devfile Parser Library

About

The Devfile Parser library is a Golang module that:

  1. parses the devfile.yaml as specified by the api & schema.
  2. writes to the devfile.yaml with the updated data.
  3. generates Kubernetes objects for the various devfile resources.
  4. defines util functions for the devfile.

The function documentation can be accessed via pkg.go.dev.

  1. To parse a devfile, visit pkg/devfile/parse.go
    // Parses the devfile and validates the devfile data
    devfile, err := devfilePkg.ParseAndValidate(devfileLocation)
    
    // To get all the components from the devfile
    components, err := devfile.Data.GetComponents(DevfileOptions{})
    
  2. To get the Kubernetes objects from the devfile, visit pkg/devfile/generator/generators.go
     // To get a slice of Kubernetes containers of type corev1.Container from the devfile component containers
     containers, err := generator.GetContainers(devfile)
    
     // To generate a Kubernetes deployment of type v1.Deployment
     deployParams := generator.DeploymentParams{
     	TypeMeta:          generator.GetTypeMeta(deploymentKind, deploymentAPIVersion),
     	ObjectMeta:        generator.GetObjectMeta(name, namespace, labels, annotations),
     	InitContainers:    initContainers,
     	Containers:        containers,
     	Volumes:           volumes,
     	PodSelectorLabels: labels,
     }
     deployment := generator.GetDeployment(deployParams)
    

Usage

In the future, the following projects will be consuming this library as a Golang dependency

Issues

Issues are tracked in the devfile/api repo with the label area/library

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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