generator

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderOperatorYaml added in v0.0.2

func RenderOperatorYaml(c *Config, image string) error

RenderOperatorYaml generates "deploy/operator.yaml"

Types

type Boilerplate

type Boilerplate struct {
	ProjectName string
}

Boilerplate contains all the customized data needed to generate codegen/boilerplate.go.txt for a new operator when pairing with boilerplateTmpl template.

type Build

type Build struct {
	RepoPath    string
	ProjectName string
}

Build contains all the customized data needed to generate tmp/build.sh for a new operator when pairing with buildTmpl template.

type CRYaml added in v0.0.2

type CRYaml struct {
	APIVersion string
	Kind       string
	Name       string
}

CRYaml contains all the customized data needed to generate deploy/cr.yaml.

type Config

type Config struct {
	// APIVersion is the kubernetes apiVersion that has the format of $GROUP_NAME/$VERSION.
	APIVersion string `yaml:"apiVersion"`
	// Kind is the kubernetes resource kind.
	Kind string `yaml:"kind"`
	// ProjectName is name of the new operator application
	// and is also the name of the base directory.
	ProjectName string `yaml:"projectName"`
}

type Doc

type Doc struct {
	GroupName string
	Version   string
}

Doc contains all the customized data needed to generate apis/<apiDirName>/<version>/doc.go for a new operator when pairing with apisDocTmpl template.

type DockerFile

type DockerFile struct {
	ProjectName string
}

DockerFile contains all the customized data needed to generate tmp/build/Dockerfie for a new operator when pairing with dockerFileTmpl template.

type Generator

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

func NewGenerator

func NewGenerator(apiVersion, kind, projectName, repoPath string) *Generator

NewGenerator creates a new scaffold Generator.

func (*Generator) Render

func (g *Generator) Render() error

Render generates the default project structure:

├── <projectName> │ ├── cmd │ │ └── <projectName> │ ├── config │ ├── deploy │ ├── pkg │ │ ├── apis │ │ │ └── <api-dir-name> // computed from apiDirName(apiVersion). │ │ │ └── <version> // computed from version(apiVersion). │ │ └── stub │ └── tmp │ ├── build │ └── codegen

type Handler

type Handler struct {
	// imports
	OperatorSDKImport string

	RepoPath   string
	Kind       string
	APIDirName string
	Version    string
}

Handler contains all the customized data needed to generate stub/handler.go for a new operator when pairing with handlerTmpl template.

type Main

type Main struct {
	// imports
	OperatorSDKImport string
	StubImport        string
	SDKVersionImport  string

	APIVersion string
	Kind       string
}

Main contains all the customized data needed to generate cmd/<projectName>/main.go for a new operator when pairing with mainTmpl template.

type OperatorYaml

type OperatorYaml struct {
	Kind         string
	KindSingular string
	KindPlural   string
	GroupName    string
	Version      string
	ProjectName  string
	Image        string
}

OperatorYaml contains all the customized data needed to generate deploy/operator.yaml for a new operator when pairing with operatorYamlTmpl template.

type RBACYaml

type RBACYaml struct {
	ProjectName string
}

RBACYaml contains all the customized data needed to generate deploy/rbac.yaml for a new operator when pairing with rbacYamlTmpl template.

type Register

type Register struct {
	GroupName  string
	Version    string
	Kind       string
	KindPlural string
}

Register contains all the customized data needed to generate apis/<apiDirName>/<version>/register.go for a new operator when pairing with apisDocTmpl template.

type Types

type Types struct {
	Version string
	Kind    string
}

Types contains all the customized data needed to generate apis/<apiDirName>/<version>/types.go for a new operator when pairing with apisTypesTmpl template.

type UpdateGenerated

type UpdateGenerated struct {
	RepoPath   string
	APIDirName string
	Version    string
}

UpdateGenerated contains all the customized data needed to generate codegen/update-generated.sh for a new operator when pairing with updateGeneratedTmpl template.

Jump to

Keyboard shortcuts

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