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

@ -173,7 +173,9 @@ func (meta *ObjectMeta) SetOwnerReferences(references []OwnerReference) {
meta.OwnerReferences = references meta.OwnerReferences = references
} }
func (meta *ObjectMeta) GetZZZ_DeprecatedClusterName() string { return meta.ZZZ_DeprecatedClusterName } func (meta *ObjectMeta) GetZZZ_DeprecatedClusterName() string { return meta.ZZZ_DeprecatedClusterName }
func (meta *ObjectMeta) SetZZZ_DeprecatedClusterName(clusterName string) { meta.ZZZ_DeprecatedClusterName = clusterName } func (meta *ObjectMeta) SetZZZ_DeprecatedClusterName(clusterName string) {
meta.ZZZ_DeprecatedClusterName = clusterName
}
func (meta *ObjectMeta) GetManagedFields() []ManagedFieldsEntry { return meta.ManagedFields } func (meta *ObjectMeta) GetManagedFields() []ManagedFieldsEntry { return meta.ManagedFields }
func (meta *ObjectMeta) SetManagedFields(managedFields []ManagedFieldsEntry) { func (meta *ObjectMeta) SetManagedFields(managedFields []ManagedFieldsEntry) {
meta.ManagedFields = managedFields meta.ManagedFields = managedFields

View File

@ -257,10 +257,13 @@ type ObjectMeta struct {
// +patchStrategy=merge // +patchStrategy=merge
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"` Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
// ClusterName tombstone. It consumed proto tag 15. We will remove // Deprecated: ClusterName is a legacy field that was always cleared by
// completely sans a comment here next release (1.25). The name is // the system and never used; it will be removed completely in 1.25.
// changed here for a release to ensure any users (which we do not //
// expect) will get a compile error before a serialization error. // 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"` ZZZ_DeprecatedClusterName string `json:"clusterName,omitempty" protobuf:"bytes,15,opt,name=clusterName"`
// ManagedFields maps workflow-id and version to the set of fields // 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 // ZZZ_DeprecatedClusterName is ignored and should not be saved
if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 { if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 {
objectMeta.SetZZZ_DeprecatedClusterName("") 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 { 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 // ZZZ_DeprecatedClusterName is ignored and should not be saved
if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 { if len(objectMeta.GetZZZ_DeprecatedClusterName()) > 0 {
objectMeta.SetZZZ_DeprecatedClusterName("") 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 // Use the existing UID if none is provided
if len(objectMeta.GetUID()) == 0 { if len(objectMeta.GetUID()) == 0 {