mirror of https://github.com/k3s-io/k3s
Merge pull request #28921 from jianhuiz/federation-cluster-in-meta
Automatic merge from submit-queue Add Cluster field in ObjectMeta There will be no sub-rs, but add `Cluster` field to the ObjectMeta (for all the objects) "To distinguish the object at the federation level from it's constituents at the cluster level we will add a "Cluster" field to the metadata of all objects (where the federation itself will also have a cluster identifier). That way it is possible to list, interact with, and distinguish between the objects either at the federation level or at the individual cluster level based on the cluster identifier. " @quinton-hoole @nikhiljindal @deepak-vij @mfanjie @huangyuqi [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()pull/6/head
commit
4b949093c2
|
@ -1114,6 +1114,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -175,6 +175,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -175,6 +175,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1117,6 +1117,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1117,6 +1117,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -827,6 +827,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8300,6 +8300,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1114,6 +1114,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2787,6 +2787,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15960,6 +15960,10 @@
|
|||
"type": "string"
|
||||
},
|
||||
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
|
||||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -914,7 +914,7 @@ func (x codecSelfer1234) decSliceTestType(v *[]TestType, d *codec1978.Decoder) {
|
|||
|
||||
yyrg72 := len(yyv72) > 0
|
||||
yyv272 := yyv72
|
||||
yyrl72, yyrt72 = z.DecInferLen(yyl72, z.DecBasicHandle().MaxInitLen, 256)
|
||||
yyrl72, yyrt72 = z.DecInferLen(yyl72, z.DecBasicHandle().MaxInitLen, 272)
|
||||
if yyrt72 {
|
||||
if yyrl72 <= cap(yyv72) {
|
||||
yyv72 = yyv72[:yyrl72]
|
||||
|
|
|
@ -914,7 +914,7 @@ func (x codecSelfer1234) decSliceTestType(v *[]TestType, d *codec1978.Decoder) {
|
|||
|
||||
yyrg72 := len(yyv72) > 0
|
||||
yyv272 := yyv72
|
||||
yyrl72, yyrt72 = z.DecInferLen(yyl72, z.DecBasicHandle().MaxInitLen, 256)
|
||||
yyrl72, yyrt72 = z.DecInferLen(yyl72, z.DecBasicHandle().MaxInitLen, 272)
|
||||
if yyrt72 {
|
||||
if yyrl72 <= cap(yyv72) {
|
||||
yyv72 = yyv72[:yyrl72]
|
||||
|
|
|
@ -1194,6 +1194,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">clusterName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -1327,7 +1334,7 @@ Examples:<br>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-07-19 08:57:41 UTC
|
||||
Last updated 2016-08-23 04:34:20 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1763,6 +1763,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">clusterName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -4207,7 +4214,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-08-19 22:24:38 UTC
|
||||
Last updated 2016-08-23 04:34:09 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1171,6 +1171,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">clusterName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -1304,7 +1311,7 @@ Examples:<br>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-08-18 20:08:14 UTC
|
||||
Last updated 2016-08-23 04:34:31 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1802,6 +1802,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">clusterName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -6602,7 +6609,7 @@ Both these may change in the future. Incoming requests are matched against the h
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-08-21 13:01:49 UTC
|
||||
Last updated 2016-08-23 04:33:54 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -2026,6 +2026,13 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">clusterName</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -8347,7 +8354,7 @@ The resulting set of endpoints can be viewed as:<br>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-08-22 23:33:31 UTC
|
||||
Last updated 2016-08-23 04:33:41 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -2778,7 +2778,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
|
|||
|
||||
yyrg222 := len(yyv222) > 0
|
||||
yyv2222 := yyv222
|
||||
yyrl222, yyrt222 = z.DecInferLen(yyl222, z.DecBasicHandle().MaxInitLen, 336)
|
||||
yyrl222, yyrt222 = z.DecInferLen(yyl222, z.DecBasicHandle().MaxInitLen, 352)
|
||||
if yyrt222 {
|
||||
if yyrl222 <= cap(yyv222) {
|
||||
yyv222 = yyv222[:yyrl222]
|
||||
|
|
|
@ -2253,7 +2253,7 @@ func (x codecSelfer1234) decSliceCluster(v *[]Cluster, d *codec1978.Decoder) {
|
|||
|
||||
yyrg179 := len(yyv179) > 0
|
||||
yyv2179 := yyv179
|
||||
yyrl179, yyrt179 = z.DecInferLen(yyl179, z.DecBasicHandle().MaxInitLen, 336)
|
||||
yyrl179, yyrt179 = z.DecInferLen(yyl179, z.DecBasicHandle().MaxInitLen, 352)
|
||||
if yyrt179 {
|
||||
if yyrl179 <= cap(yyv179) {
|
||||
yyv179 = yyv179[:yyrl179]
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
"k8s.io/kubernetes/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
var ValidateClusterName = validation.NameIsDNS1035Label
|
||||
|
||||
func ValidateClusterSpec(spec *federation.ClusterSpec, fieldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
// address is required.
|
||||
|
@ -34,7 +32,7 @@ func ValidateClusterSpec(spec *federation.ClusterSpec, fieldPath *field.Path) fi
|
|||
}
|
||||
|
||||
func ValidateCluster(cluster *federation.Cluster) field.ErrorList {
|
||||
allErrs := validation.ValidateObjectMeta(&cluster.ObjectMeta, false, ValidateClusterName, field.NewPath("metadata"))
|
||||
allErrs := validation.ValidateObjectMeta(&cluster.ObjectMeta, false, validation.ValidateClusterName, field.NewPath("metadata"))
|
||||
allErrs = append(allErrs, ValidateClusterSpec(&cluster.Spec, field.NewPath("spec"))...)
|
||||
return allErrs
|
||||
}
|
||||
|
|
|
@ -131,3 +131,10 @@ func (meta *ObjectMeta) SetOwnerReferences(references []metatypes.OwnerReference
|
|||
}
|
||||
meta.OwnerReferences = newReferences
|
||||
}
|
||||
|
||||
func (meta *ObjectMeta) GetClusterName() string {
|
||||
return meta.ClusterName
|
||||
}
|
||||
func (meta *ObjectMeta) SetClusterName(clusterName string) {
|
||||
meta.ClusterName = clusterName
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ type Object interface {
|
|||
SetFinalizers(finalizers []string)
|
||||
GetOwnerReferences() []metatypes.OwnerReference
|
||||
SetOwnerReferences([]metatypes.OwnerReference)
|
||||
GetClusterName() string
|
||||
SetClusterName(clusterName string)
|
||||
}
|
||||
|
||||
var _ Object = &runtime.Unstructured{}
|
||||
|
|
|
@ -71,6 +71,9 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx api.Context, obj runtime.Obje
|
|||
api.FillObjectMetaSystemFields(ctx, objectMeta)
|
||||
api.GenerateName(strategy, objectMeta)
|
||||
|
||||
// ClusterName is ignored and should not be saved
|
||||
objectMeta.ClusterName = ""
|
||||
|
||||
if errs := strategy.Validate(ctx, obj); len(errs) > 0 {
|
||||
return errors.NewInvalid(kind.GroupKind(), objectMeta.Name, errs)
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ func (t *Tester) TestCreate(valid runtime.Object, createFn CreateFunc, getFn Get
|
|||
}
|
||||
t.testCreateInvokesValidation(invalid...)
|
||||
t.testCreateValidatesNames(copyOrDie(valid))
|
||||
t.testCreateIgnoreClusterName(copyOrDie(valid))
|
||||
}
|
||||
|
||||
// Test updating an object.
|
||||
|
@ -174,6 +175,7 @@ func (t *Tester) TestUpdate(valid runtime.Object, createFn CreateFunc, getFn Get
|
|||
t.testUpdateRetrievesOldObject(copyOrDie(valid), createFn, getFn)
|
||||
t.testUpdatePropagatesUpdatedObjectError(copyOrDie(valid), createFn, getFn)
|
||||
t.testUpdateIgnoreGenerationUpdates(copyOrDie(valid), createFn, getFn)
|
||||
t.testUpdateIgnoreClusterName(copyOrDie(valid), createFn, getFn)
|
||||
}
|
||||
|
||||
// Test deleting an object.
|
||||
|
@ -430,6 +432,22 @@ func (t *Tester) testCreateResetsUserData(valid runtime.Object) {
|
|||
}
|
||||
}
|
||||
|
||||
func (t *Tester) testCreateIgnoreClusterName(valid runtime.Object) {
|
||||
objectMeta := t.getObjectMetaOrFail(valid)
|
||||
objectMeta.Name = t.namer(3)
|
||||
objectMeta.ClusterName = "clustername-to-ignore"
|
||||
|
||||
obj, err := t.storage.(rest.Creater).Create(t.TestContext(), copyOrDie(valid))
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
defer t.delete(t.TestContext(), obj)
|
||||
createdObjectMeta := t.getObjectMetaOrFail(obj)
|
||||
if len(createdObjectMeta.ClusterName) != 0 {
|
||||
t.Errorf("Expected empty clusterName on created object, got '%v'", createdObjectMeta.ClusterName)
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Update tests.
|
||||
|
||||
|
@ -691,6 +709,41 @@ func (t *Tester) testUpdateRejectsMismatchedNamespace(obj runtime.Object, create
|
|||
}
|
||||
}
|
||||
|
||||
func (t *Tester) testUpdateIgnoreClusterName(obj runtime.Object, createFn CreateFunc, getFn GetFunc) {
|
||||
ctx := t.TestContext()
|
||||
|
||||
foo := copyOrDie(obj)
|
||||
name := t.namer(9)
|
||||
t.setObjectMeta(foo, name)
|
||||
|
||||
if err := createFn(ctx, foo); err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
storedFoo, err := getFn(ctx, foo)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
older := copyOrDie(storedFoo)
|
||||
olderMeta := t.getObjectMetaOrFail(older)
|
||||
olderMeta.ClusterName = "clustername-to-ignore"
|
||||
|
||||
_, _, err = t.storage.(rest.Updater).Update(t.TestContext(), olderMeta.Name, rest.DefaultUpdatedObjectInfo(older, api.Scheme))
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
updatedFoo, err := getFn(ctx, older)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if clusterName := t.getObjectMetaOrFail(updatedFoo).ClusterName; len(clusterName) != 0 {
|
||||
t.Errorf("Unexpected clusterName update: expected empty, got %v", clusterName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Deletion tests.
|
||||
|
||||
|
|
|
@ -95,6 +95,9 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx api.Context, obj, old runtime
|
|||
|
||||
strategy.PrepareForUpdate(ctx, obj, old)
|
||||
|
||||
// ClusterName is ignored and should not be saved
|
||||
objectMeta.ClusterName = ""
|
||||
|
||||
// Ensure some common fields, like UID, are validated for all resources.
|
||||
errs, err := validateCommonFields(obj, old)
|
||||
if err != nil {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -149,6 +149,11 @@ type ObjectMeta struct {
|
|||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
|
||||
// The name of the cluster which the object belongs to.
|
||||
// This is used to distinguish resources with same name and namespace in different clusters.
|
||||
// This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
|
||||
ClusterName string `json:"clusterName,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1525,6 +1525,11 @@ message ObjectMeta {
|
|||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
repeated string finalizers = 14;
|
||||
|
||||
// The name of the cluster which the object belongs to.
|
||||
// This is used to distinguish resources with same name and namespace in different clusters.
|
||||
// This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
|
||||
optional string clusterName = 15;
|
||||
}
|
||||
|
||||
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||
|
|
|
@ -83,3 +83,10 @@ func (meta *ObjectMeta) SetOwnerReferences(references []metatypes.OwnerReference
|
|||
}
|
||||
meta.OwnerReferences = newReferences
|
||||
}
|
||||
|
||||
func (meta *ObjectMeta) GetClusterName() string {
|
||||
return meta.ClusterName
|
||||
}
|
||||
func (meta *ObjectMeta) SetClusterName(clusterName string) {
|
||||
meta.ClusterName = clusterName
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -186,6 +186,11 @@ type ObjectMeta struct {
|
|||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
|
||||
|
||||
// The name of the cluster which the object belongs to.
|
||||
// This is used to distinguish resources with same name and namespace in different clusters.
|
||||
// This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.
|
||||
ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
|
@ -956,6 +956,7 @@ var map_ObjectMeta = map[string]string{
|
|||
"annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://releases.k8s.io/HEAD/docs/user-guide/annotations.md",
|
||||
"ownerReferences": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.",
|
||||
"finalizers": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.",
|
||||
"clusterName": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.",
|
||||
}
|
||||
|
||||
func (ObjectMeta) SwaggerDoc() map[string]string {
|
||||
|
|
|
@ -3677,6 +3677,7 @@ func autoConvert_v1_ObjectMeta_To_api_ObjectMeta(in *ObjectMeta, out *api.Object
|
|||
out.OwnerReferences = nil
|
||||
}
|
||||
out.Finalizers = in.Finalizers
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -3711,6 +3712,7 @@ func autoConvert_api_ObjectMeta_To_v1_ObjectMeta(in *api.ObjectMeta, out *Object
|
|||
out.OwnerReferences = nil
|
||||
}
|
||||
out.Finalizers = in.Finalizers
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1889,6 +1889,7 @@ func DeepCopy_v1_ObjectMeta(in interface{}, out interface{}, c *conversion.Clone
|
|||
} else {
|
||||
out.Finalizers = nil
|
||||
}
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,6 +279,9 @@ var ValidateServiceAccountName = NameIsDNSSubdomain
|
|||
// trailing dashes are allowed.
|
||||
var ValidateEndpointsName = NameIsDNSSubdomain
|
||||
|
||||
// ValidateClusterName can be used to check whether the given cluster name is valid.
|
||||
var ValidateClusterName = NameIsDNS1035Label
|
||||
|
||||
// NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.
|
||||
func NameIsDNSSubdomain(name string, prefix bool) []string {
|
||||
if prefix {
|
||||
|
@ -364,6 +367,11 @@ func ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn Val
|
|||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "not allowed on this type"))
|
||||
}
|
||||
}
|
||||
if len(meta.ClusterName) != 0 {
|
||||
for _, msg := range ValidateClusterName(meta.ClusterName, false) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("clusterName"), meta.ClusterName, msg))
|
||||
}
|
||||
}
|
||||
allErrs = append(allErrs, ValidateNonnegativeField(meta.Generation, fldPath.Child("generation"))...)
|
||||
allErrs = append(allErrs, unversionedvalidation.ValidateLabels(meta.Labels, fldPath.Child("labels"))...)
|
||||
allErrs = append(allErrs, ValidateAnnotations(meta.Annotations, fldPath.Child("annotations"))...)
|
||||
|
@ -425,6 +433,7 @@ func ValidateObjectMetaUpdate(newMeta, oldMeta *api.ObjectMeta, fldPath *field.P
|
|||
allErrs = append(allErrs, ValidateImmutableField(newMeta.Namespace, oldMeta.Namespace, fldPath.Child("namespace"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.UID, oldMeta.UID, fldPath.Child("uid"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.CreationTimestamp, oldMeta.CreationTimestamp, fldPath.Child("creationTimestamp"))...)
|
||||
allErrs = append(allErrs, ValidateImmutableField(newMeta.ClusterName, oldMeta.ClusterName, fldPath.Child("clusterName"))...)
|
||||
|
||||
allErrs = append(allErrs, unversionedvalidation.ValidateLabels(newMeta.Labels, fldPath.Child("labels"))...)
|
||||
allErrs = append(allErrs, ValidateAnnotations(newMeta.Annotations, fldPath.Child("annotations"))...)
|
||||
|
|
|
@ -1947,6 +1947,7 @@ func DeepCopy_api_ObjectMeta(in interface{}, out interface{}, c *conversion.Clon
|
|||
} else {
|
||||
out.Finalizers = nil
|
||||
}
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1431,7 +1431,7 @@ func (x codecSelfer1234) decSliceapi_PersistentVolumeClaim(v *[]pkg2_api.Persist
|
|||
|
||||
yyrg121 := len(yyv121) > 0
|
||||
yyv2121 := yyv121
|
||||
yyrl121, yyrt121 = z.DecInferLen(yyl121, z.DecBasicHandle().MaxInitLen, 352)
|
||||
yyrl121, yyrt121 = z.DecInferLen(yyl121, z.DecBasicHandle().MaxInitLen, 368)
|
||||
if yyrt121 {
|
||||
if yyrl121 <= cap(yyv121) {
|
||||
yyv121 = yyv121[:yyrl121]
|
||||
|
@ -1547,7 +1547,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
|||
|
||||
yyrg127 := len(yyv127) > 0
|
||||
yyv2127 := yyv127
|
||||
yyrl127, yyrt127 = z.DecInferLen(yyl127, z.DecBasicHandle().MaxInitLen, 744)
|
||||
yyrl127, yyrt127 = z.DecInferLen(yyl127, z.DecBasicHandle().MaxInitLen, 776)
|
||||
if yyrt127 {
|
||||
if yyrl127 <= cap(yyv127) {
|
||||
yyv127 = yyv127[:yyrl127]
|
||||
|
|
|
@ -1461,7 +1461,7 @@ func (x codecSelfer1234) decSlicev1_PersistentVolumeClaim(v *[]pkg2_v1.Persisten
|
|||
|
||||
yyrg125 := len(yyv125) > 0
|
||||
yyv2125 := yyv125
|
||||
yyrl125, yyrt125 = z.DecInferLen(yyl125, z.DecBasicHandle().MaxInitLen, 352)
|
||||
yyrl125, yyrt125 = z.DecInferLen(yyl125, z.DecBasicHandle().MaxInitLen, 368)
|
||||
if yyrt125 {
|
||||
if yyrl125 <= cap(yyv125) {
|
||||
yyv125 = yyv125[:yyrl125]
|
||||
|
@ -1577,7 +1577,7 @@ func (x codecSelfer1234) decSlicePetSet(v *[]PetSet, d *codec1978.Decoder) {
|
|||
|
||||
yyrg131 := len(yyv131) > 0
|
||||
yyv2131 := yyv131
|
||||
yyrl131, yyrt131 = z.DecInferLen(yyl131, z.DecBasicHandle().MaxInitLen, 768)
|
||||
yyrl131, yyrt131 = z.DecInferLen(yyl131, z.DecBasicHandle().MaxInitLen, 800)
|
||||
if yyrt131 {
|
||||
if yyrl131 <= cap(yyv131) {
|
||||
yyv131 = yyv131[:yyrl131]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2575,7 +2575,7 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos
|
|||
|
||||
yyrg220 := len(yyv220) > 0
|
||||
yyv2220 := yyv220
|
||||
yyrl220, yyrt220 = z.DecInferLen(yyl220, z.DecBasicHandle().MaxInitLen, 344)
|
||||
yyrl220, yyrt220 = z.DecInferLen(yyl220, z.DecBasicHandle().MaxInitLen, 360)
|
||||
if yyrt220 {
|
||||
if yyrl220 <= cap(yyv220) {
|
||||
yyv220 = yyv220[:yyrl220]
|
||||
|
|
|
@ -2575,7 +2575,7 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos
|
|||
|
||||
yyrg220 := len(yyv220) > 0
|
||||
yyv2220 := yyv220
|
||||
yyrl220, yyrt220 = z.DecInferLen(yyl220, z.DecBasicHandle().MaxInitLen, 344)
|
||||
yyrl220, yyrt220 = z.DecInferLen(yyl220, z.DecBasicHandle().MaxInitLen, 360)
|
||||
if yyrt220 {
|
||||
if yyrl220 <= cap(yyv220) {
|
||||
yyv220 = yyv220[:yyrl220]
|
||||
|
|
|
@ -4247,7 +4247,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
|||
|
||||
yyrg370 := len(yyv370) > 0
|
||||
yyv2370 := yyv370
|
||||
yyrl370, yyrt370 = z.DecInferLen(yyl370, z.DecBasicHandle().MaxInitLen, 768)
|
||||
yyrl370, yyrt370 = z.DecInferLen(yyl370, z.DecBasicHandle().MaxInitLen, 800)
|
||||
if yyrt370 {
|
||||
if yyrl370 <= cap(yyv370) {
|
||||
yyv370 = yyv370[:yyrl370]
|
||||
|
@ -4479,7 +4479,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
|
|||
|
||||
yyrg382 := len(yyv382) > 0
|
||||
yyv2382 := yyv382
|
||||
yyrl382, yyrt382 = z.DecInferLen(yyl382, z.DecBasicHandle().MaxInitLen, 1000)
|
||||
yyrl382, yyrt382 = z.DecInferLen(yyl382, z.DecBasicHandle().MaxInitLen, 1048)
|
||||
if yyrt382 {
|
||||
if yyrl382 <= cap(yyv382) {
|
||||
yyv382 = yyv382[:yyrl382]
|
||||
|
|
|
@ -2872,7 +2872,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
|||
|
||||
yyrg245 := len(yyv245) > 0
|
||||
yyv2245 := yyv245
|
||||
yyrl245, yyrt245 = z.DecInferLen(yyl245, z.DecBasicHandle().MaxInitLen, 792)
|
||||
yyrl245, yyrt245 = z.DecInferLen(yyl245, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt245 {
|
||||
if yyrl245 <= cap(yyv245) {
|
||||
yyv245 = yyv245[:yyrl245]
|
||||
|
|
|
@ -4767,7 +4767,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
|||
|
||||
yyrg409 := len(yyv409) > 0
|
||||
yyv2409 := yyv409
|
||||
yyrl409, yyrt409 = z.DecInferLen(yyl409, z.DecBasicHandle().MaxInitLen, 792)
|
||||
yyrl409, yyrt409 = z.DecInferLen(yyl409, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt409 {
|
||||
if yyrl409 <= cap(yyv409) {
|
||||
yyv409 = yyv409[:yyrl409]
|
||||
|
@ -4999,7 +4999,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
|
|||
|
||||
yyrg421 := len(yyv421) > 0
|
||||
yyv2421 := yyv421
|
||||
yyrl421, yyrt421 = z.DecInferLen(yyl421, z.DecBasicHandle().MaxInitLen, 1024)
|
||||
yyrl421, yyrt421 = z.DecInferLen(yyl421, z.DecBasicHandle().MaxInitLen, 1072)
|
||||
if yyrt421 {
|
||||
if yyrl421 <= cap(yyv421) {
|
||||
yyv421 = yyv421[:yyrl421]
|
||||
|
|
|
@ -1876,7 +1876,7 @@ func (x codecSelfer1234) decSliceCertificateSigningRequest(v *[]CertificateSigni
|
|||
|
||||
yyrg152 := len(yyv152) > 0
|
||||
yyv2152 := yyv152
|
||||
yyrl152, yyrt152 = z.DecInferLen(yyl152, z.DecBasicHandle().MaxInitLen, 368)
|
||||
yyrl152, yyrt152 = z.DecInferLen(yyl152, z.DecBasicHandle().MaxInitLen, 384)
|
||||
if yyrt152 {
|
||||
if yyrl152 <= cap(yyv152) {
|
||||
yyv152 = yyv152[:yyrl152]
|
||||
|
|
|
@ -1869,7 +1869,7 @@ func (x codecSelfer1234) decSliceCertificateSigningRequest(v *[]CertificateSigni
|
|||
|
||||
yyrg152 := len(yyv152) > 0
|
||||
yyv2152 := yyv152
|
||||
yyrl152, yyrt152 = z.DecInferLen(yyl152, z.DecBasicHandle().MaxInitLen, 368)
|
||||
yyrl152, yyrt152 = z.DecInferLen(yyl152, z.DecBasicHandle().MaxInitLen, 384)
|
||||
if yyrt152 {
|
||||
if yyrl152 <= cap(yyv152) {
|
||||
yyv152 = yyv152[:yyrl152]
|
||||
|
|
|
@ -16662,7 +16662,7 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d *
|
|||
|
||||
yyrg1377 := len(yyv1377) > 0
|
||||
yyv21377 := yyv1377
|
||||
yyrl1377, yyrt1377 = z.DecInferLen(yyl1377, z.DecBasicHandle().MaxInitLen, 280)
|
||||
yyrl1377, yyrt1377 = z.DecInferLen(yyl1377, z.DecBasicHandle().MaxInitLen, 296)
|
||||
if yyrt1377 {
|
||||
if yyrl1377 <= cap(yyv1377) {
|
||||
yyv1377 = yyv1377[:yyrl1377]
|
||||
|
@ -16778,7 +16778,7 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode
|
|||
|
||||
yyrg1383 := len(yyv1383) > 0
|
||||
yyv21383 := yyv1383
|
||||
yyrl1383, yyrt1383 = z.DecInferLen(yyl1383, z.DecBasicHandle().MaxInitLen, 768)
|
||||
yyrl1383, yyrt1383 = z.DecInferLen(yyl1383, z.DecBasicHandle().MaxInitLen, 800)
|
||||
if yyrt1383 {
|
||||
if yyrl1383 <= cap(yyv1383) {
|
||||
yyv1383 = yyv1383[:yyrl1383]
|
||||
|
@ -16894,7 +16894,7 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder)
|
|||
|
||||
yyrg1389 := len(yyv1389) > 0
|
||||
yyv21389 := yyv1389
|
||||
yyrl1389, yyrt1389 = z.DecInferLen(yyl1389, z.DecBasicHandle().MaxInitLen, 696)
|
||||
yyrl1389, yyrt1389 = z.DecInferLen(yyl1389, z.DecBasicHandle().MaxInitLen, 728)
|
||||
if yyrt1389 {
|
||||
if yyrl1389 <= cap(yyv1389) {
|
||||
yyv1389 = yyv1389[:yyrl1389]
|
||||
|
@ -17010,7 +17010,7 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD
|
|||
|
||||
yyrg1395 := len(yyv1395) > 0
|
||||
yyv21395 := yyv1395
|
||||
yyrl1395, yyrt1395 = z.DecInferLen(yyl1395, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl1395, yyrt1395 = z.DecInferLen(yyl1395, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt1395 {
|
||||
if yyrl1395 <= cap(yyv1395) {
|
||||
yyv1395 = yyv1395[:yyrl1395]
|
||||
|
@ -17126,7 +17126,7 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) {
|
|||
|
||||
yyrg1401 := len(yyv1401) > 0
|
||||
yyv21401 := yyv1401
|
||||
yyrl1401, yyrt1401 = z.DecInferLen(yyl1401, z.DecBasicHandle().MaxInitLen, 320)
|
||||
yyrl1401, yyrt1401 = z.DecInferLen(yyl1401, z.DecBasicHandle().MaxInitLen, 336)
|
||||
if yyrt1401 {
|
||||
if yyrl1401 <= cap(yyv1401) {
|
||||
yyv1401 = yyv1401[:yyrl1401]
|
||||
|
@ -17590,7 +17590,7 @@ func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decode
|
|||
|
||||
yyrg1425 := len(yyv1425) > 0
|
||||
yyv21425 := yyv1425
|
||||
yyrl1425, yyrt1425 = z.DecInferLen(yyl1425, z.DecBasicHandle().MaxInitLen, 712)
|
||||
yyrl1425, yyrt1425 = z.DecInferLen(yyl1425, z.DecBasicHandle().MaxInitLen, 744)
|
||||
if yyrt1425 {
|
||||
if yyrl1425 <= cap(yyv1425) {
|
||||
yyv1425 = yyv1425[:yyrl1425]
|
||||
|
@ -18158,7 +18158,7 @@ func (x codecSelfer1234) decSlicePodSecurityPolicy(v *[]PodSecurityPolicy, d *co
|
|||
|
||||
yyrg1454 := len(yyv1454) > 0
|
||||
yyv21454 := yyv1454
|
||||
yyrl1454, yyrt1454 = z.DecInferLen(yyl1454, z.DecBasicHandle().MaxInitLen, 536)
|
||||
yyrl1454, yyrt1454 = z.DecInferLen(yyl1454, z.DecBasicHandle().MaxInitLen, 552)
|
||||
if yyrt1454 {
|
||||
if yyrl1454 <= cap(yyv1454) {
|
||||
yyv1454 = yyv1454[:yyrl1454]
|
||||
|
@ -18622,7 +18622,7 @@ func (x codecSelfer1234) decSliceNetworkPolicy(v *[]NetworkPolicy, d *codec1978.
|
|||
|
||||
yyrg1478 := len(yyv1478) > 0
|
||||
yyv21478 := yyv1478
|
||||
yyrl1478, yyrt1478 = z.DecInferLen(yyl1478, z.DecBasicHandle().MaxInitLen, 296)
|
||||
yyrl1478, yyrt1478 = z.DecInferLen(yyl1478, z.DecBasicHandle().MaxInitLen, 312)
|
||||
if yyrt1478 {
|
||||
if yyrl1478 <= cap(yyv1478) {
|
||||
yyv1478 = yyv1478[:yyrl1478]
|
||||
|
@ -18738,7 +18738,7 @@ func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.De
|
|||
|
||||
yyrg1484 := len(yyv1484) > 0
|
||||
yyv21484 := yyv1484
|
||||
yyrl1484, yyrt1484 = z.DecInferLen(yyl1484, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl1484, yyrt1484 = z.DecInferLen(yyl1484, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt1484 {
|
||||
if yyrl1484 <= cap(yyv1484) {
|
||||
yyv1484 = yyv1484[:yyrl1484]
|
||||
|
|
|
@ -22028,7 +22028,7 @@ func (x codecSelfer1234) decSliceHorizontalPodAutoscaler(v *[]HorizontalPodAutos
|
|||
|
||||
yyrg1838 := len(yyv1838) > 0
|
||||
yyv21838 := yyv1838
|
||||
yyrl1838, yyrt1838 = z.DecInferLen(yyl1838, z.DecBasicHandle().MaxInitLen, 360)
|
||||
yyrl1838, yyrt1838 = z.DecInferLen(yyl1838, z.DecBasicHandle().MaxInitLen, 376)
|
||||
if yyrt1838 {
|
||||
if yyrl1838 <= cap(yyv1838) {
|
||||
yyv1838 = yyv1838[:yyrl1838]
|
||||
|
@ -22260,7 +22260,7 @@ func (x codecSelfer1234) decSliceThirdPartyResource(v *[]ThirdPartyResource, d *
|
|||
|
||||
yyrg1850 := len(yyv1850) > 0
|
||||
yyv21850 := yyv1850
|
||||
yyrl1850, yyrt1850 = z.DecInferLen(yyl1850, z.DecBasicHandle().MaxInitLen, 280)
|
||||
yyrl1850, yyrt1850 = z.DecInferLen(yyl1850, z.DecBasicHandle().MaxInitLen, 296)
|
||||
if yyrt1850 {
|
||||
if yyrl1850 <= cap(yyv1850) {
|
||||
yyv1850 = yyv1850[:yyrl1850]
|
||||
|
@ -22376,7 +22376,7 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode
|
|||
|
||||
yyrg1856 := len(yyv1856) > 0
|
||||
yyv21856 := yyv1856
|
||||
yyrl1856, yyrt1856 = z.DecInferLen(yyl1856, z.DecBasicHandle().MaxInitLen, 792)
|
||||
yyrl1856, yyrt1856 = z.DecInferLen(yyl1856, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt1856 {
|
||||
if yyrl1856 <= cap(yyv1856) {
|
||||
yyv1856 = yyv1856[:yyrl1856]
|
||||
|
@ -22492,7 +22492,7 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder)
|
|||
|
||||
yyrg1862 := len(yyv1862) > 0
|
||||
yyv21862 := yyv1862
|
||||
yyrl1862, yyrt1862 = z.DecInferLen(yyl1862, z.DecBasicHandle().MaxInitLen, 720)
|
||||
yyrl1862, yyrt1862 = z.DecInferLen(yyl1862, z.DecBasicHandle().MaxInitLen, 752)
|
||||
if yyrt1862 {
|
||||
if yyrl1862 <= cap(yyv1862) {
|
||||
yyv1862 = yyv1862[:yyrl1862]
|
||||
|
@ -22608,7 +22608,7 @@ func (x codecSelfer1234) decSliceThirdPartyResourceData(v *[]ThirdPartyResourceD
|
|||
|
||||
yyrg1868 := len(yyv1868) > 0
|
||||
yyv21868 := yyv1868
|
||||
yyrl1868, yyrt1868 = z.DecInferLen(yyl1868, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl1868, yyrt1868 = z.DecInferLen(yyl1868, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt1868 {
|
||||
if yyrl1868 <= cap(yyv1868) {
|
||||
yyv1868 = yyv1868[:yyrl1868]
|
||||
|
@ -22724,7 +22724,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
|
|||
|
||||
yyrg1874 := len(yyv1874) > 0
|
||||
yyv21874 := yyv1874
|
||||
yyrl1874, yyrt1874 = z.DecInferLen(yyl1874, z.DecBasicHandle().MaxInitLen, 792)
|
||||
yyrl1874, yyrt1874 = z.DecInferLen(yyl1874, z.DecBasicHandle().MaxInitLen, 824)
|
||||
if yyrt1874 {
|
||||
if yyrl1874 <= cap(yyv1874) {
|
||||
yyv1874 = yyv1874[:yyrl1874]
|
||||
|
@ -22956,7 +22956,7 @@ func (x codecSelfer1234) decSliceIngress(v *[]Ingress, d *codec1978.Decoder) {
|
|||
|
||||
yyrg1886 := len(yyv1886) > 0
|
||||
yyv21886 := yyv1886
|
||||
yyrl1886, yyrt1886 = z.DecInferLen(yyl1886, z.DecBasicHandle().MaxInitLen, 320)
|
||||
yyrl1886, yyrt1886 = z.DecInferLen(yyl1886, z.DecBasicHandle().MaxInitLen, 336)
|
||||
if yyrt1886 {
|
||||
if yyrl1886 <= cap(yyv1886) {
|
||||
yyv1886 = yyv1886[:yyrl1886]
|
||||
|
@ -23536,7 +23536,7 @@ func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decode
|
|||
|
||||
yyrg1916 := len(yyv1916) > 0
|
||||
yyv21916 := yyv1916
|
||||
yyrl1916, yyrt1916 = z.DecInferLen(yyl1916, z.DecBasicHandle().MaxInitLen, 736)
|
||||
yyrl1916, yyrt1916 = z.DecInferLen(yyl1916, z.DecBasicHandle().MaxInitLen, 768)
|
||||
if yyrt1916 {
|
||||
if yyrl1916 <= cap(yyv1916) {
|
||||
yyv1916 = yyv1916[:yyrl1916]
|
||||
|
@ -24104,7 +24104,7 @@ func (x codecSelfer1234) decSlicePodSecurityPolicy(v *[]PodSecurityPolicy, d *co
|
|||
|
||||
yyrg1945 := len(yyv1945) > 0
|
||||
yyv21945 := yyv1945
|
||||
yyrl1945, yyrt1945 = z.DecInferLen(yyl1945, z.DecBasicHandle().MaxInitLen, 536)
|
||||
yyrl1945, yyrt1945 = z.DecInferLen(yyl1945, z.DecBasicHandle().MaxInitLen, 552)
|
||||
if yyrt1945 {
|
||||
if yyrl1945 <= cap(yyv1945) {
|
||||
yyv1945 = yyv1945[:yyrl1945]
|
||||
|
@ -24568,7 +24568,7 @@ func (x codecSelfer1234) decSliceNetworkPolicy(v *[]NetworkPolicy, d *codec1978.
|
|||
|
||||
yyrg1969 := len(yyv1969) > 0
|
||||
yyv21969 := yyv1969
|
||||
yyrl1969, yyrt1969 = z.DecInferLen(yyl1969, z.DecBasicHandle().MaxInitLen, 296)
|
||||
yyrl1969, yyrt1969 = z.DecInferLen(yyl1969, z.DecBasicHandle().MaxInitLen, 312)
|
||||
if yyrt1969 {
|
||||
if yyrl1969 <= cap(yyv1969) {
|
||||
yyv1969 = yyv1969[:yyrl1969]
|
||||
|
@ -24684,7 +24684,7 @@ func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.De
|
|||
|
||||
yyrg1975 := len(yyv1975) > 0
|
||||
yyv21975 := yyv1975
|
||||
yyrl1975, yyrt1975 = z.DecInferLen(yyl1975, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl1975, yyrt1975 = z.DecInferLen(yyl1975, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt1975 {
|
||||
if yyrl1975 <= cap(yyv1975) {
|
||||
yyv1975 = yyv1975[:yyrl1975]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1671,7 +1671,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
|
|||
|
||||
yyrg138 := len(yyv138) > 0
|
||||
yyv2138 := yyv138
|
||||
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 296)
|
||||
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 312)
|
||||
if yyrt138 {
|
||||
if yyrl138 <= cap(yyv138) {
|
||||
yyv138 = yyv138[:yyrl138]
|
||||
|
|
|
@ -1671,7 +1671,7 @@ func (x codecSelfer1234) decSlicePodDisruptionBudget(v *[]PodDisruptionBudget, d
|
|||
|
||||
yyrg138 := len(yyv138) > 0
|
||||
yyv2138 := yyv138
|
||||
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 296)
|
||||
yyrl138, yyrt138 = z.DecInferLen(yyl138, z.DecBasicHandle().MaxInitLen, 312)
|
||||
if yyrt138 {
|
||||
if yyrl138 <= cap(yyv138) {
|
||||
yyv138 = yyv138[:yyrl138]
|
||||
|
|
|
@ -3894,7 +3894,7 @@ func (x codecSelfer1234) decSliceRoleBinding(v *[]RoleBinding, d *codec1978.Deco
|
|||
|
||||
yyrg341 := len(yyv341) > 0
|
||||
yyv2341 := yyv341
|
||||
yyrl341, yyrt341 = z.DecInferLen(yyl341, z.DecBasicHandle().MaxInitLen, 376)
|
||||
yyrl341, yyrt341 = z.DecInferLen(yyl341, z.DecBasicHandle().MaxInitLen, 392)
|
||||
if yyrt341 {
|
||||
if yyrl341 <= cap(yyv341) {
|
||||
yyv341 = yyv341[:yyrl341]
|
||||
|
@ -4010,7 +4010,7 @@ func (x codecSelfer1234) decSliceRole(v *[]Role, d *codec1978.Decoder) {
|
|||
|
||||
yyrg347 := len(yyv347) > 0
|
||||
yyv2347 := yyv347
|
||||
yyrl347, yyrt347 = z.DecInferLen(yyl347, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl347, yyrt347 = z.DecInferLen(yyl347, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt347 {
|
||||
if yyrl347 <= cap(yyv347) {
|
||||
yyv347 = yyv347[:yyrl347]
|
||||
|
@ -4126,7 +4126,7 @@ func (x codecSelfer1234) decSliceClusterRoleBinding(v *[]ClusterRoleBinding, d *
|
|||
|
||||
yyrg353 := len(yyv353) > 0
|
||||
yyv2353 := yyv353
|
||||
yyrl353, yyrt353 = z.DecInferLen(yyl353, z.DecBasicHandle().MaxInitLen, 376)
|
||||
yyrl353, yyrt353 = z.DecInferLen(yyl353, z.DecBasicHandle().MaxInitLen, 392)
|
||||
if yyrt353 {
|
||||
if yyrl353 <= cap(yyv353) {
|
||||
yyv353 = yyv353[:yyrl353]
|
||||
|
@ -4242,7 +4242,7 @@ func (x codecSelfer1234) decSliceClusterRole(v *[]ClusterRole, d *codec1978.Deco
|
|||
|
||||
yyrg359 := len(yyv359) > 0
|
||||
yyv2359 := yyv359
|
||||
yyrl359, yyrt359 = z.DecInferLen(yyl359, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl359, yyrt359 = z.DecInferLen(yyl359, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt359 {
|
||||
if yyrl359 <= cap(yyv359) {
|
||||
yyv359 = yyv359[:yyrl359]
|
||||
|
|
|
@ -1527,7 +1527,7 @@ func (x codecSelfer1234) decSliceSimple(v *[]Simple, d *codec1978.Decoder) {
|
|||
|
||||
yyrg132 := len(yyv132) > 0
|
||||
yyv2132 := yyv132
|
||||
yyrl132, yyrt132 = z.DecInferLen(yyl132, z.DecBasicHandle().MaxInitLen, 264)
|
||||
yyrl132, yyrt132 = z.DecInferLen(yyl132, z.DecBasicHandle().MaxInitLen, 280)
|
||||
if yyrt132 {
|
||||
if yyrl132 <= cap(yyv132) {
|
||||
yyv132 = yyv132[:yyrl132]
|
||||
|
|
|
@ -710,7 +710,7 @@ func (x codecSelfer1234) decSliceMetadataOnlyObject(v *[]MetadataOnlyObject, d *
|
|||
|
||||
yyrg56 := len(yyv56) > 0
|
||||
yyv256 := yyv56
|
||||
yyrl56, yyrt56 = z.DecInferLen(yyl56, z.DecBasicHandle().MaxInitLen, 240)
|
||||
yyrl56, yyrt56 = z.DecInferLen(yyl56, z.DecBasicHandle().MaxInitLen, 256)
|
||||
if yyrt56 {
|
||||
if yyrl56 <= cap(yyv56) {
|
||||
yyv56 = yyv56[:yyrl56]
|
||||
|
|
|
@ -456,6 +456,14 @@ func (u *Unstructured) SetFinalizers(finalizers []string) {
|
|||
u.setNestedSlice(finalizers, "metadata", "finalizers")
|
||||
}
|
||||
|
||||
func (u *Unstructured) GetClusterName() string {
|
||||
return getNestedString(u.Object, "metadata", "clusterName")
|
||||
}
|
||||
|
||||
func (u *Unstructured) SetClusterName(clusterName string) {
|
||||
u.setNestedField(clusterName, "metadata", "clusterName")
|
||||
}
|
||||
|
||||
// UnstructuredList allows lists that do not have Golang structs
|
||||
// registered to be manipulated generically. This can be used to deal
|
||||
// with the API lists from a plug-in.
|
||||
|
|
|
@ -160,6 +160,7 @@ func TestUnstructuredGetters(t *testing.T) {
|
|||
"finalizer.1",
|
||||
"finalizer.2",
|
||||
},
|
||||
"clusterName": "cluster123",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -232,6 +233,9 @@ func TestUnstructuredGetters(t *testing.T) {
|
|||
if got, want := unstruct.GetFinalizers(), []string{"finalizer.1", "finalizer.2"}; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("GetFinalizers()=%v, want %v", got, want)
|
||||
}
|
||||
if got, want := unstruct.GetClusterName(), "cluster123"; got != want {
|
||||
t.Errorf("GetClusterName()=%v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnstructuredSetters(t *testing.T) {
|
||||
|
@ -277,6 +281,7 @@ func TestUnstructuredSetters(t *testing.T) {
|
|||
"finalizer.1",
|
||||
"finalizer.2",
|
||||
},
|
||||
"clusterName": "cluster123",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -311,6 +316,7 @@ func TestUnstructuredSetters(t *testing.T) {
|
|||
}
|
||||
unstruct.SetOwnerReferences(newOwnerReferences)
|
||||
unstruct.SetFinalizers([]string{"finalizer.1", "finalizer.2"})
|
||||
unstruct.SetClusterName("cluster123")
|
||||
|
||||
if !reflect.DeepEqual(unstruct, want) {
|
||||
t.Errorf("Wanted: \n%s\n Got:\n%s", want, unstruct)
|
||||
|
|
Loading…
Reference in New Issue