Documentation ¶
Index ¶
- Constants
- func APIPackagePath(repo, group, version string, multiGroup bool) string
- func APIPackagePathLegacy(repo, group, version string, multiGroup bool) string
- func RegularPlural(singular string) string
- type API
- type GVK
- type Resource
- func (r Resource) Copy() Resource
- func (r Resource) HasAPI() bool
- func (r Resource) HasController() bool
- func (r Resource) HasConversionWebhook() bool
- func (r Resource) HasDefaultingWebhook() bool
- func (r Resource) HasValidationWebhook() bool
- func (r Resource) ImportAlias() string
- func (r Resource) IsRegularPlural() bool
- func (r Resource) PackageName() string
- func (r Resource) Replacer() *strings.Replacer
- func (r *Resource) Update(other Resource) error
- func (r Resource) Validate() error
- type Webhooks
Constants ¶
const V1 = "v1"
const V1beta1 = "v1beta1"
Variables ¶
This section is empty.
Functions ¶
func APIPackagePath ¶
APIPackagePath returns the default path
func APIPackagePathLegacy ¶
APIPackagePathLegacy returns the default path
func RegularPlural ¶
RegularPlural returns a default plural form when none was specified
Types ¶
type API ¶
type API struct { // CRDVersion holds the CustomResourceDefinition API version used for the resource. CRDVersion string `json:"crdVersion,omitempty"` // Namespaced is true if the API is namespaced. Namespaced bool `json:"namespaced,omitempty"` }
API contains information about scaffolded APIs
func (API) Copy ¶
Copy returns a deep copy of the API that can be safely modified without affecting the original.
type GVK ¶
type GVK struct { Group string `json:"group,omitempty"` Domain string `json:"domain,omitempty"` Version string `json:"version"` Kind string `json:"kind"` }
GVK stores the Group - Version - Kind triplet that uniquely identifies a resource. In kubebuilder, the k8s fully qualified group is stored as Group and Domain to improve UX.
func (GVK) QualifiedGroup ¶
QualifiedGroup returns the fully qualified group name with the available information.
type Resource ¶
type Resource struct { // GVK contains the resource's Group-Version-Kind triplet. GVK `json:",inline"` // Plural is the resource's kind plural form. Plural string `json:"plural,omitempty"` // Path is the path to the go package where the types are defined. Path string `json:"path,omitempty"` // API holds the information related to the resource API. API *API `json:"api,omitempty"` // Controller specifies if a controller has been scaffolded. Controller bool `json:"controller,omitempty"` // Webhooks holds the information related to the associated webhooks. Webhooks *Webhooks `json:"webhooks,omitempty"` }
Resource contains the information required to scaffold files for a resource.
func (Resource) Copy ¶
Copy returns a deep copy of the Resource that can be safely modified without affecting the original.
func (Resource) HasController ¶
HasController returns true if the resource has an associated controller.
func (Resource) HasConversionWebhook ¶
HasConversionWebhook returns true if the resource has an associated conversion webhook.
func (Resource) HasDefaultingWebhook ¶
HasDefaultingWebhook returns true if the resource has an associated defaulting webhook.
func (Resource) HasValidationWebhook ¶
HasValidationWebhook returns true if the resource has an associated validation webhook.
func (Resource) ImportAlias ¶
ImportAlias returns a identifier usable as an import alias for this resource.
func (Resource) IsRegularPlural ¶
IsRegularPlural returns true if the plural is the regular plural form for the kind.
func (Resource) PackageName ¶
PackageName returns a name valid to be used por go packages.
func (Resource) Replacer ¶
Replacer returns a strings.Replacer that replaces resource keywords with values.
type Webhooks ¶
type Webhooks struct { // WebhookVersion holds the {Validating,Mutating}WebhookConfiguration API version used for the resource. WebhookVersion string `json:"webhookVersion,omitempty"` // Defaulting specifies if a defaulting webhook is associated to the resource. Defaulting bool `json:"defaulting,omitempty"` // Validation specifies if a validation webhook is associated to the resource. Validation bool `json:"validation,omitempty"` // Conversion specifies if a conversion webhook is associated to the resource. Conversion bool `json:"conversion,omitempty"` }
Webhooks contains information about scaffolded webhooks
func (Webhooks) Copy ¶
Copy returns a deep copy of the API that can be safely modified without affecting the original.