Documentation ¶
Index ¶
- Constants
- Variables
- func PrintDeps() error
- func PrintDepsAsFile()
- func UpdateRoleForResource(r *Resource, absProjectPath string) error
- type AddController
- type AddToScheme
- type Apis
- type CR
- type CRD
- type Cmd
- type Controller
- type ControllerKind
- type CustomRenderer
- type Doc
- type Dockerfile
- type Entrypoint
- type Gitignore
- type GoTestScript
- type GopkgToml
- type Operator
- type Register
- type Resource
- type Role
- type RoleBinding
- type Scaffold
- type ServiceAccount
- type TestFrameworkDockerfile
- type TestPod
- type Types
- type UserSetup
- type Version
Constants ¶
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" VersionDir = "version" )
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 GoTestScriptFile = "go-test.sh"
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 TestPodYamlFile = "test-pod.yaml"
const UserSetupFile = "user_setup"
const VersionFile = "version.go"
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 PrintDepsAsFile ¶ added in v0.2.0
func PrintDepsAsFile()
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 CR ¶ added in v0.5.0
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 ¶ added in v0.5.0
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 }
CRD is the input needed to generate a deploy/crds/<group>_<version>_<kind>_crd.yaml file
func (*CRD) CustomRender ¶ added in v0.5.0
type Controller ¶
type ControllerKind ¶
type ControllerKind struct { input.Input // Resource defines the inputs for the controller's primary resource Resource *Resource }
ControllerKind is the input needed to generate a pkg/controller/<kind>/<kind>_controller.go file
type CustomRenderer ¶ added in v0.4.0
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 ¶ added in v0.5.0
Entrypoint - entrypoint script
type GoTestScript ¶
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 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) }
Scaffold writes Templates to scaffold new files
type ServiceAccount ¶
type TestFrameworkDockerfile ¶
type TestPod ¶
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 ¶
- add_controller.go
- addtoscheme.go
- apis.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_test_script.go
- gopkgtoml.go
- operator.go
- register.go
- resource.go
- role.go
- rolebinding.go
- scaffold.go
- service_account.go
- test_framework_dockerfile.go
- test_pod.go
- test_setup.go
- types.go
- usersetup.go
- version.go