v1alpha1

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package,register +groupName=apiresource.kcp.io +k8s:openapi-gen=true

Index

Constants

View Source
const (
	ScaleSubResourceName  string = "scale"
	StatusSubResourceName string = "status"
)
View Source
const APIVersionAnnotation = "apiresource.kcp.io/apiVersion"

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: apiresource.GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects.

Functions

func IsAPIResourceImportConditionEquivalent

func IsAPIResourceImportConditionEquivalent(lhs, rhs *APIResourceImportCondition) bool

IsAPIResourceImportConditionEquivalent returns true if the lhs and rhs are equivalent except for times.

func IsNegotiatedAPIResourceConditionEquivalent

func IsNegotiatedAPIResourceConditionEquivalent(lhs, rhs *NegotiatedAPIResourceCondition) bool

IsNegotiatedAPIResourceConditionEquivalent returns true if the lhs and rhs are equivalent except for times.

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource.

Types

type APIResourceImport

type APIResourceImport struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec APIResourceImportSpec `json:"spec,omitempty"`

	// +optional
	Status APIResourceImportStatus `json:"status,omitempty"`
}

APIResourceImport describes an API resource imported from external clusters (either physical or logical) for a given GVR.

+crd +genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=kcp +kubebuilder:printcolumn:name="Location",type="string",JSONPath=`.spec.location`,priority=1 +kubebuilder:printcolumn:name="Schema update strategy",type="string",JSONPath=`.spec.schemaUpdateStrategy`,priority=2 +kubebuilder:printcolumn:name="API Version",type="string",JSONPath=`.metadata.annotations.apiresource\.kcp\.dev/apiVersion`,priority=3 +kubebuilder:printcolumn:name="API Resource",type="string",JSONPath=`.spec.plural`,priority=4 +kubebuilder:printcolumn:name="Compatible",type="string",JSONPath=`.status.conditions[?(@.type=="Compatible")].status`,priority=5 +kubebuilder:printcolumn:name="Available",type="string",JSONPath=`.status.conditions[?(@.type=="Available")].status`,priority=6

func (*APIResourceImport) DeepCopy

func (in *APIResourceImport) DeepCopy() *APIResourceImport

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImport.

func (*APIResourceImport) DeepCopyInto

func (in *APIResourceImport) DeepCopyInto(out *APIResourceImport)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*APIResourceImport) DeepCopyObject

func (in *APIResourceImport) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*APIResourceImport) FindCondition

func (apiResourceImport *APIResourceImport) FindCondition(conditionType APIResourceImportConditionType) *APIResourceImportCondition

FindCondition returns the condition you're looking for or nil.

func (*APIResourceImport) GVR

func (apiResourceImport *APIResourceImport) GVR() metav1.GroupVersionResource

GVR returns the GVR that this APIResourceImport represents.

func (*APIResourceImport) IsConditionFalse

func (apiResourceImport *APIResourceImport) IsConditionFalse(conditionType APIResourceImportConditionType) bool

IsConditionFalse indicates if the condition is present and false.

func (*APIResourceImport) IsConditionPresentAndEqual

func (apiResourceImport *APIResourceImport) IsConditionPresentAndEqual(conditionType APIResourceImportConditionType, status metav1.ConditionStatus) bool

IsConditionPresentAndEqual indicates if the condition is present and equal to the given status.

func (*APIResourceImport) IsConditionTrue

func (apiResourceImport *APIResourceImport) IsConditionTrue(conditionType APIResourceImportConditionType) bool

IsConditionTrue indicates if the condition is present and strictly true.

func (*APIResourceImport) RemoveCondition

func (apiResourceImport *APIResourceImport) RemoveCondition(conditionType APIResourceImportConditionType)

RemoveCondition removes the status condition.

func (*APIResourceImport) SetCondition

func (apiResourceImport *APIResourceImport) SetCondition(newCondition APIResourceImportCondition)

SetCondition sets the status condition. It either overwrites the existing one or creates a new one.

type APIResourceImportCondition

