diff --git a/apis/core/v1alpha1/resource.go b/apis/core/v1alpha1/resource.go index 2d7d639..feadc9d 100644 --- a/apis/core/v1alpha1/resource.go +++ b/apis/core/v1alpha1/resource.go @@ -83,6 +83,12 @@ type SecretKeySelector struct { Key string `json:"key"` } +// A Reference to a named object. +type Reference struct { + // Name of the referenced object. + Name string `json:"name"` +} + // A TypedReference refers to an object by Name, Kind, and APIVersion. It is // commonly used to reference cluster-scoped objects or objects where the // namespace is already known. @@ -101,6 +107,16 @@ type TypedReference struct { UID types.UID `json:"uid,omitempty"` } +// A Selector selects an object. +type Selector struct { + // MatchLabels ensures an object with matching labels is selected. + MatchLabels map[string]string `json:"matchLabels,omitempty"` + + // MatchControllerRef ensures an object with the same controller reference + // as the selecting object is selected. + MatchControllerRef *bool `json:"matchControllerRef,omitempty"` +} + // SetGroupVersionKind sets the Kind and APIVersion of a TypedReference. func (obj *TypedReference) SetGroupVersionKind(gvk schema.GroupVersionKind) { obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() diff --git a/apis/core/v1alpha1/zz_generated.deepcopy.go b/apis/core/v1alpha1/zz_generated.deepcopy.go index 0cf2856..9d816a0 100644 --- a/apis/core/v1alpha1/zz_generated.deepcopy.go +++ b/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -133,6 +133,21 @@ func (in *ProviderSpec) DeepCopy() *ProviderSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reference) DeepCopyInto(out *Reference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reference. +func (in *Reference) DeepCopy() *Reference { + if in == nil { + return nil + } + out := new(Reference) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceClaimSpec) DeepCopyInto(out *ResourceClaimSpec) { *out = *in @@ -268,6 +283,33 @@ func (in *SecretReference) DeepCopy() *SecretReference { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Selector) DeepCopyInto(out *Selector) { + *out = *in + if in.MatchLabels != nil { + in, out := &in.MatchLabels, &out.MatchLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.MatchControllerRef != nil { + in, out := &in.MatchControllerRef, &out.MatchControllerRef + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector. +func (in *Selector) DeepCopy() *Selector { + if in == nil { + return nil + } + out := new(Selector) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetSpec) DeepCopyInto(out *TargetSpec) { *out = *in