Add Reference and Selector types
These will be used for cross resource references, though they could also be used in other contexts. Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
parent
bc4cf86077
commit
6bbfa9e0d6
|
@ -83,6 +83,12 @@ type SecretKeySelector struct {
|
||||||
Key string `json:"key"`
|
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
|
// A TypedReference refers to an object by Name, Kind, and APIVersion. It is
|
||||||
// commonly used to reference cluster-scoped objects or objects where the
|
// commonly used to reference cluster-scoped objects or objects where the
|
||||||
// namespace is already known.
|
// namespace is already known.
|
||||||
|
@ -101,6 +107,16 @@ type TypedReference struct {
|
||||||
UID types.UID `json:"uid,omitempty"`
|
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.
|
// SetGroupVersionKind sets the Kind and APIVersion of a TypedReference.
|
||||||
func (obj *TypedReference) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
func (obj *TypedReference) SetGroupVersionKind(gvk schema.GroupVersionKind) {
|
||||||
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
|
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
|
||||||
|
|
|
@ -133,6 +133,21 @@ func (in *ProviderSpec) DeepCopy() *ProviderSpec {
|
||||||
return out
|
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.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceClaimSpec) DeepCopyInto(out *ResourceClaimSpec) {
|
func (in *ResourceClaimSpec) DeepCopyInto(out *ResourceClaimSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
@ -268,6 +283,33 @@ func (in *SecretReference) DeepCopy() *SecretReference {
|
||||||
return out
|
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.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *TargetSpec) DeepCopyInto(out *TargetSpec) {
|
func (in *TargetSpec) DeepCopyInto(out *TargetSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
Loading…
Reference in New Issue