Skip to content

Commit

Permalink
add subresource status for vpa
Browse files Browse the repository at this point in the history
Fixed: kubernetes#5675

Signed-off-by: xiaoqing <[email protected]>
  • Loading branch information
wu0407 committed Apr 13, 2023
1 parent f173888 commit 9243a42
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions vertical-pod-autoscaler/deploy/vpa-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ rules:
- create
- patch
- delete
- apiGroups:
- "autoscaling.k8s.io"
resources:
- verticalpodautoscalers/status
verbs:
- get
- patch
- apiGroups:
- ""
resources:
Expand Down
3 changes: 2 additions & 1 deletion vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ spec:
type: object
served: true
storage: true
subresources: {}
subresources:
status: {}
- deprecated: true
deprecationWarning: autoscaling.k8s.io/v1beta2 API is deprecated
name: v1beta2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type VerticalPodAutoscalerList struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=vpa
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.updatePolicy.updateMode"
// +kubebuilder:printcolumn:name="CPU",type="string",JSONPath=".status.recommendation.containerRecommendations[0].target.cpu"
// +kubebuilder:printcolumn:name="Mem",type="string",JSONPath=".status.recommendation.containerRecommendations[0].target.memory"
Expand Down
2 changes: 1 addition & 1 deletion vertical-pod-autoscaler/pkg/utils/vpa/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func patchVpa(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpaName string,
return
}

return vpaClient.Patch(context.TODO(), vpaName, types.JSONPatchType, bytes, meta.PatchOptions{})
return vpaClient.Patch(context.TODO(), vpaName, types.JSONPatchType, bytes, meta.PatchOptions{}, "status")
}

// UpdateVpaStatusIfNeeded updates the status field of the VPA API object.
Expand Down

0 comments on commit 9243a42

Please sign in to comment.