type APIResourceImportCondition struct {
	// Type is the type of the condition. Types include Compatible.
	Type APIResourceImportConditionType `json:"type"`
	// Status is the status of the condition.
	// Can be True, False, Unknown.
	Status metav1.ConditionStatus `json:"status"`
	// Last time the condition transitioned from one status to another.
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`
	// Human-readable message indicating details about last transition.
	// +optional
	Message string `json:"message,omitempty"`
}

APIResourceImportCondition contains details for the current condition of this negotiated api resource.

func (*APIResourceImportCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportCondition.

func (*APIResourceImportCondition) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type APIResourceImportConditionType

type APIResourceImportConditionType string

APIResourceImportConditionType is a valid value for APIResourceImportCondition.Type.

const (
	// Compatible means that this API Resource import is compatible with the current
	// Negotiated API Resource.
	Compatible APIResourceImportConditionType = "Compatible"
	// Available means that this API Resource import is compatible with the current
	// Negotiated API Resource, which has been published as a CRD.
	Available APIResourceImportConditionType = "Available"
)

type APIResourceImportList

type APIResourceImportList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []APIResourceImport `json:"items"`
}

APIResourceImportList is a list of APIResourceImport resources

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*APIResourceImportList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportList.

func (*APIResourceImportList) DeepCopyInto

func (in *APIResourceImportList) DeepCopyInto(out *APIResourceImportList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*APIResourceImportList) DeepCopyObject

func (in *APIResourceImportList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type APIResourceImportSpec

type APIResourceImportSpec struct {
	CommonAPIResourceSpec `json:",inline"`

	// SchemaUpdateStrategy defines the schema update strategy for this API Resource import.
	// Default value is UpdateUnpublished
	//
	// +optional
	SchemaUpdateStrategy SchemaUpdateStrategyType `json:"schemaUpdateStrategy,omitempty"`

	// Locaton the API resource is imported from
	// This field is required
	Location string `json:"location"`
}

APIResourceImportSpec holds the desired state of the APIResourceImport (from the client).

func (*APIResourceImportSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportSpec.

func (*APIResourceImportSpec) DeepCopyInto

func (in *APIResourceImportSpec) DeepCopyInto(out *APIResourceImportSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type APIResourceImportStatus

type APIResourceImportStatus struct {
	Conditions []APIResourceImportCondition `json:"conditions,omitempty"`
}

APIResourceImportStatus communicates the observed state of the APIResourceImport (from the controller).

func (*APIResourceImportStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIResourceImportStatus.

func (*APIResourceImportStatus) DeepCopyInto

func (in *APIResourceImportStatus) DeepCopyInto(out *APIResourceImportStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ColumnDefinition

type ColumnDefinition struct {
	metav1.TableColumnDefinition `json:",inline"`

	JSONPath *string `json:"jsonPath"`
}

func (*ColumnDefinition) DeepCopy

func (in *ColumnDefinition) DeepCopy() *ColumnDefinition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDefinition.

func (*ColumnDefinition) DeepCopyInto

func (in *ColumnDefinition) DeepCopyInto(out *ColumnDefinition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ColumnDefinitions

type ColumnDefinitions []ColumnDefinition

func (ColumnDefinitions) DeepCopy

func (in ColumnDefinitions) DeepCopy() ColumnDefinitions

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ColumnDefinitions.

func (ColumnDefinitions) DeepCopyInto

func (in ColumnDefinitions) DeepCopyInto(out *ColumnDefinitions)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ColumnDefinitions) ImportFromCRDVersion

func (*ColumnDefinitions) ToCustomResourceColumnDefinitions

func (cd *ColumnDefinitions) ToCustomResourceColumnDefinitions() []apiextensionsv1.CustomResourceColumnDefinition

type CommonAPIResourceSpec

type CommonAPIResourceSpec struct {
	GroupVersion GroupVersion `json:"groupVersion"`

	Scope apiextensionsv1.ResourceScope `json:"scope"`

	apiextensionsv1.CustomResourceDefinitionNames `json:",inline"`

	// +required
	// +kubebuilder:pruning:PreserveUnknownFields
	// +structType=atomic
	OpenAPIV3Schema runtime.RawExtension `json:"openAPIV3Schema"`

	// +patchMergeKey=name
	// +patchStrategy=merge
	// +optional
	SubResources SubResources `json:"subResources,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

	// +patchMergeKey=name
	// +patchStrategy=merge
	// +optional
	ColumnDefinitions ColumnDefinitions `json:"columnDefinitions,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
}

CommonAPIResourceSpec holds the common content of both NegotiatedAPIResourceSpec and APIResourceImportSpec.

func (*CommonAPIResourceSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonAPIResourceSpec.

func (*CommonAPIResourceSpec) DeepCopyInto

func (in *CommonAPIResourceSpec) DeepCopyInto(out *CommonAPIResourceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CommonAPIResourceSpec) GetSchema

func (*CommonAPIResourceSpec) SetSchema

type GroupVersion

type GroupVersion struct {
	// +optional
	Group   string `json:"group,omitempty"`
	Version string `json:"version"`
}

func (GroupVersion) APIGroup

func (v GroupVersion) APIGroup() string

func (GroupVersion) APIVersion

func (v GroupVersion) APIVersion() string

func (*GroupVersion) DeepCopy

func (in *GroupVersion) DeepCopy() *GroupVersion

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupVersion.

func (*GroupVersion) DeepCopyInto

func (in *GroupVersion) DeepCopyInto(out *GroupVersion)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NegotiatedAPIResource

type NegotiatedAPIResource struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// +optional
	Spec NegotiatedAPIResourceSpec `json:"spec,omitempty"`

	// +optional
	Status NegotiatedAPIResourceStatus `json:"status,omitempty"`
}

NegotiatedAPIResource describes the result of either the normalization of any number of imports of an API resource from external clusters (either physical or logical), or the manual application of a CRD version for the corresponding GVR.

+crd +genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=kcp +kubebuilder:printcolumn:name="Publish",type="boolean",JSONPath=`.spec.publish`,priority=1 +kubebuilder:printcolumn:name="API Version",type="string",JSONPath=`.metadata.annotations.apiresource\.kcp\.dev/apiVersion`,priority=3 +kubebuilder:printcolumn:name="API Resource",type="string",JSONPath=`.spec.plural`,priority=4 +kubebuilder:printcolumn:name="Published",type="string",JSONPath=`.status.conditions[?(@.type=="Published")].status`,priority=5 +kubebuilder:printcolumn:name="Enforced",type="string",JSONPath=`.status.conditions[?(@.type=="Enforced")].status`,priority=6

func (*NegotiatedAPIResource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResource.

func (*NegotiatedAPIResource) DeepCopyInto

func (in *NegotiatedAPIResource) DeepCopyInto(out *NegotiatedAPIResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NegotiatedAPIResource) DeepCopyObject

func (in *NegotiatedAPIResource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*NegotiatedAPIResource) FindCondition

func (negotiatedApiResource *NegotiatedAPIResource) FindCondition(conditionType NegotiatedAPIResourceConditionType) *NegotiatedAPIResourceCondition

FindCondition returns the condition you're looking for or nil.

func (*NegotiatedAPIResource) GVR

func (negotiatedApiResource *NegotiatedAPIResource) GVR() metav1.GroupVersionResource

GVR returns the GVR that this NegotiatedAPIResource represents.

func (*NegotiatedAPIResource) IsConditionFalse

func (negotiatedApiResource *NegotiatedAPIResource) IsConditionFalse(conditionType NegotiatedAPIResourceConditionType) bool

IsConditionFalse indicates if the condition is present and false.

func (*NegotiatedAPIResource) IsConditionPresentAndEqual

func (negotiatedApiResource *NegotiatedAPIResource) IsConditionPresentAndEqual(conditionType NegotiatedAPIResourceConditionType, status metav1.ConditionStatus) bool

IsConditionPresentAndEqual indicates if the condition is present and equal to the given status.

func (*NegotiatedAPIResource) IsConditionTrue

func (negotiatedApiResource *NegotiatedAPIResource) IsConditionTrue(conditionType NegotiatedAPIResourceConditionType) bool

IsConditionTrue indicates if the condition is present and strictly true.

func (*NegotiatedAPIResource) RemoveCondition

func (negotiatedApiResource *NegotiatedAPIResource) RemoveCondition(conditionType NegotiatedAPIResourceConditionType)

RemoveCondition removes the status condition.

func (*NegotiatedAPIResource) SetCondition

func (negotiatedApiResource *NegotiatedAPIResource) SetCondition(newCondition NegotiatedAPIResourceCondition)

SetCondition sets the status condition. It either overwrites the existing one or creates a new one.

type NegotiatedAPIResourceCondition

type NegotiatedAPIResourceCondition struct {
	// Type is the type of the condition. Types include Submitted, Published, Refused and Enforced.
	Type NegotiatedAPIResourceConditionType `json:"type"`
	// Status is the status of the condition.
	// Can be True, False, Unknown.
	Status metav1.ConditionStatus `json:"status"`
	// Last time the condition transitioned from one status to another.
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`
	// Human-readable message indicating details about last transition.
	// +optional
	Message string `json:"message,omitempty"`
}

