util

package
v0.0.0-...-246153e Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(ns string, annotations map[string]string, labels map[string]string) map[string]interface{}

CreateNamespace generates a map with namespace definitions

func DecodeYamls

func DecodeYamls(yamlString string) ([]map[string]interface{}, error)

DecodeYamls parse a list of yamls defined on a string to a list of maps

func NestedMapLookup

func NestedMapLookup(m map[string]interface{}, ks ...string) (rval interface{}, err error)

NestedMapLookup as found on https://gist.github.com/ChristopherThorpe/fd3720efe2ba83c929bf4105719ee967 m: a map from strings to other maps or values, of arbitrary depth ks: successive keys to reach an internal or leaf node (variadic) If an internal node is reached, will return the internal map

Returns: (Exactly one of these will be nil) rval: the target node (if found) err: an error created by fmt.Errorf

func ValidateValues

func ValidateValues(values map[string]interface{}, requiredFields ...string) (map[string]interface{}, error)

ValidateValues validates if some required keys exists on a map

func WalkDedup

func WalkDedup(list []map[string]interface{}, f func(element map[string]interface{}))

WalkDedup iterates over a list of maps and uses hashing to deduplicate elements

Types

type Metadata

type Metadata struct {
	Annotations map[string]string
	Name        string `yaml:"name"`
	Labels      map[string]string
}

Metadata represents namespaces metadata information

type Namespace

type Namespace struct {
	APIVersion string   `yaml:"apiVersion"`
	Kind       string   `yaml:"kind"`
	Metadata   Metadata `yaml:"metadata"`
}

Namespace represents a Kubernetes namespace resource

Jump to

Keyboard shortcuts

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