Skip to content

Commit

Permalink
Merge pull request kubernetes#917 from dims/extract-fargate-into-a-st…
Browse files Browse the repository at this point in the history
…and-alone-file

Extract fargate related code into a standalone file
  • Loading branch information
k8s-ci-robot authored May 23, 2024
2 parents 389877c + 2e10be6 commit e6456fd
Show file tree
Hide file tree
Showing 15 changed files with 613 additions and 381 deletions.
7 changes: 5 additions & 2 deletions pkg/controllers/tagging/tagging_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
nodehelpers "k8s.io/cloud-provider/node/helpers"
_ "k8s.io/component-base/metrics/prometheus/workqueue" // enable prometheus provider for workqueue metrics
"k8s.io/klog/v2"

"k8s.io/cloud-provider-aws/pkg/providers/v1/variant"
)

func init() {
Expand Down Expand Up @@ -231,8 +233,9 @@ func (tc *Controller) process() bool {
}
klog.Infof("Instance ID of work item %s is %s", workItem, instanceID)

if awsv1.IsFargateNode(string(instanceID)) {
klog.Infof("Skip processing the node %s since it is a Fargate node", instanceID)
if variant.IsVariantNode(string(instanceID)) {
klog.Infof("Skip processing the node %s since it is a %s node",
instanceID, variant.NodeType(string(instanceID)))
tc.workqueue.Forget(obj)
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/controllers/tagging/tagging_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/util/workqueue"
awsv1 "k8s.io/cloud-provider-aws/pkg/providers/v1"
"k8s.io/cloud-provider-aws/pkg/providers/v1/config"
"k8s.io/klog/v2"
)

Expand Down Expand Up @@ -133,7 +134,7 @@ func Test_NodesJoiningAndLeaving(t *testing.T) {
},
},
toBeTagged: true,
expectedMessages: []string{"Skip processing the node fargate-ip-10-0-55-27.us-west-2.compute.internal since it is a Fargate node"},
expectedMessages: []string{"Skip processing the node fargate-ip-10-0-55-27.us-west-2.compute.internal since it is a fargate node"},
},
{
name: "node0 leaves the cluster, failed to untag.",
Expand Down Expand Up @@ -194,7 +195,7 @@ func Test_NodesJoiningAndLeaving(t *testing.T) {
}

awsServices := awsv1.NewFakeAWSServices(TestClusterID)
fakeAws, _ := awsv1.NewAWSCloud(awsv1.CloudConfig{}, awsServices)
fakeAws, _ := awsv1.NewAWSCloud(config.CloudConfig{}, awsServices)

for _, testcase := range testcases {
t.Run(testcase.name, func(t *testing.T) {
Expand Down
Loading

0 comments on commit e6456fd

Please sign in to comment.