NegotiatedAPIResourceCondition contains details for the current condition of this negotiated api resource.

func (*NegotiatedAPIResourceCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceCondition.

func (*NegotiatedAPIResourceCondition) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NegotiatedAPIResourceConditionType

type NegotiatedAPIResourceConditionType string

NegotiatedAPIResourceConditionType is a valid value for NegotiatedAPIResourceCondition.Type.

const (
	// Submitted means that this negotiated API Resource has been submitted
	// to the logical cluster as an applied CRD.
	Submitted NegotiatedAPIResourceConditionType = "Submitted"

	// Published means that this negotiated API Resource has been published
	// to the logical cluster as an installed and accepted CRD
	// If the API Resource has been submitted
	// to the logical cluster as an applied CRD, but the CRD could not be published
	// correctly due to various reasons (non-structural schema, non-accepted names, ...)
	// then the Published condition will be false.
	Published NegotiatedAPIResourceConditionType = "Published"

	// Enforced means that a CRD version for the same GVR has been manually applied,
	// so that the current schema of the negotiated api resource has been forcbly
	// replaced by the schema of the manually-applied CRD.
	// In such a condition, changes in `APIResourceImport`s would not, by any mean,
	// impact the negotiated schema: no LCD will be used, and the schema comparison will only
	// serve to known whether the schema of an API Resource import would be compatible with the
	// enforced CRD schema, and flag the API Resource import (and possibly the corresponding cluster location)
	// accordingly.
	Enforced NegotiatedAPIResourceConditionType = "Enforced"
)

type NegotiatedAPIResourceList

type NegotiatedAPIResourceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []NegotiatedAPIResource `json:"items"`
}

