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