Documentation ¶
Index ¶
- Constants
- Variables
- func CloseFile(file io.ReadCloser)
- func Glob(pattern string) ([]string, error)
- func InitializeMarkerInspector(markerTypes ...MarkerType) (*inspect.Inspector, error)
- func ReadStream(fileName string) (io.ReadCloser, error)
- func TransformYAML(results ...*inspect.YAMLResult) error
- func WriteConfig(options *InitConfigOptions) error
- type APIFields
- type ChildResource
- type CliCommand
- type CollectionFieldMarker
- type ComponentWorkload
- func (c *ComponentWorkload) GetAPIGroup() string
- func (c *ComponentWorkload) GetAPIKind() string
- func (c *ComponentWorkload) GetAPISpec() WorkloadAPISpec
- func (c *ComponentWorkload) GetAPISpecFields() *APIFields
- func (c *ComponentWorkload) GetAPIVersion() string
- func (c *ComponentWorkload) GetCollection() *WorkloadCollection
- func (c *ComponentWorkload) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
- func (*ComponentWorkload) GetComponents() []*ComponentWorkload
- func (c *ComponentWorkload) GetDependencies() []*ComponentWorkload
- func (c *ComponentWorkload) GetDomain() string
- func (c *ComponentWorkload) GetFuncNames() (createFuncNames, initFuncNames []string)
- func (c *ComponentWorkload) GetName() string
- func (c *ComponentWorkload) GetPackageName() string
- func (c *ComponentWorkload) GetRBACRules() *[]RBACRule
- func (c *ComponentWorkload) GetRootCommand() *CliCommand
- func (c *ComponentWorkload) GetSourceFiles() *[]SourceFile
- func (c *ComponentWorkload) GetSubCommand() *CliCommand
- func (c *ComponentWorkload) GetWorkloadKind() WorkloadKind
- func (c *ComponentWorkload) HasChildResources() bool
- func (c *ComponentWorkload) HasRootCmdName() bool
- func (c *ComponentWorkload) HasSubCmdDescription() bool
- func (c *ComponentWorkload) HasSubCmdName() bool
- func (c *ComponentWorkload) IsClusterScoped() bool
- func (*ComponentWorkload) IsCollection() bool
- func (*ComponentWorkload) IsComponent() bool
- func (*ComponentWorkload) IsStandalone() bool
- func (c *ComponentWorkload) LoadManifests(workloadPath string) error
- func (*ComponentWorkload) SetComponents(components []*ComponentWorkload) error
- func (c *ComponentWorkload) SetNames()
- func (c *ComponentWorkload) SetRBAC()
- func (c *ComponentWorkload) SetResources(workloadPath string) error
- func (c *ComponentWorkload) Validate() error
- type ComponentWorkloadSpec
- type FieldMarker
- type FieldType
- type InitConfigOptions
- type MarkerType
- type PluginConfig
- type RBACRoleRule
- type RBACRoleRuleField
- type RBACRule
- type RBACRules
- type Resource
- type ResourceMarker
- type SourceFile
- type StandaloneWorkload
- func (s *StandaloneWorkload) GetAPIGroup() string
- func (s *StandaloneWorkload) GetAPIKind() string
- func (s *StandaloneWorkload) GetAPISpec() WorkloadAPISpec
- func (s *StandaloneWorkload) GetAPISpecFields() *APIFields
- func (s *StandaloneWorkload) GetAPIVersion() string
- func (s *StandaloneWorkload) GetCollection() *WorkloadCollection
- func (*StandaloneWorkload) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
- func (s *StandaloneWorkload) GetComponents() []*ComponentWorkload
- func (*StandaloneWorkload) GetDependencies() []*ComponentWorkload
- func (s *StandaloneWorkload) GetDomain() string
- func (s *StandaloneWorkload) GetFuncNames() (createFuncNames, initFuncNames []string)
- func (s *StandaloneWorkload) GetName() string
- func (s *StandaloneWorkload) GetPackageName() string
- func (s *StandaloneWorkload) GetRBACRules() *[]RBACRule
- func (s *StandaloneWorkload) GetRootCommand() *CliCommand
- func (s *StandaloneWorkload) GetSourceFiles() *[]SourceFile
- func (s *StandaloneWorkload) GetSubCommand() *CliCommand
- func (s *StandaloneWorkload) GetWorkloadKind() WorkloadKind
- func (s *StandaloneWorkload) HasChildResources() bool
- func (s *StandaloneWorkload) HasRootCmdDescription() bool
- func (s *StandaloneWorkload) HasRootCmdName() bool
- func (*StandaloneWorkload) HasSubCmdName() bool
- func (s *StandaloneWorkload) IsClusterScoped() bool
- func (*StandaloneWorkload) IsCollection() bool
- func (*StandaloneWorkload) IsComponent() bool
- func (*StandaloneWorkload) IsStandalone() bool
- func (s *StandaloneWorkload) LoadManifests(workloadPath string) error
- func (*StandaloneWorkload) SetComponents(components []*ComponentWorkload) error
- func (s *StandaloneWorkload) SetNames()
- func (s *StandaloneWorkload) SetRBAC()
- func (s *StandaloneWorkload) SetResources(workloadPath string) error
- func (s *StandaloneWorkload) Validate() error
- type StandaloneWorkloadSpec
- type WorkloadAPIBuilder
- type WorkloadAPISpec
- type WorkloadCollection
- func (c *WorkloadCollection) GetAPIGroup() string
- func (c *WorkloadCollection) GetAPIKind() string
- func (c *WorkloadCollection) GetAPISpec() WorkloadAPISpec
- func (c *WorkloadCollection) GetAPISpecFields() *APIFields
- func (c *WorkloadCollection) GetAPIVersion() string
- func (c *WorkloadCollection) GetCollection() *WorkloadCollection
- func (c *WorkloadCollection) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
- func (c *WorkloadCollection) GetComponents() []*ComponentWorkload
- func (c *WorkloadCollection) GetDependencies() []*ComponentWorkload
- func (c *WorkloadCollection) GetDomain() string
- func (c *WorkloadCollection) GetFuncNames() (createFuncNames, initFuncNames []string)
- func (c *WorkloadCollection) GetName() string
- func (c *WorkloadCollection) GetPackageName() string
- func (c *WorkloadCollection) GetRBACRules() *[]RBACRule
- func (c *WorkloadCollection) GetRootCommand() *CliCommand
- func (c *WorkloadCollection) GetSourceFiles() *[]SourceFile
- func (c *WorkloadCollection) GetSubCommand() *CliCommand
- func (c *WorkloadCollection) GetWorkloadKind() WorkloadKind
- func (c *WorkloadCollection) HasChildResources() bool
- func (c *WorkloadCollection) HasRootCmdDescription() bool
- func (c *WorkloadCollection) HasRootCmdName() bool
- func (c *WorkloadCollection) HasSubCmdDescription() bool
- func (c *WorkloadCollection) HasSubCmdName() bool
- func (c *WorkloadCollection) IsClusterScoped() bool
- func (c *WorkloadCollection) IsCollection() bool
- func (c *WorkloadCollection) IsComponent() bool
- func (c *WorkloadCollection) IsStandalone() bool
- func (c *WorkloadCollection) LoadManifests(workloadPath string) error
- func (c *WorkloadCollection) SetComponents(components []*ComponentWorkload) error
- func (c *WorkloadCollection) SetNames()
- func (c *WorkloadCollection) SetRBAC()
- func (c *WorkloadCollection) SetResources(workloadPath string) error
- func (c *WorkloadCollection) Validate() error
- type WorkloadCollectionSpec
- type WorkloadIdentifier
- type WorkloadInitializer
- type WorkloadKind
- type WorkloadShared
- type WorkloadSpec
Constants ¶
const ( SampleWorkloadAPIDomain = "acme.com" SampleWorkloadAPIGroup = "apps" SampleWorkloadAPIKind = "MyApp" SampleWorkloadAPIVersion = "v1alpha1" )
WorkloadAPISpec sample fields which may be used in things like testing or generation of sample files.
const PluginConfigKey = "operatorBuilder"
Variables ¶
var ( ErrNamesMustBeUnique = errors.New("each workload name must be unique") ErrConfigMustExist = errors.New("no workload config provided - workload config required") ErrMultipleConfigs = errors.New("multiple configs found - please provide only one standalone or collection workload") ErrCollectionRequired = errors.New("a WorkloadCollection is required when using WorkloadComponents") ErrMissingWorkload = errors.New("could not find either standalone or collection workload, please provide one") ErrMissingDependencies = errors.New("missing dependencies - no workload config provided") )
var ( ErrFileExists = errors.New("force was not requested and file exists") ErrWriteFile = errors.New("unable to write to file") ErrWriteStdout = errors.New("unable to write to stdout") )
var ( ErrReservedFieldMarker = errors.New("field marker cannot be used and is reserved for internal purposes") ErrNumberResourceMarkers = errors.New("expected only 1 resource marker") ErrAssociateResourceMarker = errors.New("unable to associate resource marker with field marker") )
var ( ErrMismatchedMarkerTypes = errors.New("resource marker and field marker have mismatched types") ErrResourceMarkerUnknownValueType = errors.New("resource marker 'value' is of unknown type") ErrResourceMarkerMissingFieldValue = errors.New("resource marker missing 'collectionField', 'field' or 'value'") ErrResourceMarkerMissingInclude = errors.New("resource marker missing 'include' value") ErrResourceMarkerMissingFieldMarker = errors.New("resource marker has no associated 'field' or 'collectionField' marker") ErrFieldMarkerInvalidType = errors.New("field marker type is invalid") )
var ( ErrConvertArrayInterface = errors.New("unable to convert to []interface{}") ErrConvertArrayString = errors.New("unable to convert to []string") ErrConvertMapStringInterface = errors.New("unable to convert to map[string]interface{}") ErrConvertString = errors.New("unable to convert to string") )
var ErrInvalidKind = errors.New("unrecognized workload kind in workload config")
var ErrMissingRequiredFields = errors.New("missing required fields")
var ErrNoComponentsOnComponent = errors.New("cannot set component workloads on a component workload - only on collections")
var ErrNoComponentsOnStandalone = errors.New("cannot set component workloads on a component workload - only on collections")
var ErrOverwriteExistingValue = errors.New("an attempt to overwrite existing value was made")
var ErrUnableToParseFieldType = errors.New("unable to parse field")
Functions ¶
func Glob ¶ added in v0.5.0
Glob adds double-star support to the core path/filepath Glob function. It's useful when your globs might have double-stars, but you're not sure.
func InitializeMarkerInspector ¶
func InitializeMarkerInspector(markerTypes ...MarkerType) (*inspect.Inspector, error)
func ReadStream ¶
func ReadStream(fileName string) (io.ReadCloser, error)
func TransformYAML ¶
func TransformYAML(results ...*inspect.YAMLResult) error
func WriteConfig ¶ added in v0.6.0
func WriteConfig(options *InitConfigOptions) error
Types ¶
type APIFields ¶ added in v0.4.0
type APIFields struct { Name string StructName string Type FieldType Tags string Comments []string Markers []string Children []*APIFields Default string Sample string Last bool // contains filtered or unexported fields }
func (*APIFields) GenerateAPISpec ¶ added in v0.4.0
func (*APIFields) GenerateSampleSpec ¶ added in v0.4.0
type ChildResource ¶
type ChildResource struct { Name string UniqueName string Group string Version string Kind string StaticContent string SourceCode string IncludeCode string }
ChildResource contains attributes for resources created by the custom resource. These definitions are inferred from the resource manifests.
type CliCommand ¶
type CliCommand struct { Name string Description string VarName string `json:"-" yaml:"-" validate:"omitempty"` FileName string `json:"-" yaml:"-" validate:"omitempty"` IsSubcommand bool `json:"-" yaml:"-" validate:"omitempty"` IsRootcommand bool `json:"-" yaml:"-" validate:"omitempty"` }
CliCommand defines the command name and description for the root command or subcommand of a companion CLI.
func (*CliCommand) GetSubCmdRelativeFileName ¶ added in v0.5.0
func (cli *CliCommand) GetSubCmdRelativeFileName( rootCmdName string, subCommandFolder string, group string, fileName string, ) string
GetSubCmdRelativeFileName will generate a path for a subcommand CLI file that is relative to the root of the repository.
func (*CliCommand) SetDefaults ¶ added in v0.6.0
func (cli *CliCommand) SetDefaults(workload WorkloadAPIBuilder, isSubcommand bool)
type CollectionFieldMarker ¶
type CollectionFieldMarker FieldMarker
func (CollectionFieldMarker) String ¶ added in v0.4.0
func (cfm CollectionFieldMarker) String() string
type ComponentWorkload ¶
type ComponentWorkload struct { Spec ComponentWorkloadSpec `json:"spec" yaml:"spec" validate:"required"` }
ComponentWorkload defines a workload that is a component of a collection.
func NewComponentWorkload ¶ added in v0.6.0
func NewComponentWorkload( name string, spec WorkloadAPISpec, resourceFiles, dependencies []string, ) *ComponentWorkload
func (*ComponentWorkload) GetAPIGroup ¶
func (c *ComponentWorkload) GetAPIGroup() string
func (*ComponentWorkload) GetAPIKind ¶
func (c *ComponentWorkload) GetAPIKind() string
func (*ComponentWorkload) GetAPISpec ¶ added in v0.6.0
func (c *ComponentWorkload) GetAPISpec() WorkloadAPISpec
func (*ComponentWorkload) GetAPISpecFields ¶
func (c *ComponentWorkload) GetAPISpecFields() *APIFields
func (*ComponentWorkload) GetAPIVersion ¶
func (c *ComponentWorkload) GetAPIVersion() string
func (*ComponentWorkload) GetCollection ¶ added in v0.5.0
func (c *ComponentWorkload) GetCollection() *WorkloadCollection
func (*ComponentWorkload) GetComponentResource ¶
func (c *ComponentWorkload) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
func (*ComponentWorkload) GetComponents ¶
func (*ComponentWorkload) GetComponents() []*ComponentWorkload
func (*ComponentWorkload) GetDependencies ¶
func (c *ComponentWorkload) GetDependencies() []*ComponentWorkload
func (*ComponentWorkload) GetDomain ¶ added in v0.3.0
func (c *ComponentWorkload) GetDomain() string
methods that implement WorkloadAPIBuilder.
func (*ComponentWorkload) GetFuncNames ¶
func (c *ComponentWorkload) GetFuncNames() (createFuncNames, initFuncNames []string)
func (*ComponentWorkload) GetName ¶
func (c *ComponentWorkload) GetName() string
func (*ComponentWorkload) GetPackageName ¶
func (c *ComponentWorkload) GetPackageName() string
func (*ComponentWorkload) GetRBACRules ¶
func (c *ComponentWorkload) GetRBACRules() *[]RBACRule
func (*ComponentWorkload) GetRootCommand ¶ added in v0.5.0
func (c *ComponentWorkload) GetRootCommand() *CliCommand
func (*ComponentWorkload) GetSourceFiles ¶
func (c *ComponentWorkload) GetSourceFiles() *[]SourceFile
func (*ComponentWorkload) GetSubCommand ¶ added in v0.5.0
func (c *ComponentWorkload) GetSubCommand() *CliCommand
func (*ComponentWorkload) GetWorkloadKind ¶
func (c *ComponentWorkload) GetWorkloadKind() WorkloadKind
func (*ComponentWorkload) HasChildResources ¶
func (c *ComponentWorkload) HasChildResources() bool
func (*ComponentWorkload) HasRootCmdName ¶ added in v0.6.0
func (c *ComponentWorkload) HasRootCmdName() bool
func (*ComponentWorkload) HasSubCmdDescription ¶ added in v0.3.0
func (c *ComponentWorkload) HasSubCmdDescription() bool
func (*ComponentWorkload) HasSubCmdName ¶
func (c *ComponentWorkload) HasSubCmdName() bool
func (*ComponentWorkload) IsClusterScoped ¶
func (c *ComponentWorkload) IsClusterScoped() bool
func (*ComponentWorkload) IsCollection ¶
func (*ComponentWorkload) IsCollection() bool
func (*ComponentWorkload) IsComponent ¶
func (*ComponentWorkload) IsComponent() bool
func (*ComponentWorkload) IsStandalone ¶
func (*ComponentWorkload) IsStandalone() bool
func (*ComponentWorkload) LoadManifests ¶ added in v0.4.0
func (c *ComponentWorkload) LoadManifests(workloadPath string) error
func (*ComponentWorkload) SetComponents ¶
func (*ComponentWorkload) SetComponents(components []*ComponentWorkload) error
func (*ComponentWorkload) SetNames ¶
func (c *ComponentWorkload) SetNames()
func (*ComponentWorkload) SetRBAC ¶ added in v0.6.0
func (c *ComponentWorkload) SetRBAC()
func (*ComponentWorkload) SetResources ¶
func (c *ComponentWorkload) SetResources(workloadPath string) error
func (*ComponentWorkload) Validate ¶
func (c *ComponentWorkload) Validate() error
type ComponentWorkloadSpec ¶
type ComponentWorkloadSpec struct { API WorkloadAPISpec `json:"api" yaml:"api"` CompanionCliSubcmd CliCommand `json:"companionCliSubcmd" yaml:"companionCliSubcmd" validate:"omitempty"` CompanionCliRootcmd CliCommand `json:"-" yaml:"-" validate:"omitempty"` Dependencies []string `json:"dependencies" yaml:"dependencies"` ConfigPath string `json:"-" yaml:"-" validate:"omitempty"` ComponentDependencies []*ComponentWorkload `json:"-" yaml:"-" validate:"omitempty"` WorkloadSpec `yaml:",inline"` }
ComponentWorkloadSpec defines the attributes for a workload that is a component of a collection.
type FieldMarker ¶
type FieldMarker struct { Name string Type FieldType Description *string Default interface{} `marker:",optional"` Replace *string // contains filtered or unexported fields }
func (FieldMarker) String ¶
func (fm FieldMarker) String() string
type InitConfigOptions ¶ added in v0.6.0
type InitConfigOptions struct { Path string Force bool WorkloadConfig WorkloadInitializer }
type MarkerType ¶ added in v0.4.0
type MarkerType int
const ( FieldMarkerType MarkerType = iota CollectionMarkerType ResourceMarkerType )
type PluginConfig ¶
type PluginConfig struct { WorkloadConfigPath string `json:"workloadConfigPath" yaml:"workloadConfigPath"` CliRootCommandName string `json:"cliRootCommandName" yaml:"cliRootCommandName"` }
PluginConfig contains the project config values which are stored in the PROJECT file under plugins.operatorBuilder.
type RBACRoleRule ¶ added in v0.6.0
type RBACRoleRule struct { Groups RBACRoleRuleField Resources RBACRoleRuleField Verbs RBACRoleRuleField URLs RBACRoleRuleField }
RBACRoleRule contains the info needed to create the kubebuilder:rbac markers in the controller when a resource that is of a role or clusterrole type is found. This is because the underlying controller needs the same permissions for the role or clusterrole that it is attempting to manage.
type RBACRoleRuleField ¶ added in v0.6.0
type RBACRoleRuleField []string
type RBACRule ¶
RBACRule contains the info needed to create the kubebuilder:rbac markers in the controller.
type RBACRules ¶ added in v0.4.0
type RBACRules []RBACRule
func (*RBACRules) AddOrUpdateRoleRules ¶ added in v0.6.0
func (rs *RBACRules) AddOrUpdateRoleRules(newRule *RBACRoleRule)
func (*RBACRules) AddOrUpdateRules ¶ added in v0.4.0
type Resource ¶ added in v0.4.0
type Resource struct { FileName string `json:",omitempty" yaml:",omitempty" validate:"omitempty"` Content []byte `json:",omitempty" yaml:",omitempty" validate:"omitempty"` // contains filtered or unexported fields }
Resource represents a single input manifest for a given config.
func ResourcesFromFiles ¶ added in v0.6.0
func (*Resource) UnmarshalYAML ¶ added in v0.4.0
type ResourceMarker ¶ added in v0.6.0
type ResourceMarker struct { Field *string CollectionField *string Value interface{} Include *bool // contains filtered or unexported fields }
func (ResourceMarker) String ¶ added in v0.6.0
func (rm ResourceMarker) String() string
type SourceFile ¶
type SourceFile struct { Filename string Children []ChildResource HasStatic bool }
SourceFile represents a golang source code file that contains one or more child resource objects.
type StandaloneWorkload ¶
type StandaloneWorkload struct { Spec StandaloneWorkloadSpec `json:"spec" yaml:"spec" validate:"required"` }
StandaloneWorkload defines a standalone workload.
func NewStandaloneWorkload ¶ added in v0.6.0
func NewStandaloneWorkload( name string, spec WorkloadAPISpec, resourceFiles []string, ) *StandaloneWorkload
func (*StandaloneWorkload) GetAPIGroup ¶
func (s *StandaloneWorkload) GetAPIGroup() string
func (*StandaloneWorkload) GetAPIKind ¶
func (s *StandaloneWorkload) GetAPIKind() string
func (*StandaloneWorkload) GetAPISpec ¶ added in v0.6.0
func (s *StandaloneWorkload) GetAPISpec() WorkloadAPISpec
func (*StandaloneWorkload) GetAPISpecFields ¶
func (s *StandaloneWorkload) GetAPISpecFields() *APIFields
func (*StandaloneWorkload) GetAPIVersion ¶
func (s *StandaloneWorkload) GetAPIVersion() string
func (*StandaloneWorkload) GetCollection ¶ added in v0.5.0
func (s *StandaloneWorkload) GetCollection() *WorkloadCollection
func (*StandaloneWorkload) GetComponentResource ¶
func (*StandaloneWorkload) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
func (*StandaloneWorkload) GetComponents ¶
func (s *StandaloneWorkload) GetComponents() []*ComponentWorkload
func (*StandaloneWorkload) GetDependencies ¶
func (*StandaloneWorkload) GetDependencies() []*ComponentWorkload
func (*StandaloneWorkload) GetDomain ¶
func (s *StandaloneWorkload) GetDomain() string
methods that implement WorkloadInitializer.
func (*StandaloneWorkload) GetFuncNames ¶
func (s *StandaloneWorkload) GetFuncNames() (createFuncNames, initFuncNames []string)
func (*StandaloneWorkload) GetName ¶
func (s *StandaloneWorkload) GetName() string
methods that implement WorkloadAPIBuilder.
func (*StandaloneWorkload) GetPackageName ¶
func (s *StandaloneWorkload) GetPackageName() string
func (*StandaloneWorkload) GetRBACRules ¶
func (s *StandaloneWorkload) GetRBACRules() *[]RBACRule
func (*StandaloneWorkload) GetRootCommand ¶ added in v0.5.0
func (s *StandaloneWorkload) GetRootCommand() *CliCommand
func (*StandaloneWorkload) GetSourceFiles ¶
func (s *StandaloneWorkload) GetSourceFiles() *[]SourceFile
func (*StandaloneWorkload) GetSubCommand ¶ added in v0.5.0
func (s *StandaloneWorkload) GetSubCommand() *CliCommand
func (*StandaloneWorkload) GetWorkloadKind ¶
func (s *StandaloneWorkload) GetWorkloadKind() WorkloadKind
func (*StandaloneWorkload) HasChildResources ¶
func (s *StandaloneWorkload) HasChildResources() bool
func (*StandaloneWorkload) HasRootCmdDescription ¶ added in v0.3.0
func (s *StandaloneWorkload) HasRootCmdDescription() bool
func (*StandaloneWorkload) HasRootCmdName ¶
func (s *StandaloneWorkload) HasRootCmdName() bool
func (*StandaloneWorkload) HasSubCmdName ¶
func (*StandaloneWorkload) HasSubCmdName() bool
func (*StandaloneWorkload) IsClusterScoped ¶
func (s *StandaloneWorkload) IsClusterScoped() bool
func (*StandaloneWorkload) IsCollection ¶
func (*StandaloneWorkload) IsCollection() bool
func (*StandaloneWorkload) IsComponent ¶
func (*StandaloneWorkload) IsComponent() bool
func (*StandaloneWorkload) IsStandalone ¶
func (*StandaloneWorkload) IsStandalone() bool
func (*StandaloneWorkload) LoadManifests ¶ added in v0.4.0
func (s *StandaloneWorkload) LoadManifests(workloadPath string) error
func (*StandaloneWorkload) SetComponents ¶
func (*StandaloneWorkload) SetComponents(components []*ComponentWorkload) error
func (*StandaloneWorkload) SetNames ¶
func (s *StandaloneWorkload) SetNames()
func (*StandaloneWorkload) SetRBAC ¶ added in v0.6.0
func (s *StandaloneWorkload) SetRBAC()
func (*StandaloneWorkload) SetResources ¶
func (s *StandaloneWorkload) SetResources(workloadPath string) error
func (*StandaloneWorkload) Validate ¶
func (s *StandaloneWorkload) Validate() error
type StandaloneWorkloadSpec ¶
type StandaloneWorkloadSpec struct { API WorkloadAPISpec `json:"api" yaml:"api"` CompanionCliRootcmd CliCommand `json:"companionCliRootcmd" yaml:"companionCliRootcmd" validate:"omitempty"` WorkloadSpec `yaml:",inline"` }
StandaloneWorkloadSpec defines the attributes for a standalone workload.
type WorkloadAPIBuilder ¶
type WorkloadAPIBuilder interface { Validate() error IsClusterScoped() bool IsStandalone() bool IsComponent() bool IsCollection() bool HasSubCmdName() bool HasChildResources() bool GetName() string GetPackageName() string GetDomain() string GetAPIGroup() string GetAPIVersion() string GetAPIKind() string GetDependencies() []*ComponentWorkload GetCollection() *WorkloadCollection GetComponents() []*ComponentWorkload GetSourceFiles() *[]SourceFile GetAPISpecFields() *APIFields GetRBACRules() *[]RBACRule GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource GetFuncNames() (createFuncNames, initFuncNames []string) GetRootCommand() *CliCommand GetSubCommand() *CliCommand SetNames() SetRBAC() SetResources(workloadPath string) error SetComponents(components []*ComponentWorkload) error LoadManifests(workloadPath string) error }
WorkloadAPIBuilder defines the interface that must be implemented by a workload being used to configure API and controller creation.
func ProcessAPIConfig ¶
func ProcessAPIConfig(workloadConfig string) (WorkloadAPIBuilder, error)
type WorkloadAPISpec ¶ added in v0.4.0
type WorkloadAPISpec struct { Domain string `json:"domain" yaml:"domain"` Group string `json:"group" yaml:"group"` Version string `json:"version" yaml:"version"` Kind string `json:"kind" yaml:"kind"` ClusterScoped bool `json:"clusterScoped" yaml:"clusterScoped"` }
WorkloadAPISpec contains fields shared by all workload specs.
func NewSampleAPISpec ¶ added in v0.6.0
func NewSampleAPISpec() *WorkloadAPISpec
type WorkloadCollection ¶
type WorkloadCollection struct { Spec WorkloadCollectionSpec `json:"spec" yaml:"spec" validate:"required"` }
WorkloadCollection defines a workload collection.
func NewWorkloadCollection ¶ added in v0.6.0
func NewWorkloadCollection( name string, spec WorkloadAPISpec, componentFiles []string, ) *WorkloadCollection
func (*WorkloadCollection) GetAPIGroup ¶
func (c *WorkloadCollection) GetAPIGroup() string
func (*WorkloadCollection) GetAPIKind ¶
func (c *WorkloadCollection) GetAPIKind() string
func (*WorkloadCollection) GetAPISpec ¶ added in v0.6.0
func (c *WorkloadCollection) GetAPISpec() WorkloadAPISpec
func (*WorkloadCollection) GetAPISpecFields ¶
func (c *WorkloadCollection) GetAPISpecFields() *APIFields
func (*WorkloadCollection) GetAPIVersion ¶
func (c *WorkloadCollection) GetAPIVersion() string
func (*WorkloadCollection) GetCollection ¶ added in v0.5.0
func (c *WorkloadCollection) GetCollection() *WorkloadCollection
func (*WorkloadCollection) GetComponentResource ¶
func (c *WorkloadCollection) GetComponentResource(domain, repo string, clusterScoped bool) *resource.Resource
func (*WorkloadCollection) GetComponents ¶
func (c *WorkloadCollection) GetComponents() []*ComponentWorkload
func (*WorkloadCollection) GetDependencies ¶
func (c *WorkloadCollection) GetDependencies() []*ComponentWorkload
func (*WorkloadCollection) GetDomain ¶
func (c *WorkloadCollection) GetDomain() string
methods that implement WorkloadInitializer.
func (*WorkloadCollection) GetFuncNames ¶
func (c *WorkloadCollection) GetFuncNames() (createFuncNames, initFuncNames []string)
func (*WorkloadCollection) GetName ¶
func (c *WorkloadCollection) GetName() string
methods that implement WorkloadAPIBuilder.
func (*WorkloadCollection) GetPackageName ¶
func (c *WorkloadCollection) GetPackageName() string
func (*WorkloadCollection) GetRBACRules ¶
func (c *WorkloadCollection) GetRBACRules() *[]RBACRule
func (*WorkloadCollection) GetRootCommand ¶ added in v0.5.0
func (c *WorkloadCollection) GetRootCommand() *CliCommand
func (*WorkloadCollection) GetSourceFiles ¶
func (c *WorkloadCollection) GetSourceFiles() *[]SourceFile
func (*WorkloadCollection) GetSubCommand ¶ added in v0.5.0
func (c *WorkloadCollection) GetSubCommand() *CliCommand
func (*WorkloadCollection) GetWorkloadKind ¶
func (c *WorkloadCollection) GetWorkloadKind() WorkloadKind
func (*WorkloadCollection) HasChildResources ¶
func (c *WorkloadCollection) HasChildResources() bool
func (*WorkloadCollection) HasRootCmdDescription ¶ added in v0.3.0
func (c *WorkloadCollection) HasRootCmdDescription() bool
func (*WorkloadCollection) HasRootCmdName ¶
func (c *WorkloadCollection) HasRootCmdName() bool
func (*WorkloadCollection) HasSubCmdDescription ¶ added in v0.3.0
func (c *WorkloadCollection) HasSubCmdDescription() bool
func (*WorkloadCollection) HasSubCmdName ¶
func (c *WorkloadCollection) HasSubCmdName() bool
func (*WorkloadCollection) IsClusterScoped ¶
func (c *WorkloadCollection) IsClusterScoped() bool
func (*WorkloadCollection) IsCollection ¶
func (c *WorkloadCollection) IsCollection() bool
func (*WorkloadCollection) IsComponent ¶
func (c *WorkloadCollection) IsComponent() bool
func (*WorkloadCollection) IsStandalone ¶
func (c *WorkloadCollection) IsStandalone() bool
func (*WorkloadCollection) LoadManifests ¶ added in v0.4.0
func (c *WorkloadCollection) LoadManifests(workloadPath string) error
func (*WorkloadCollection) SetComponents ¶
func (c *WorkloadCollection) SetComponents(components []*ComponentWorkload) error
func (*WorkloadCollection) SetNames ¶
func (c *WorkloadCollection) SetNames()
func (*WorkloadCollection) SetRBAC ¶ added in v0.6.0
func (c *WorkloadCollection) SetRBAC()
func (*WorkloadCollection) SetResources ¶
func (c *WorkloadCollection) SetResources(workloadPath string) error
func (*WorkloadCollection) Validate ¶
func (c *WorkloadCollection) Validate() error
type WorkloadCollectionSpec ¶
type WorkloadCollectionSpec struct { API WorkloadAPISpec `json:"api" yaml:"api"` CompanionCliRootcmd CliCommand `json:"companionCliRootcmd,omitempty" yaml:"companionCliRootcmd,omitempty" validate:"omitempty"` CompanionCliSubcmd CliCommand `json:"companionCliSubcmd,omitempty" yaml:"companionCliSubcmd,omitempty" validate:"omitempty"` ComponentFiles []string `json:"componentFiles" yaml:"componentFiles"` Components []*ComponentWorkload `json:",omitempty" yaml:",omitempty" validate:"omitempty"` WorkloadSpec `yaml:",inline"` }
WorkloadCollectionSpec defines the attributes for a workload collection.
type WorkloadIdentifier ¶
type WorkloadIdentifier interface { GetName() string GetWorkloadKind() WorkloadKind }
WorkloadIdentifier defines an interface for identifying any workload.
type WorkloadInitializer ¶
type WorkloadInitializer interface { Validate() error HasRootCmdName() bool GetDomain() string GetRootCommand() *CliCommand GetWorkloadKind() WorkloadKind SetNames() IsCollection() bool }
WorkloadInitializer defines the interface that must be implemented by a workload being used to configure project initialization.
func ProcessInitConfig ¶
func ProcessInitConfig(workloadConfig string) (WorkloadInitializer, error)
type WorkloadKind ¶
type WorkloadKind int32
WorkloadKind indicates which of the supported workload kinds are being used.
const ( WorkloadKindUnknown WorkloadKind = iota WorkloadKindStandalone WorkloadKindCollection WorkloadKindComponent )
func (WorkloadKind) String ¶ added in v0.4.0
func (wk WorkloadKind) String() string
func (*WorkloadKind) UnmarshalJSON ¶ added in v0.4.0
func (wk *WorkloadKind) UnmarshalJSON(data []byte) error
func (*WorkloadKind) UnmarshalYAML ¶ added in v0.4.0
func (wk *WorkloadKind) UnmarshalYAML(node *yaml.Node) error
type WorkloadShared ¶
type WorkloadShared struct {}
WorkloadShared contains fields shared by all workloads.
type WorkloadSpec ¶ added in v0.4.0
type WorkloadSpec struct { Resources []*Resource `json:"resources" yaml:"resources"` FieldMarkers []*FieldMarker `json:",omitempty" yaml:",omitempty" validate:"omitempty"` CollectionFieldMarkers []*CollectionFieldMarker `json:",omitempty" yaml:",omitempty" validate:"omitempty"` ForCollection bool `json:",omitempty" yaml:",omitempty" validate:"omitempty"` Collection *WorkloadCollection `json:",omitempty" yaml:",omitempty" validate:"omitempty"` APISpecFields *APIFields `json:",omitempty" yaml:",omitempty" validate:"omitempty"` SourceFiles *[]SourceFile `json:",omitempty" yaml:",omitempty" validate:"omitempty"` RBACRules *RBACRules `json:",omitempty" yaml:",omitempty" validate:"omitempty"` }
WorkloadSpec contains information required to generate source code.