NegotiatedAPIResourceList is a list of NegotiatedAPIResource resources

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*NegotiatedAPIResourceList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceList.

func (*NegotiatedAPIResourceList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NegotiatedAPIResourceList) DeepCopyObject

func (in *NegotiatedAPIResourceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type NegotiatedAPIResourceSpec

type NegotiatedAPIResourceSpec struct {
	CommonAPIResourceSpec `json:",inline"`
	Publish               bool `json:"publish,omitempty"`
}

NegotiatedAPIResourceSpec holds the desired state of the NegotiatedAPIResource (from the client).

func (*NegotiatedAPIResourceSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceSpec.

func (*NegotiatedAPIResourceSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NegotiatedAPIResourceStatus

type NegotiatedAPIResourceStatus struct {
	Conditions []NegotiatedAPIResourceCondition `json:"conditions,omitempty"`
}

NegotiatedAPIResourceStatus communicates the observed state of the NegotiatedAPIResource (from the controller).

func (*NegotiatedAPIResourceStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NegotiatedAPIResourceStatus.

func (*NegotiatedAPIResourceStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SchemaUpdateStrategyType

type SchemaUpdateStrategyType string

SchemaUpdateStrategy defines the strategy for updating the correspondoing negotiated API resource based on the schema of this API Resource Import.

const (
	// UpdateNever means that the corresponding negotiated API Resource will never be modified
	// to take in account the schema of the API resource import.
	// No LCD will be used, and the schema comparison will only
	// serve to known whether the schema of an API Resource import would be compatible with the
	// enforced CRD schema, and flag the API Resource import (and possibly the corresponding cluster location)
	// accordingly.
	UpdateNever SchemaUpdateStrategyType = "UpdateNever"

	// UpdateUnpublished means that the corresponding negotiated API Resource will be modified
	// to take in account the schema of the API resource import, but only for unpublished
	// negotiated API resources.
	// The modifications to the negotiated API resource will be based (if possible) on a LCD schema between
	// the schema of the resource import and the schema of the already-existing negotiated API resource.
	// Of course this is not valid if the negotiated API resource has been "enforced" by applying a CRD for
	// the same GVR manually.
	UpdateUnpublished SchemaUpdateStrategyType = "UpdateUnpublished"

	// UpdateUnpublished means that the corresponding negotiated API Resource will be modified
	// to take in account the schema of the API resource import, even if the already-existing
	// negotiated API resource has already been published (as a CRD).
	// The modifications to the negotiated API resource will be based (if possible) on a LCD schema between
	// the schema of the resource import and the schema of the already-existing negotiated API resource.
	// Of course this is not valid if the negotiated API resource has been "enforced" by applying a CRD for
	// the same GVR manually.
	UpdatePublished SchemaUpdateStrategyType = "UpdatePublished"
)

func (SchemaUpdateStrategyType) CanUpdate

func (strategy SchemaUpdateStrategyType) CanUpdate(negotiatedAPIResourceIsPublished bool) bool

type SubResource

type SubResource struct {
	Name string `json:"name"`
}

func (*SubResource) DeepCopy

func (in *SubResource) DeepCopy() *SubResource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource.

func (*SubResource) DeepCopyInto

func (in *SubResource) DeepCopyInto(out *SubResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SubResources

type SubResources []SubResource

func (*SubResources) Contains

func (sr *SubResources) Contains(name string) bool

func (SubResources) DeepCopy

func (in SubResources) DeepCopy() SubResources

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResources.

func (SubResources) DeepCopyInto

func (in SubResources) DeepCopyInto(out *SubResources)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SubResources) ImportFromCRDVersion

func (sr *SubResources) ImportFromCRDVersion(crdVersion *apiextensionsv1.CustomResourceDefinitionVersion) *SubResources

Jump to

Keyboard shortcuts

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