crgen

package
v0.0.0-...-c30645c Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NIL = GenValue{Type: "string", Val: "NIL"}
)

Functions

This section is empty.

Types

type CRBase

type CRBase struct {
	ApiVersion string `yaml:"apiVersion"`
	Kind       string `yaml:"kind"`
	Meta       `yaml:"metadata,omitempty"`
	Spec       map[string]GenValue `yaml:"spec,omitempty"`
}

type CRGen

type CRGen struct {
	// ClusterConfigPath is used to get kube client
	ClusterConfigPath string
	// CRDName, CRDNamespace, CRDVersion identify the CRD
	CRDName      string
	CRDNamespace string
	CRDVersion   string
	// CRApiVersion and CRKind are used for generating the CRs
	CRApiVersion string
	CRKind       string
	Generators   map[string]Generator
}

func (*CRGen) Generate

func (c *CRGen) Generate() error

type CartesianGen

type CartesianGen struct {
	Fields map[string]Generator
	// contains filtered or unexported fields
}

func NewCartesianGen

func NewCartesianGen(fields map[string]Generator) (*CartesianGen, error)

func (*CartesianGen) Next

func (g *CartesianGen) Next() GenValue

func (*CartesianGen) Reset

func (g *CartesianGen) Reset()

type GenValue

type GenValue struct {
	Type string
	Val  string
}

func (GenValue) MarshalYAML

func (v GenValue) MarshalYAML() (interface{}, error)

type Generator

type Generator interface {
	Reset()
	Next() GenValue
}

type IPNetGen

type IPNetGen struct {
	// contains filtered or unexported fields
}

func NewIPNetGen

func NewIPNetGen(subnet string) (*IPNetGen, error)

func (*IPNetGen) Next

func (g *IPNetGen) Next() GenValue

func (*IPNetGen) Reset

func (g *IPNetGen) Reset()

type Meta

type Meta struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
}

type Prefix

type Prefix struct {
	Family string `yaml:"family"`
	IPv4   string `yaml:"ipv4"`
}

TODO: custom types should be implemented from outside library

type SingletonGen

type SingletonGen struct {
	Val   string
	Count uint32
	Type  string
	// contains filtered or unexported fields
}

func NewSingletonGen

func NewSingletonGen(val string, cnt uint32, typ string) (*SingletonGen, error)

func (*SingletonGen) Next

func (g *SingletonGen) Next() GenValue

func (*SingletonGen) Reset

func (g *SingletonGen) Reset()

Jump to

Keyboard shortcuts

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