Skip to content

Commit

Permalink
update for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentportella committed Aug 29, 2024
1 parent 92c98d5 commit 1d47b9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/cyclenoderequest/transitioner/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func WithKubeNodes(nodes []*mock.Node) Option {

func WithExtraKubeObject(extraKubeObject client.Object) Option {
return func(t *Transitioner) {
t.extrakubeObjects = append(t.extrakubeObjects, extraKubeObject)
t.extraKubeObjects = append(t.extraKubeObjects, extraKubeObject)
}
}

Expand All @@ -45,7 +45,7 @@ type Transitioner struct {
CloudProviderInstances []*mock.Node
KubeNodes []*mock.Node

extrakubeObjects []client.Object
extraKubeObjects []client.Object

transitionerOptions Options
}
Expand All @@ -56,7 +56,7 @@ func NewFakeTransitioner(cnr *v1.CycleNodeRequest, opts ...Option) *Transitioner
// override these as needed
CloudProviderInstances: make([]*mock.Node, 0),
KubeNodes: make([]*mock.Node, 0),
extrakubeObjects: []client.Object{cnr},
extraKubeObjects: []client.Object{cnr},
transitionerOptions: Options{},
}

Expand All @@ -65,7 +65,7 @@ func NewFakeTransitioner(cnr *v1.CycleNodeRequest, opts ...Option) *Transitioner
}

t.Client = mock.NewClient(
t.KubeNodes, t.CloudProviderInstances, t.extrakubeObjects...,
t.KubeNodes, t.CloudProviderInstances, t.extraKubeObjects...,
)

rm := &controller.ResourceManager{
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/cyclenoderequest/transitioner/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func (t *CycleNodeRequestTransitioner) validateInstanceState(validNodeGroupInsta
}

// deleteFailedSiblingCNRs finds the CNRs generated for the same nodegroup as
// the one in the calling transitioner. It filters for deleted CNRs in the same
// the one in the transitioner. It filters for deleted CNRs in the same
// namespace and deletes them.
func (t *CycleNodeRequestTransitioner) deleteFailedSiblingCNRs() error {
ctx := context.TODO()
Expand Down
7 changes: 6 additions & 1 deletion pkg/observer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ func (c *controller) dropInProgressNodeGroups(nodeGroups v1.NodeGroupList, cnrs
}

if dropNodeGroup {
klog.Warningf("nodegroup %q has an in progress CNR.. skipping this nodegroup", nodeGroup.Name)
if failedCNRsFound > nodeGroup.Spec.MaxFailedCycleNodeRequests {
klog.Warningf("nodegroup %q has too many failed CNRs.. skipping this nodegroup", nodeGroup.Name)
} else {
klog.Warningf("nodegroup %q has an in progress CNR.. skipping this nodegroup", nodeGroup.Name)
}

c.NodeGroupsLocked.WithLabelValues(nodeGroup.Name).Inc()
continue
}
Expand Down

0 comments on commit 1d47b9c

Please sign in to comment.