 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func PrintDepGopkgTOML(asFile bool) error
- func PrintGoMod(asFile bool) error
- func UpdateRoleForResource(r *Resource, absProjectPath string) error
- type AddController
- type AddToScheme
- type Apis
- type Boilerplate
- type CR
- type CRD
- type Cmd
- type Controller
- type ControllerKind
- type CustomRenderer
- type Doc
- type Dockerfile
- type Entrypoint
- type Gitignore
- type GoMod
- type GopkgToml
- type Operator
- type Register
- type Resource
- type Role
- type RoleBinding
- type Scaffold
- type ServiceAccount
- type Tools
- type Types
- type UserSetup
- type Version
Constants ¶
const ( BoilerplateFile = "boilerplate.go.txt" HackDir = "hack" )
const ( // dirs CmdDir = "cmd" ManagerDir = CmdDir + filePathSep + "manager" PkgDir = "pkg" ApisDir = PkgDir + filePathSep + "apis" ControllerDir = PkgDir + filePathSep + "controller" BuildDir = "build" BuildTestDir = BuildDir + filePathSep + "test-framework" BuildBinDir = BuildDir + filePathSep + "_output" + filePathSep + "bin" BuildScriptDir = BuildDir + filePathSep + "bin" DeployDir = "deploy" OLMCatalogDir = DeployDir + filePathSep + "olm-catalog" CRDsDir = DeployDir + filePathSep + "crds" )
const ( VersionDir = "version" VersionFile = "version.go" )
const ApisFile = "apis.go"
    const CmdFile = "main.go"
    const ControllerFile = "controller.go"
    const DocFile = "doc.go"
    const DockerfileFile = "Dockerfile"
    const EntrypointFile = "entrypoint"
    const GitignoreFile = ".gitignore"
    const GoModFile = "go.mod"
    const GopkgTomlFile = "Gopkg.toml"
    const OperatorYamlFile = "operator.yaml"
    const RegisterFile = "register.go"
    const RoleBindingYamlFile = "role_binding.yaml"
    const RoleYamlFile = "role.yaml"
    const ServiceAccountYamlFile = "service_account.yaml"
    const ToolsFile = "tools.go"
    const UserSetupFile = "user_setup"
    Variables ¶
var ( // ResourceVersionRegexp matches Kubernetes API versions. // See https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-versioning ResourceVersionRegexp = regexp.MustCompile("^v[1-9][0-9]*((alpha|beta)[1-9][0-9]*)?$") // ResourceKindRegexp matches Kubernetes API Kind's. ResourceKindRegexp = regexp.MustCompile("^[A-Z]{1}[a-zA-Z0-9]+$") )
Functions ¶
func PrintDepGopkgTOML ¶ added in v0.8.0
func PrintGoMod ¶ added in v0.8.0
func UpdateRoleForResource ¶
Types ¶
type AddController ¶
type AddController struct {
	input.Input
	// Resource defines the inputs for the controller's primary resource
	Resource *Resource
}
    AddController is the input needed to generate a pkg/controller/add_<kind>.go file
type AddToScheme ¶
type AddToScheme struct {
	input.Input
	// Resource defines the inputs for the new api
	Resource *Resource
}
    AddToScheme is the input needed to generate an addtoscheme_<group>_<version>.go file
type Boilerplate ¶ added in v0.8.0
type Boilerplate struct {
	input.Input
	// BoilerplateSrcPath is the path to a file containing boilerplate text for
	// generated Go files.
	BoilerplateSrcPath string
}
    func (*Boilerplate) CustomRender ¶ added in v0.8.0
func (s *Boilerplate) CustomRender() ([]byte, error)
func (*Boilerplate) GetInput ¶ added in v0.8.0
func (s *Boilerplate) GetInput() (input.Input, error)
func (*Boilerplate) SetFS ¶ added in v0.8.0
func (s *Boilerplate) SetFS(_ afero.Fs)
type CR ¶
type CR struct {
	input.Input
	// Resource defines the inputs for the new custom resource
	Resource *Resource
	// Spec is a custom spec for the CR. It will be automatically indented. If
	// unset, a default spec will be created.
	Spec string
}
    CR is the input needed to generate a deploy/crds/<group>_<version>_<kind>_cr.yaml file
type CRD ¶
type CRD struct {
	input.Input
	// Resource defines the inputs for the new custom resource definition
	Resource *Resource
	// IsOperatorGo is true when the operator is written in Go.
	IsOperatorGo bool
	// contains filtered or unexported fields
}
    CRD is the input needed to generate a deploy/crds/<group>_<version>_<kind>_crd.yaml file
func (*CRD) CustomRender ¶
type Controller ¶
type ControllerKind ¶
type ControllerKind struct {
	input.Input
	// Resource defines the inputs for the controller's primary resource
	Resource *Resource
	// CustomImport holds the import path for a built-in or custom Kubernetes
	// API that this controller reconciles, if specified by the scaffold invoker.
	CustomImport string
	// The following fields will be overwritten by GetInput().
	//
	// ImportMap maps all imports destined for the scaffold to their import
	// identifier, if any.
	ImportMap map[string]string
	// GoImportIdent is the import identifier for the API reconciled by this
	// controller.
	GoImportIdent string
}
    ControllerKind is the input needed to generate a pkg/controller/<kind>/<kind>_controller.go file
type CustomRenderer ¶
type CustomRenderer interface {
	// SetFS sets the fs in the CustomRenderer's underlying type if it exists.
	// SetFS is used to inject the callers' fs into a CustomRenderer, which may
	// want to write/read from the same fs.
	SetFS(afero.Fs)
	// CustomRender performs arbitrary rendering of file data and returns
	// bytes to write to a file.
	CustomRender() ([]byte, error)
}
    CustomRenderer is the interface for writing any scaffold file that does not use a template.
type Doc ¶
type Doc struct {
	input.Input
	// Resource defines the inputs for the new doc file
	Resource *Resource
}
    Doc is the input needed to generate a pkg/apis/<group>/<version>/doc.go file
type Dockerfile ¶
type Entrypoint ¶
Entrypoint - entrypoint script
type Register ¶
type Register struct {
	input.Input
	// Resource defines the inputs for the new custom resource definition
	Resource *Resource
}
    Register is the input needed to generate a pkg/apis/<group>/<version>/register.go file
type Resource ¶
type Resource struct {
	// APIVersion is the complete group-subdomain/version e.g app.example.com/v1alpha1
	APIVersion string
	// Kind is the API Kind e.g AppService
	Kind string
	// FullGroup is the complete group name with subdomain e.g app.example.com
	// Parsed from APIVersion
	FullGroup string
	// Group is the API Group.  Does not contain the sub-domain. e.g app
	// Parsed from APIVersion
	Group string
	// GoImportGroup is the non-hyphenated go import group for this resource
	GoImportGroup string
	// Version is the API version - e.g. v1alpha1
	// Parsed from APIVersion
	Version string
	// Resource is the API Resource i.e plural(lowercased(Kind)) e.g appservices
	Resource string
	// LowerKind is lowercased(Kind) e.g appservice
	LowerKind string
}
    Resource contains the information required to scaffold files for a resource.
func NewResource ¶
type Role ¶
type RoleBinding ¶
type Scaffold ¶
type Scaffold struct {
	// Repo is the go project package
	Repo string
	// AbsProjectPath is the absolute path to the project root, including the project directory.
	AbsProjectPath string
	// ProjectName is the operator's name, ex. app-operator
	ProjectName string
	// Fs is the filesystem GetWriter uses to write scaffold files.
	Fs afero.Fs
	// GetWriter returns a writer for writing scaffold files.
	GetWriter func(path string, mode os.FileMode) (io.Writer, error)
	// BoilerplatePath is the path to a file containing Go boilerplate text.
	BoilerplatePath string
	// contains filtered or unexported fields
}
    Scaffold writes Templates to scaffold new files
type ServiceAccount ¶
type Types ¶
type Types struct {
	input.Input
	// Resource defines the inputs for the new types file
	Resource *Resource
}
    Types is the input needed to generate a pkg/apis/<group>/<version>/<kind>_types.go file
       Source Files
      ¶
      Source Files
      ¶
    
- add_controller.go
- addtoscheme.go
- apis.go
- boilerplate_go_txt.go
- build_dockerfile.go
- cmd.go
- constants.go
- controller.go
- controller_kind.go
- cr.go
- crd.go
- customrender.go
- doc.go
- entrypoint.go
- gitignore.go
- go_mod.go
- gopkgtoml.go
- operator.go
- register.go
- resource.go
- role.go
- rolebinding.go
- scaffold.go
- service_account.go
- test_setup.go
- tools.go
- types.go
- usersetup.go
- version.go