resource

package
v3.15.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 18

Documentation

Index

Constants

View Source
const V1 = "v1"
View Source
const V1beta1 = "v1beta1"

Variables

This section is empty.

Functions

func APIPackagePath

func APIPackagePath(repo, group, version string, multiGroup bool) string

APIPackagePath returns the default path

func APIPackagePathLegacy added in v3.9.0

func APIPackagePathLegacy(repo, group, version string, multiGroup bool) string

APIPackagePathLegacy returns the default path

func RegularPlural

func RegularPlural(singular string) string

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

func (api API) Copy() API

Copy returns a deep copy of the API that can be safely modified without affecting the original.

func (API) IsEmpty

func (api API) IsEmpty() bool

IsEmpty returns if the API's fields all contain zero-values.

func (*API) Update

func (api *API) Update(other *API) error

Update combines fields of the APIs of two resources.

func (API) Validate

func (api API) Validate() error

Validate checks that the API is valid.

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) IsEqualTo

func (gvk GVK) IsEqualTo(other GVK) bool

IsEqualTo compares two GVK objects.

func (GVK) QualifiedGroup

func (gvk GVK) QualifiedGroup() string

QualifiedGroup returns the fully qualified group name with the available information.

func (GVK) Validate

func (gvk GVK) Validate() error

Validate checks that the GVK is valid.

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

func (r Resource) Copy() Resource

Copy returns a deep copy of the Resource that can be safely modified without affecting the original.

func (Resource) HasAPI

func (r Resource) HasAPI() bool

HasAPI returns true if the resource has an associated API.

func (Resource) HasController

func (r Resource) HasController() bool

HasController returns true if the resource has an associated controller.

func (Resource) HasConversionWebhook

func (r Resource) HasConversionWebhook() bool

HasConversionWebhook returns true if the resource has an associated conversion webhook.

func (Resource) HasDefaultingWebhook

func (r Resource) HasDefaultingWebhook() bool

HasDefaultingWebhook returns true if the resource has an associated defaulting webhook.

func (Resource) HasValidationWebhook

func (r Resource) HasValidationWebhook() bool

HasValidationWebhook returns true if the resource has an associated validation webhook.

func (Resource) ImportAlias

func (r Resource) ImportAlias() string

ImportAlias returns a identifier usable as an import alias for this resource.

func (Resource) IsRegularPlural

func (r Resource) IsRegularPlural() bool

IsRegularPlural returns true if the plural is the regular plural form for the kind.

func (Resource) PackageName

func (r Resource) PackageName() string

PackageName returns a name valid to be used por go packages.

func (Resource) Replacer

func (r Resource) Replacer() *strings.Replacer

Replacer returns a strings.Replacer that replaces resource keywords with values.

func (*Resource) Update

func (r *Resource) Update(other Resource) error

Update combines fields of two resources that have matching GVK favoring the receiver's values.

func (Resource) Validate

func (r Resource) Validate() error

Validate checks that the Resource is valid.

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

func (webhooks Webhooks) Copy() Webhooks

Copy returns a deep copy of the API that can be safely modified without affecting the original.

func (Webhooks) IsEmpty

func (webhooks Webhooks) IsEmpty() bool

IsEmpty returns if the Webhooks' fields all contain zero-values.

func (*Webhooks) Update

func (webhooks *Webhooks) Update(other *Webhooks) error

Update combines fields of the webhooks of two resources.

func (Webhooks) Validate

func (webhooks Webhooks) Validate() error

Validate checks that the Webhooks is valid.

Jump to

Keyboard shortcuts

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