Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopyObject ¶
DeepCopyObject is an implementation of the receiver method required for implementing runtime.Object. It should be used in your own runtime.Object implementations if you do not wish to implement custom behavior. Example:
func (c *CustomObject) DeepCopyObject() runtime.Object { return crd.DeepCopyObject(c) }
Types ¶
type Base ¶
type Base[SpecType any] struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec SpecType `json:"spec"` }
Base is a struct which describes a basic CRD, and implements runtime.Object. SpecType should be the struct that represents the spec in the definition. It cannot be used on its own, as the name of the CRD in kubernetes must exactly match the name of struct. Instead, this struct can be used as a component of a new named struct, for examples:
type MyCustomResource struct { crd.Base[MyCustomResourceSpec] }
func (*Base[T]) DeepCopyObject ¶
DeepCopyObject is implemented for Base so it will implement runtime.Object. DeepCopyObject here just calls crd.DeepCopyObject on itself.
type BaseStatus ¶
type BaseStatus[SpecType, StatusType any] struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec SpecType `json:"spec"` Status StatusType `json:"status"` }
BaseStatus extends Base by including a Status subresource. This should be used if your kubernetes CRD includes the status subresource and you want to be able to view/modify it. Usage is identical to Base
func (*BaseStatus[T, S]) DeepCopyObject ¶
func (b *BaseStatus[T, S]) DeepCopyObject() runtime.Object
DeepCopyObject is implemented for Base so it will implement runtime.Object. DeepCopyObject here just calls crd.DeepCopyObject on itself.
type CustomResourceDefinition ¶
type CustomResourceDefinition struct { metav1.TypeMeta `json:",inline" yaml:",inline"` metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"` Spec CustomResourceDefinitionSpec `json:"spec"` }
CustomResourceDefinition is the kubernetes-API-compliant representation of a Custom Resource Definition
func (*CustomResourceDefinition) DeepCopyObject ¶
func (crd *CustomResourceDefinition) DeepCopyObject() runtime.Object
DeepCopyObject implements runtime.Object.
type CustomResourceDefinitionList ¶
type CustomResourceDefinitionList struct { ListBase[CustomResourceDefinition] }
CustomResourceDefinitionList is the kubernetes-API-compliant representation of a list of CustomResourceDefinitions
type CustomResourceDefinitionSpec ¶
type CustomResourceDefinitionSpec struct { Group string `json:"group" yaml:"group"` Versions []CustomResourceDefinitionSpecVersion `json:"versions" yaml:"versions"` Names CustomResourceDefinitionSpecNames `json:"names" yaml:"names"` Scope string `json:"scope" yaml:"scope"` }
CustomResourceDefinitionSpec is the body or spec of a kubernetes Custom Resource Definition
type CustomResourceDefinitionSpecNames ¶
type CustomResourceDefinitionSpecNames struct { Kind string `json:"kind" yaml:"kind"` Plural string `json:"plural" yaml:"plural"` }
CustomResourceDefinitionSpecNames is the struct representing the names (kind and plural) of a kubernetes CRD
type CustomResourceDefinitionSpecVersion ¶
type CustomResourceDefinitionSpecVersion struct { Name string `json:"name" yaml:"name"` Served bool `json:"served" yaml:"served"` Storage bool `json:"storage" yaml:"storage"` Schema map[string]any `json:"schema" yaml:"schema"` Subresources map[string]any `json:"subresources,omitempty" yaml:"subresources,omitempty"` }
CustomResourceDefinitionSpecVersion is the representation of a specific version of a CRD, as part of the overall spec
type Kind ¶
type Kind struct { GrafanaKind kindsys.Kind Object runtime.Object // singular type ObjectList runtime.Object // list type Schema apiextensionsv1.CustomResourceDefinition }
func (Kind) GVK ¶
func (crd Kind) GVK() k8schema.GroupVersionKind
TODO this could probably be done in CUE/framework
type ListBase ¶
type ListBase[ItemType any] struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []ItemType `json:"items"` }
ListBase is a struct which describes a list of CRDs, and implements runtime.Object. ItemType should be the CRD type being listed (NOT the model). It cannot be used on its own, as the struct name must exactly match `<name of kubernetes CRD>List`. Instead, this struct can be used as a component of a new named struct, for examples:
type MyCustomResourceList struct { crd.Base[MyCustomResource] }
func (*ListBase[T]) DeepCopyObject ¶
DeepCopyObject is implemented for Base so it will implement runtime.Object. DeepCopyObject here just calls crd.DeepCopyObject on itself.