Merge 1e3fc3331f
into 532a1c432f
This commit is contained in:
commit
f6b84e7501
|
@ -122,9 +122,9 @@ type Reference struct {
|
||||||
Policy *Policy `json:"policy,omitempty"`
|
Policy *Policy `json:"policy,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A TypedReference refers to an object by Name, Kind, and APIVersion. It is
|
// A TypedReference refers to an object by Name, Namespace, Kind, and
|
||||||
// commonly used to reference cluster-scoped objects or objects where the
|
// APIVersion. It is commonly used to reference cluster-scoped objects
|
||||||
// namespace is already known.
|
// and can also be used for namespace-scoped objects.
|
||||||
type TypedReference struct {
|
type TypedReference struct {
|
||||||
// APIVersion of the referenced object.
|
// APIVersion of the referenced object.
|
||||||
APIVersion string `json:"apiVersion"`
|
APIVersion string `json:"apiVersion"`
|
||||||
|
@ -135,6 +135,10 @@ type TypedReference struct {
|
||||||
// Name of the referenced object.
|
// Name of the referenced object.
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Namespace of the referenced object.
|
||||||
|
// +optional
|
||||||
|
Namespace string `json:"namespace,omitempty"`
|
||||||
|
|
||||||
// UID of the referenced object.
|
// UID of the referenced object.
|
||||||
// +optional
|
// +optional
|
||||||
UID types.UID `json:"uid,omitempty"`
|
UID types.UID `json:"uid,omitempty"`
|
||||||
|
|
|
@ -87,6 +87,7 @@ func TypedReferenceTo(o metav1.Object, of schema.GroupVersionKind) *xpv1.TypedRe
|
||||||
APIVersion: v,
|
APIVersion: v,
|
||||||
Kind: k,
|
Kind: k,
|
||||||
Name: o.GetName(),
|
Name: o.GetName(),
|
||||||
|
Namespace: o.GetNamespace(),
|
||||||
UID: o.GetUID(),
|
UID: o.GetUID(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,7 @@ func TestTypedReferenceTo(t *testing.T) {
|
||||||
want: &xpv1.TypedReference{
|
want: &xpv1.TypedReference{
|
||||||
APIVersion: groupVersion,
|
APIVersion: groupVersion,
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
|
Namespace: namespace,
|
||||||
Name: name,
|
Name: name,
|
||||||
UID: uid,
|
UID: uid,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue