Skip to content

Commit

Permalink
pkg/api: fix singular name
Browse files Browse the repository at this point in the history
With the 1.27 Kubernetes upgrade, a new GetSingularName method needed to
be implemented by the metrics rest.Storage. While doing it, we set a
value for the singular name of the resources when it used to be empty.
Due to that, the kube-apiserver stop guessing the resource name based on
its Kind, which broken kubectl get PodMetrics/NodeMetrics.

To fix that, we need to blank out the singular name of the resources,
otherwise we will be stuck with the following commands:
- kubectl get pod.metric
- kubectl get node.metric
Instead of the more commonly used:
- kubectl get PodMetrics
- kubectl get NodeMetrics

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
  • Loading branch information
dgrisonnet committed Mar 12, 2024
1 parent ea158b5 commit 9ea6311
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/api/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ func (m *nodeMetrics) NamespaceScoped() bool {

// GetSingularName implements rest.SingularNameProvider interface
func (m *nodeMetrics) GetSingularName() string {
return "node"
return ""
}
2 changes: 1 addition & 1 deletion pkg/api/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ func (m *podMetrics) NamespaceScoped() bool {

// GetSingularName implements rest.SingularNameProvider interface
func (m *podMetrics) GetSingularName() string {
return "pod"
return ""
}

0 comments on commit 9ea6311

Please sign in to comment.