address reviews
This commit is contained in:
		| @@ -280,7 +280,7 @@ const ( | |||||||
| 	// kep: https://kep.k8s.io/1610 | 	// kep: https://kep.k8s.io/1610 | ||||||
| 	// alpha: v1.20 | 	// alpha: v1.20 | ||||||
| 	// beta:  v1.27 | 	// beta:  v1.27 | ||||||
| 	// beta:  v1.30 | 	// GA:  v1.30 | ||||||
| 	// | 	// | ||||||
| 	// Add support for the HPA to scale based on metrics from individual containers | 	// Add support for the HPA to scale based on metrics from individual containers | ||||||
| 	// in target pods | 	// in target pods | ||||||
| @@ -995,7 +995,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS | |||||||
|  |  | ||||||
| 	GracefulNodeShutdownBasedOnPodPriority: {Default: true, PreRelease: featuregate.Beta}, | 	GracefulNodeShutdownBasedOnPodPriority: {Default: true, PreRelease: featuregate.Beta}, | ||||||
|  |  | ||||||
| 	HPAContainerMetrics: {Default: true, PreRelease: featuregate.GA}, | 	HPAContainerMetrics: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32 | ||||||
|  |  | ||||||
| 	HonorPVReclaimPolicy: {Default: false, PreRelease: featuregate.Alpha}, | 	HonorPVReclaimPolicy: {Default: false, PreRelease: featuregate.Alpha}, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -65,7 +65,12 @@ func (autoscalerStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.S | |||||||
| } | } | ||||||
|  |  | ||||||
| // PrepareForCreate clears fields that are not allowed to be set by end users on creation. | // PrepareForCreate clears fields that are not allowed to be set by end users on creation. | ||||||
| func (autoscalerStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {} | func (autoscalerStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { | ||||||
|  | 	newHPA := obj.(*autoscaling.HorizontalPodAutoscaler) | ||||||
|  |  | ||||||
|  | 	// create cannot set status | ||||||
|  | 	newHPA.Status = autoscaling.HorizontalPodAutoscalerStatus{} | ||||||
|  | } | ||||||
|  |  | ||||||
| // Validate validates a new autoscaler. | // Validate validates a new autoscaler. | ||||||
| func (autoscalerStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { | func (autoscalerStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { | ||||||
| @@ -88,7 +93,12 @@ func (autoscalerStrategy) AllowCreateOnUpdate() bool { | |||||||
| } | } | ||||||
|  |  | ||||||
| // PrepareForUpdate clears fields that are not allowed to be set by end users on update. | // PrepareForUpdate clears fields that are not allowed to be set by end users on update. | ||||||
| func (autoscalerStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {} | func (autoscalerStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { | ||||||
|  | 	newHPA := obj.(*autoscaling.HorizontalPodAutoscaler) | ||||||
|  | 	oldHPA := old.(*autoscaling.HorizontalPodAutoscaler) | ||||||
|  | 	// Update is not allowed to set status | ||||||
|  | 	newHPA.Status = oldHPA.Status | ||||||
|  | } | ||||||
|  |  | ||||||
| // ValidateUpdate is the default update validation for an end user. | // ValidateUpdate is the default update validation for an end user. | ||||||
| func (autoscalerStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { | func (autoscalerStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kensei Nakada
					Kensei Nakada