fix for scale option appearing on non-scalable resources (#3696)

* fix: simplify scaling key binding condition

* fix: add ReplicaSet to scalable resource check

* fix: update expected hints count in deployment and stateful set tests
mine
Ümüt Özalp 2025-12-01 17:40:33 +01:00 committed by GitHub
parent 4c6df3975e
commit e5cdf04e51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -356,7 +356,7 @@ func isStandardGroup(gv string) bool {
} }
func isScalable(gvr *client.GVR) bool { func isScalable(gvr *client.GVR) bool {
ss := sets.New(client.DpGVR, client.StsGVR) ss := sets.New(client.DpGVR, client.StsGVR, client.RsGVR)
return ss.Has(gvr) return ss.Has(gvr)
} }

View File

@ -17,5 +17,5 @@ func TestDeploy(t *testing.T) {
require.NoError(t, v.Init(makeCtx(t))) require.NoError(t, v.Init(makeCtx(t)))
assert.Equal(t, "Deployments", v.Name()) assert.Equal(t, "Deployments", v.Name())
assert.Len(t, v.Hints(), 18) assert.Len(t, v.Hints(), 17)
} }

View File

@ -44,7 +44,7 @@ func (s *ScaleExtender) bindKeys(aa *ui.KeyActions) {
return return
} }
if !dao.IsCRD(meta) || dao.IsScalable(meta) { if dao.IsScalable(meta) {
aa.Add(ui.KeyS, ui.NewKeyActionWithOpts("Scale", s.scaleCmd, aa.Add(ui.KeyS, ui.NewKeyActionWithOpts("Scale", s.scaleCmd,
ui.ActionOpts{ ui.ActionOpts{
Visible: true, Visible: true,

View File

@ -17,5 +17,5 @@ func TestStatefulSetNew(t *testing.T) {
require.NoError(t, s.Init(makeCtx(t))) require.NoError(t, s.Init(makeCtx(t)))
assert.Equal(t, "StatefulSets", s.Name()) assert.Equal(t, "StatefulSets", s.Name())
assert.Len(t, s.Hints(), 15) assert.Len(t, s.Hints(), 14)
} }