yaml2jsonnet

package
v0.0.0-...-87b999f Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: Apache-2.0 Imports: 20 Imported by: 1

README

yaml2jsonnet

Given YAML to create a Kubernetes objects, convert it jsonnet.

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

This could generate

local k = import "k.libsonnet";
local deployment = k.apps.v1beta2.deployment;

local specSelectorTemplateMatchLabels

local deploymentInstance = deployment.new()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is a not found error.
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Conversion

type Conversion struct {
	RootNode ast.Node
	Sources  []io.Reader
	// contains filtered or unexported fields
}

Conversion converts YAML to ksonnet.

func NewConversion

func NewConversion(source, k8sLib string) (*Conversion, error)

NewConversion creates a Conversion.

func (*Conversion) Process

func (c *Conversion) Process() error

Process processes the documents supplied.

type Document

type Document struct {
	Properties component.Properties
	GVK        component.GVK
	// contains filtered or unexported fields
}

Document creates a ksonnet document for describing a resource.

func NewDocument

func NewDocument(componentName string, r io.Reader, root ast.Node) (*Document, error)

NewDocument creates an instance of Document.

func (*Document) GenerateComponent

func (d *Document) GenerateComponent() (string, error)

GenerateComponent generates a component

func (*Document) UpdateParams

func (d *Document) UpdateParams(pu ParamsUpdater) error

UpdateParams updates params.

type ParamsUpdater

type ParamsUpdater func(componentName string, params map[string]interface{}) error

ParamsUpdater is a function for updating params.

Jump to

Keyboard shortcuts

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