review comments

This commit is contained in:
Daniel Smith 2022-03-17 21:31:54 +00:00
parent 2831f9a343
commit 17e74b3936
5 changed files with 14 additions and 7 deletions

View File

@ -130,7 +130,7 @@ func AsPartialObjectMetadata(m metav1.Object) *metav1.PartialObjectMetadata {
Annotations: m.GetAnnotations(),
OwnerReferences: m.GetOwnerReferences(),
Finalizers: m.GetFinalizers(),
ZZZ_DeprecatedClusterName: m.GetZZZ_DeprecatedClusterName(),
ZZZ_DeprecatedClusterName: m.GetZZZ_DeprecatedClusterName(),
ManagedFields: m.GetManagedFields(),
},
}

View File

@ -172,8 +172,10 @@ func (meta *ObjectMeta) GetOwnerReferences() []OwnerReference { return m
func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
meta.OwnerReferences = references
}
func (meta *ObjectMeta) GetZZZ_DeprecatedClusterName() string { return meta.ZZZ_DeprecatedClusterName }
func (meta *ObjectMeta) SetZZZ_DeprecatedClusterName(clusterName string) { meta.ZZZ_DeprecatedClusterName = clusterName }
func (meta *ObjectMeta) GetZZZ_DeprecatedClusterName() string { return meta.ZZZ_DeprecatedClusterName }
func (meta *ObjectMeta) SetZZZ_DeprecatedClusterName(clusterName string) {
meta.ZZZ_DeprecatedClusterName = clusterName
}
func (meta *ObjectMeta) GetManagedFields() []ManagedFieldsEntry { return meta.ManagedFields }
func (meta *ObjectMeta) SetManagedFields(managedFields []ManagedFieldsEntry) {
meta.ManagedFields = managedFields

View File

@ -257,10 +257,13 @@ type ObjectMeta struct {
// +patchStrategy=merge
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
// ClusterName tombstone. It consumed proto tag 15. We will remove
// completely sans a comment here next release (1.25). The name is
// changed here for a release to ensure any users (which we do not
// expect) will get a compile error before a serialization error.
// Deprecated: ClusterName is a legacy field that was always cleared by
// the system and never used; it will be removed completely in 1.25.
//
// The name in the go struct is changed to help clients detect
// accidental use.
//
// +optional
ZZZ_DeprecatedClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
// ManagedFields maps workflow-id and version to the set of fields

View File

@ -126,6 +126,7 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime.
// ZZZ_DeprecatedClusterName is ignored and should not be saved
if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 {
objectMeta.SetZZZ_DeprecatedClusterName("")
warning.AddWarning(ctx, "", "metadata.clusterName was specified. This field is not preserved and will be removed from the schema in 1.25")
}
if errs := strategy.Validate(ctx, obj); len(errs) > 0 {

View File

@ -139,6 +139,7 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx context.Context, obj, old run
// ZZZ_DeprecatedClusterName is ignored and should not be saved
if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 {
objectMeta.SetZZZ_DeprecatedClusterName("")
warning.AddWarning(ctx, "", "metadata.clusterName was specified. This field is not preserved and will be removed from the schema in 1.25")
}
// Use the existing UID if none is provided
if len(objectMeta.GetUID()) == 0 {