Skip to content

Commit 430b920

Browse files
lavalampk8s-publishing-bot
authored andcommitted
Remove ClusterName
Kubernetes-commit: 331525670b772eb8956b7f5204078c51c00aaef3
1 parent 5f6d692 commit 430b920

File tree

8 files changed

+3
-46
lines changed

8 files changed

+3
-46
lines changed

pkg/api/meta/meta.go

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
130130
Annotations: m.GetAnnotations(),
131131
OwnerReferences: m.GetOwnerReferences(),
132132
Finalizers: m.GetFinalizers(),
133-
ZZZ_DeprecatedClusterName: m.GetZZZ_DeprecatedClusterName(),
134133
ManagedFields: m.GetManagedFields(),
135134
},
136135
}

pkg/api/validation/objectmeta.go

-9
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ var BannedOwners = map[schema.GroupVersionKind]struct{}{
4040
{Group: "", Version: "v1", Kind: "Event"}: {},
4141
}
4242

43-
// ValidateZZZ_DeprecatedClusterName can be used to check whether the given cluster name is valid.
44-
var ValidateZZZ_DeprecatedClusterName = NameIsDNS1035Label
45-
4643
// ValidateAnnotations validates that a set of annotations are correctly defined.
4744
func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {
4845
allErrs := field.ErrorList{}
@@ -184,11 +181,6 @@ func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, name
184181
allErrs = append(allErrs, field.Forbidden(fldPath.Child("namespace"), "not allowed on this type"))
185182
}
186183
}
187-
if len(meta.GetZZZ_DeprecatedClusterName()) != 0 {
188-
for _, msg := range ValidateZZZ_DeprecatedClusterName(meta.GetZZZ_DeprecatedClusterName(), false) {
189-
allErrs = append(allErrs, field.Invalid(fldPath.Child("clusterName"), meta.GetZZZ_DeprecatedClusterName(), msg))
190-
}
191-
}
192184

193185
allErrs = append(allErrs, ValidateNonnegativeField(meta.GetGeneration(), fldPath.Child("generation"))...)
194186
allErrs = append(allErrs, v1validation.ValidateLabels(meta.GetLabels(), fldPath.Child("labels"))...)
@@ -261,7 +253,6 @@ func ValidateObjectMetaAccessorUpdate(newMeta, oldMeta metav1.Object, fldPath *f
261253
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetCreationTimestamp(), oldMeta.GetCreationTimestamp(), fldPath.Child("creationTimestamp"))...)
262254
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionTimestamp(), oldMeta.GetDeletionTimestamp(), fldPath.Child("deletionTimestamp"))...)
263255
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetDeletionGracePeriodSeconds(), oldMeta.GetDeletionGracePeriodSeconds(), fldPath.Child("deletionGracePeriodSeconds"))...)
264-
allErrs = append(allErrs, ValidateImmutableField(newMeta.GetZZZ_DeprecatedClusterName(), oldMeta.GetZZZ_DeprecatedClusterName(), fldPath.Child("clusterName"))...)
265256

266257
allErrs = append(allErrs, v1validation.ValidateLabels(newMeta.GetLabels(), fldPath.Child("labels"))...)
267258
allErrs = append(allErrs, ValidateAnnotations(newMeta.GetAnnotations(), fldPath.Child("annotations"))...)

