Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for resource claims and classes #201

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions apis/core/v1alpha1/bindingphase.go

This file was deleted.

15 changes: 0 additions & 15 deletions apis/core/v1alpha1/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ limitations under the License.

package v1alpha1

// A ReclaimPolicy determines what should happen to managed resources when their
// bound resource claims are deleted.
type ReclaimPolicy string

const (
// ReclaimDelete means both the managed resource and its underlying external
// resource will be deleted when its bound resource claim is deleted.
ReclaimDelete ReclaimPolicy = "Delete"

// ReclaimRetain means the managed resource will retained when its bound
// resource claim is deleted. Furthermore, its underlying external resource
// will be retained when the managed resource is deleted.
ReclaimRetain ReclaimPolicy = "Retain"
)

// A DeletionPolicy determines what should happen to the underlying external
// resource when a managed resource is deleted.
type DeletionPolicy string
Expand Down
113 changes: 0 additions & 113 deletions apis/core/v1alpha1/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,10 @@ package v1alpha1
import (
corev1 "k8s.io/api/core/v1"

// NOTE(negz): Importing this as metav1 appears to break controller-gen's
// deepcopy generation logic. It generates a deepcopy file that omits this
// import and thus does not compile. Importing as v1 fixes this. ¯\_(ツ)_/¯
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
)

// The annotation used to make a resource class the default.
const (
AnnotationDefaultClassKey = "resourceclass.crossplane.io/is-default-class"
AnnotationDefaultClassValue = "true"
)

const (
// ResourceCredentialsSecretEndpointKey is the key inside a connection secret for the connection endpoint
ResourceCredentialsSecretEndpointKey = "endpoint"
Expand Down Expand Up @@ -130,47 +120,6 @@ func (obj *TypedReference) GroupVersionKind() schema.GroupVersionKind {
// GetObjectKind get the ObjectKind of a TypedReference.
func (obj *TypedReference) GetObjectKind() schema.ObjectKind { return obj }

// A ResourceClaimSpec defines the desired state of a resource claim.
// Deprecated. See https://github.com/crossplane/crossplane/issues/1670
type ResourceClaimSpec struct {
// WriteConnectionSecretToReference specifies the name of a Secret, in the
// same namespace as this resource claim, to which any connection details
// for this resource claim should be written. Connection details frequently
// include the endpoint, username, and password required to connect to the
// managed resource bound to this resource claim.
// +optional
WriteConnectionSecretToReference *LocalSecretReference `json:"writeConnectionSecretToRef,omitempty"`

// TODO(negz): Make the below references immutable once set? Doing so means
// we don't have to track what provisioner was used to create a resource.

// A ClassSelector specifies labels that will be used to select a resource
// class for this claim. If multiple classes match the labels one will be
// chosen at random.
// +optional
ClassSelector *v1.LabelSelector `json:"classSelector,omitempty"`

// A ClassReference specifies a resource class that will be used to
// dynamically provision a managed resource when the resource claim is
// created.
// +optional
ClassReference *corev1.ObjectReference `json:"classRef,omitempty"`

// A ResourceReference specifies an existing managed resource, in any
// namespace, to which this resource claim should attempt to bind. Omit the
// resource reference to enable dynamic provisioning using a resource class;
// the resource reference will be automatically populated by Crossplane.
// +optional
ResourceReference *corev1.ObjectReference `json:"resourceRef,omitempty"`
}

// A ResourceClaimStatus represents the observed status of a resource claim.
// Deprecated. See https://github.com/crossplane/crossplane/issues/1670
type ResourceClaimStatus struct {
ConditionedStatus `json:",inline"`
BindingStatus `json:",inline"`
}

// TODO(negz): Rename Resource* to Managed* to clarify that they enable the
// resource.Managed interface.

Expand All @@ -183,20 +132,6 @@ type ResourceSpec struct {
// +optional
WriteConnectionSecretToReference *SecretReference `json:"writeConnectionSecretToRef,omitempty"`

// ClaimReference specifies the resource claim to which this managed
// resource will be bound. ClaimReference is set automatically during
// dynamic provisioning.
// Deprecated. See https://github.com/crossplane/crossplane/issues/1670
//
// +optional
ClaimReference *corev1.ObjectReference `json:"claimRef,omitempty"`

// ClassReference specifies the resource class that was used to dynamically
// provision this managed resource, if any.
// Deprecated. See https://github.com/crossplane/crossplane/issues/1670
// +optional
ClassReference *corev1.ObjectReference `json:"classRef,omitempty"`

// ProviderConfigReference specifies how the provider that will be used to
// create, observe, update, and delete this managed resource should be
// configured.
Expand All @@ -215,59 +150,11 @@ type ResourceSpec struct {
// +optional
// +kubebuilder:validation:Enum=Orphan;Delete
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

// ReclaimPolicy specifies what will happen to this managed resource when
// its resource claim is deleted, and what will happen to the underlying
// external resource when the managed resource is deleted. The "Delete"
// policy causes the managed resource to be deleted when its bound resource
// claim is deleted, and in turn causes the external resource to be deleted
// when its managed resource is deleted. The "Retain" policy causes the
// managed resource to be retained, in binding phase "Released", when its
// resource claim is deleted, and in turn causes the external resource to be
// retained when its managed resource is deleted. The "Delete" policy is
// used when no policy is specified.
//
// Deprecated. DeletionPolicy takes precedence when both are set.
// See https://github.com/crossplane/crossplane-runtime/issues/179.
//
// +optional
// +kubebuilder:validation:Enum=Retain;Delete
ReclaimPolicy ReclaimPolicy `json:"reclaimPolicy,omitempty"`
}

// ResourceStatus represents the observed state of a managed resource.
type ResourceStatus struct {
ConditionedStatus `json:",inline"`
BindingStatus `json:",inline"`
}

// A ClassSpecTemplate defines a template that will be used to create the
// specifications of managed resources dynamically provisioned using a resource
// class.
type ClassSpecTemplate struct {
// WriteConnectionSecretsToNamespace specifies the namespace in which the
// connection secrets of managed resources dynamically provisioned using
// this claim will be created.
WriteConnectionSecretsToNamespace string `json:"writeConnectionSecretsToNamespace"`

// ProviderReference specifies the provider that will be used to create,
// observe, update, and delete managed resources that are dynamically
// provisioned using this resource class.
ProviderReference Reference `json:"providerRef"`

// ReclaimPolicy specifies what will happen to managed resources dynamically
// provisioned using this class when their resource claims are deleted, and
// what will happen to their underlying external resource when they are
// deleted. The "Delete" policy causes the managed resource to be deleted
// when its bound resource claim is deleted, and in turn causes the external
// resource to be deleted when its managed resource is deleted. The "Retain"
// policy causes the managed resource to be retained, in binding phase
// "Released", when its resource claim is deleted, and in turn causes the
// external resource to be retained when its managed resource is deleted.
// The "Delete" policy is used when no policy is specified.
// +optional
// +kubebuilder:validation:Enum=Retain;Delete
ReclaimPolicy ReclaimPolicy `json:"reclaimPolicy,omitempty"`
}

// A ProviderSpec defines the common way to get to the necessary objects to connect
Expand Down
99 changes: 2 additions & 97 deletions apis/core/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading