kube

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigMap = plugins.ReduceHandler{
	Names: []string{"configmap", "config", "ConfigMap"}, Handler: configMapParse,
	Demo: `
configmap data-config [label1=value1 ...] {
    datakey datavalue;
    nginx.conf '
    http {
        server {

        }
    }
    ';
    password haiker:abd123123123;
}

configmap data-config-2 {
	labels {
		label1 value1;
	}
	data-key-1 value-1;
	data-key-2 value-2;
}
`,
}
View Source
var Namespace = plugins.ReduceHandler{
	Names: []string{"namespace", "Namespace"},
	Handler: func(version, prefix string, directive *config.Directive) metav1.Object {
		asserts.ArgsMin(directive, 1)
		namespace := &v1.Namespace{
			TypeMeta: metav1.TypeMeta{
				Kind:       "Namespace",
				APIVersion: v1.SchemeGroupVersion.String(),
			},
		}
		asserts.Metadata(namespace.GetObjectMeta(), directive)

		labels := namespace.GetLabels()
		for _, d := range directive.Body {
			labels[d.Name] = d.Args[0]
		}
		namespace.SetLabels(labels)
		return namespace
	},
	Demo: `
namespace name;
namespace name [label1=value1 label2=label3 ...] {
	label-sub-1 value-sub-1;
	label-sub-2 value-sub-2;
	...
}
`,
}
View Source
var Node = plugins.ReduceHandler{
	Names: []string{"node", "Node"}, Handler: func(version, prefix string, directive *config.Directive) metav1.Object {
		node := &node{
			TypeMeta: metav1.TypeMeta{
				Kind:       "Node",
				APIVersion: v1.SchemeGroupVersion.String(),
			},
		}
		asserts.Metadata(node, directive)
		for _, d := range directive.Body {
			node.Labels[d.Name] = d.Args[0]
		}
		return node
	},
	Demo: `
node nodeName [label1=value1 ...]{
	lable-l1 value-v1;
	lable-l2 value-v2;
}
`,
}
View Source
var Secret = plugins.ReduceHandler{
	Names: []string{"secret", "Secret"}, Handler: secretParse,
	Demo: `
secret data-config-1 [secretType] {
    datakey ZGF0YXZhbHVlCg==;
    password aGFpa2VyOmFiZDEyMzEyMzEyMwo=;
}
secret data-config-2 {
	labels {
		label1 value1;
	}
	label label2 value2;

	data-key-1 dmFsdWUtMQo=;
	data-key-2 dmFsdWUtMgo=;
}
`,
}
View Source
var Yaml = plugins.ReduceHandler{Names: []string{"yaml"}, Demo: `
yaml '
---
apiVersion: v1
kind: Pod
....
';
`, Handler: yamlParse}

Functions

This section is empty.

Types

type Kubernetes

type Kubernetes struct {
	Kubernetes string
	Prefix     string
	Objects    []metav1.Object
}

func ParseWith

func ParseWith(bs []byte) *Kubernetes

func Reduce added in v0.5.0

func Reduce(filename string) *Kubernetes

func (*Kubernetes) Add

func (k *Kubernetes) Add(object metav1.Object)

func (*Kubernetes) Bytes

func (k *Kubernetes) Bytes() []byte

func (*Kubernetes) Namespace

func (k *Kubernetes) Namespace() string

func (*Kubernetes) String

func (k *Kubernetes) String() string

Directories

Path Synopsis
pod

Jump to

Keyboard shortcuts

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