pkg/apis/meta/v1/helpers_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ func TestResetObjectMetaForStatus(t *testing.T) {
205205
existingMeta.SetUID(types.UID(""))
206206
existingMeta.SetName("")
207207
existingMeta.SetNamespace("")
208-
existingMeta.SetZZZ_DeprecatedClusterName("")
209208
existingMeta.SetCreationTimestamp(Time{})
210209
existingMeta.SetDeletionTimestamp(nil)
211210
existingMeta.SetDeletionGracePeriodSeconds(nil)

pkg/apis/meta/v1/meta.go

-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ type Object interface {
5959
SetFinalizers(finalizers []string)
6060
GetOwnerReferences() []OwnerReference
6161
SetOwnerReferences([]OwnerReference)
62-
GetZZZ_DeprecatedClusterName() string
63-
SetZZZ_DeprecatedClusterName(clusterName string)
6462
GetManagedFields() []ManagedFieldsEntry
6563
SetManagedFields(managedFields []ManagedFieldsEntry)
6664
}
@@ -172,10 +170,6 @@ func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference { return m
172170
func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
173171
meta.OwnerReferences = references
174172
}
175-
func (meta *ObjectMeta) GetZZZ_DeprecatedClusterName() string { return meta.ZZZ_DeprecatedClusterName }
176-
func (meta *ObjectMeta) SetZZZ_DeprecatedClusterName(clusterName string) {
177-
meta.ZZZ_DeprecatedClusterName = clusterName
178-
}
179173
func (meta *ObjectMeta) GetManagedFields() []ManagedFieldsEntry { return meta.ManagedFields }
180174
func (meta *ObjectMeta) SetManagedFields(managedFields []ManagedFieldsEntry) {
181175
meta.ManagedFields = managedFields

pkg/apis/meta/v1/types.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,9 @@ type ObjectMeta struct {
254254
// +patchStrategy=merge
255255
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
256256

257-
// Deprecated: ClusterName is a legacy field that was always cleared by
258-
// the system and never used; it will be removed completely in 1.25.
259-
//
260-
// The name in the go struct is changed to help clients detect
261-
// accidental use.
262-
//
263-
// +optional
264-
ZZZ_DeprecatedClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
257+
// Tombstone: ClusterName was a legacy field that was always cleared by
258+
// the system and never used.
259+
// ClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
265260

266261
// ManagedFields maps workflow-id and version to the set of fields
267262
// that are managed by that workflow. This is mostly for internal

pkg/apis/meta/v1/unstructured/unstructured.go

-12
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,6 @@ func (u *Unstructured) SetFinalizers(finalizers []string) {
444444
u.setNestedStringSlice(finalizers, "metadata", "finalizers")
445445
}
446446

447-
func (u *Unstructured) GetZZZ_DeprecatedClusterName() string {
448-
return getNestedString(u.Object, "metadata", "clusterName")
449-
}
450-
451-
func (u *Unstructured) SetZZZ_DeprecatedClusterName(clusterName string) {
452-
if len(clusterName) == 0 {
453-
RemoveNestedField(u.Object, "metadata", "clusterName")
454-
return
455-
}
456-
u.setNestedField(clusterName, "metadata", "clusterName")
457-
}
458-
459447
func (u *Unstructured) GetManagedFields() []metav1.ManagedFieldsEntry {
460448
items, found, err := NestedSlice(u.Object, "metadata", "managedFields")
461449
if !found || err != nil {

pkg/apis/meta/v1/unstructured/unstructured_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ func TestUnstructuredMetadataOmitempty(t *testing.T) {
105105
u.SetAnnotations(nil)
106106
u.SetOwnerReferences(nil)
107107
u.SetFinalizers(nil)
108-
u.SetZZZ_DeprecatedClusterName("")
109108
u.SetManagedFields(nil)
110109

111110
gotMetadata, _, err := unstructured.NestedFieldNoCopy(u.UnstructuredContent(), "metadata")
@@ -147,6 +146,5 @@ func setObjectMetaUsingAccessors(u, uCopy *unstructured.Unstructured) {
147146
uCopy.SetAnnotations(u.GetAnnotations())
148147
uCopy.SetOwnerReferences(u.GetOwnerReferences())
149148
uCopy.SetFinalizers(u.GetFinalizers())
150-
uCopy.SetZZZ_DeprecatedClusterName(u.GetZZZ_DeprecatedClusterName())
151149
uCopy.SetManagedFields(u.GetManagedFields())
152150
}

pkg/test/apis_meta_v1_unstructed_unstructure_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ func TestUnstructuredGetters(t *testing.T) {
170170
"finalizer.1",
171171
"finalizer.2",
172172
},
173-
"clusterName": "cluster123",
174173
},
175174
},
176175
}
@@ -245,9 +244,6 @@ func TestUnstructuredGetters(t *testing.T) {
245244
if got, want := unstruct.GetFinalizers(), []string{"finalizer.1", "finalizer.2"}; !reflect.DeepEqual(got, want) {
246245
t.Errorf("GetFinalizers()=%v, want %v", got, want)
247246
}
248-
if got, want := unstruct.GetZZZ_DeprecatedClusterName(), "cluster123"; got != want {
249-
t.Errorf("GetZZZ_DeprecatedClusterName()=%v, want %v", got, want)
250-
}
251247
if got, want := unstruct.GetDeletionGracePeriodSeconds(), &ten; !reflect.DeepEqual(got, want) {
252248
t.Errorf("GetDeletionGracePeriodSeconds()=%v, want %v", got, want)
253249
}
@@ -302,7 +298,6 @@ func TestUnstructuredSetters(t *testing.T) {
302298
"finalizer.1",
303299
"finalizer.2",
304300
},
305-
"clusterName": "cluster123",
306301
},
307302
},
308303
}
@@ -338,7 +333,6 @@ func TestUnstructuredSetters(t *testing.T) {
338333
}
339334
unstruct.SetOwnerReferences(newOwnerReferences)
340335
unstruct.SetFinalizers([]string{"finalizer.1", "finalizer.2"})
341-
unstruct.SetZZZ_DeprecatedClusterName("cluster123")
342336
unstruct.SetDeletionGracePeriodSeconds(&ten)
343337
unstruct.SetGeneration(ten)
344338

@@ -534,7 +528,6 @@ func TestAccessorMethods(t *testing.T) {
534528
{accessor: "Annotations", val: map[string]string{"foo": "bar"}},
535529
{accessor: "Finalizers", val: []string{"foo"}},
536530
{accessor: "OwnerReferences", val: []metav1.OwnerReference{{Name: "foo"}}},
537-
{accessor: "ZZZ_DeprecatedClusterName", val: "foo"},
538531
}
539532
for i, test := range tests {
540533
t.Logf("evaluating test %d (%s)", i, test.accessor)

0 commit comments

Comments
 (0)