Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions cmd/module-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"strconv"
"syscall"
)

Expand All @@ -56,21 +57,28 @@ func main() {
log.L = logruslogger.FromLogrus(logrus.NewEntry(logrus.StandardLogger()))
trace.T = opencensus.Adapter{}

clientID := uuid.New().String()
clientID := utils.GetEnv("CLIENT_ID", uuid.New().String())
env := utils.GetEnv("ENV", "dev")

ctx = log.WithLogger(ctx, log.G(ctx).WithFields(log.Fields{
"clientID": clientID,
"env": env,
"clientID": clientID,
"env": env,
"is_cluster": true,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use the 'isCluster' variable in the logging context.

The is_cluster field in the logging context is hardcoded to true. It should use the isCluster variable to accurately reflect the actual cluster configuration.

Apply this diff to fix the issue:

ctx = log.WithLogger(ctx, log.G(ctx).WithFields(log.Fields{
    "clientID":   clientID,
    "env":        env,
-   "is_cluster": true,
+   "is_cluster": isCluster,
}))

Committable suggestion was skipped due to low confidence.

}))

isCluster := utils.GetEnv("IS_CLUSTER", "") == "true"
workloadMaxLevel, err := strconv.Atoi(utils.GetEnv("WORKLOAD_MAX_LEVEL", "3"))

if err != nil {
log.G(ctx).WithError(err).Error("failed to parse WORKLOAD_MAX_LEVEL, will be set to 3 default")
}
Comment on lines +72 to +74
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Set 'workloadMaxLevel' to default value upon parsing error.

When parsing WORKLOAD_MAX_LEVEL fails, workloadMaxLevel may retain an invalid value. Assign a default value (e.g., 3) within the error handling block to ensure it's properly initialized.

Apply this diff to fix the issue:

if err != nil {
    log.G(ctx).WithError(err).Error("failed to parse WORKLOAD_MAX_LEVEL, will be set to 3 default")
+   workloadMaxLevel = 3
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if err != nil {
log.G(ctx).WithError(err).Error("failed to parse WORKLOAD_MAX_LEVEL, will be set to 3 default")
}
if err != nil {
log.G(ctx).WithError(err).Error("failed to parse WORKLOAD_MAX_LEVEL, will be set to 3 default")
workloadMaxLevel = 3
}


kubeConfig := config.GetConfigOrDie()
mgr, err := manager.New(kubeConfig, manager.Options{
Cache: cache.Options{},
Metrics: server.Options{
BindAddress: ":9090",
BindAddress: "0",
},
PprofBindAddress: ":9091",
})

if err != nil {
Expand All @@ -86,9 +94,11 @@ func main() {
}

rcc := vkModel.BuildVNodeControllerConfig{
ClientID: clientID,
Env: env,
VPodIdentity: model.ComponentModule,
ClientID: clientID,
Env: env,
VPodIdentity: model.ComponentModule,
IsCluster: isCluster,
WorkloadMaxLevel: workloadMaxLevel,
}

vc, err := vnode_controller.NewVNodeController(&rcc, []tunnel.Tunnel{
Expand Down
3 changes: 2 additions & 1 deletion common/model/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const (
BaseHeartBeatTopic = "koupleless_%s/+/base/heart"
BaseQueryBaselineTopic = "koupleless_%s/+/base/queryBaseline"
BaseHealthTopic = "koupleless_%s/%s/base/health"
BaseBizTopic = "koupleless_%s/%s/base/biz"
BaseSimpleBizTopic = "koupleless_%s/%s/base/simpleBiz"
BaseAllBizTopic = "koupleless_%s/%s/base/biz"
BaseBizOperationResponseTopic = "koupleless_%s/%s/base/bizOperation"
BaseBaselineResponseTopic = "koupleless_%s/%s/base/baseline"
)
Expand Down
4 changes: 4 additions & 0 deletions common/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ type QueryBaselineRequest struct {
type BuildModuleDeploymentControllerConfig struct {
Env string `json:"env"`
}

type ArkSimpleAllBizInfoData []ArkSimpleBizInfoData

type ArkSimpleBizInfoData []string
64 changes: 54 additions & 10 deletions common/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,75 @@ func TranslateHeartBeatDataToBaselineQuery(data model.Metadata) model.QueryBasel
}
}

func TranslateQueryAllBizDataToContainerStatuses(data []ark.ArkBizInfo) []vkModel.ContainerStatusData {
func TranslateBizInfosToContainerStatuses(data []ark.ArkBizInfo, changeTimestamp int64) []vkModel.ContainerStatusData {
ret := make([]vkModel.ContainerStatusData, 0)
for _, bizInfo := range data {
changeTime, reason, message := GetLatestState(bizInfo.BizState, bizInfo.BizStateRecords)
ret = append(ret, vkModel.ContainerStatusData{
updatedTime, reason, message := GetLatestState(bizInfo.BizState, bizInfo.BizStateRecords)
statusData := vkModel.ContainerStatusData{
Key: GetBizIdentity(bizInfo.BizName, bizInfo.BizVersion),
Name: bizInfo.BizName,
PodKey: vkModel.PodKeyAll,
State: GetContainerStateFromBizState(bizInfo.BizState),
ChangeTime: changeTime,
Reason: reason,
Message: message,
})
ChangeTime: time.UnixMilli(changeTimestamp),
}
if updatedTime.UnixMilli() != 0 {
statusData.ChangeTime = updatedTime
statusData.Reason = reason
statusData.Message = message
}
ret = append(ret, statusData)
}
return ret
}

func TranslateSimpleBizDataToBizInfos(data model.ArkSimpleAllBizInfoData) []ark.ArkBizInfo {
ret := make([]ark.ArkBizInfo, 0)
for _, simpleBizInfo := range data {
bizInfo := TranslateSimpleBizDataToArkBizInfo(simpleBizInfo)
if bizInfo == nil {
continue
}
ret = append(ret, *bizInfo)
}
return ret
}

func GetContainerStateFromBizState(bizState string) vkModel.ContainerState {
switch bizState {
func TranslateSimpleBizDataToArkBizInfo(data model.ArkSimpleBizInfoData) *ark.ArkBizInfo {
if len(data) < 3 {
return nil
}
bizName := data[0]
bizVersion := data[1]
bizStateIndex := data[2]
return &ark.ArkBizInfo{
BizName: bizName,
BizVersion: bizVersion,
BizState: GetArkBizStateFromSimpleBizState(bizStateIndex),
}
}
Comment on lines +138 to +150
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Verify handling of empty BizState in TranslateSimpleBizDataToArkBizInfo

When GetArkBizStateFromSimpleBizState(bizStateIndex) returns an empty string, the BizState field in the resulting ArkBizInfo will be empty. This might cause issues in downstream processing. Consider adding a check for this scenario and handling it appropriately, such as skipping the addition or setting a default state.


func GetContainerStateFromBizState(bizStateIndex string) vkModel.ContainerState {
switch bizStateIndex {
case "RESOLVED":
return vkModel.ContainerStateResolved
case "ACTIVATED":
return vkModel.ContainerStateActivated
case "DEACTIVATED":
return vkModel.ContainerStateDeactivated
}
return vkModel.ContainerStateResolved
return vkModel.ContainerStateWaiting
}
Comment on lines +152 to +162
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Rename parameter for clarity in GetContainerStateFromBizState

The parameter bizStateIndex in the function GetContainerStateFromBizState actually represents a business state string like "RESOLVED", "ACTIVATED", etc. For clarity, consider renaming the parameter to bizState to accurately reflect its purpose and improve code readability.


func GetArkBizStateFromSimpleBizState(bizStateIndex string) string {
switch bizStateIndex {
case "2":
return "RESOLVED"
case "3":
return "ACTIVATED"
case "4":
return "DEACTIVATED"
}
return ""
}
Comment on lines +164 to 174
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle unexpected bizStateIndex values in GetArkBizStateFromSimpleBizState

The function GetArkBizStateFromSimpleBizState returns an empty string when bizStateIndex does not match any of the expected cases ("2", "3", "4"). Consider handling unexpected bizStateIndex values explicitly by logging a warning or returning a default value to prevent potential issues in later stages of processing.


func GetLatestState(state string, records []ark.ArkBizStateRecord) (time.Time, string, string) {
Expand Down
139 changes: 134 additions & 5 deletions common/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/koupleless/arkctl/v1/service/ark"
"github.com/koupleless/module_controller/common/model"
vkModel "github.com/koupleless/virtual-kubelet/model"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -325,7 +327,7 @@ func TestTranslateHeartBeatDataToNodeInfo(t *testing.T) {
}
}

// Test cases for TranslateQueryAllBizDataToContainerStatuses function
// Test cases for TranslateSimpleBizDataToBizInfos function
func TestTranslateQueryAllBizDataToContainerStatuses(t *testing.T) {
tests := []struct {
data []ark.ArkBizInfo
Expand Down Expand Up @@ -391,9 +393,9 @@ func TestTranslateQueryAllBizDataToContainerStatuses(t *testing.T) {

for _, tt := range tests {
t.Run(tt.data[0].BizName, func(t *testing.T) {
actual := TranslateQueryAllBizDataToContainerStatuses(tt.data)
actual := TranslateBizInfosToContainerStatuses(tt.data, 0)
if !reflect.DeepEqual(actual, tt.expected) {
t.Errorf("TranslateQueryAllBizDataToContainerStatuses() = %+v; expected %+v", actual, tt.expected)
t.Errorf("TranslateSimpleBizDataToBizInfos() = %+v; expected %+v", actual, tt.expected)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct Function Name in Error Message

In the error message, the function name TranslateSimpleBizDataToBizInfos is outdated. It should be TranslateBizInfosToContainerStatuses to reflect the current function under test.

Apply this diff to correct the function name in the error message:

-t.Errorf("TranslateSimpleBizDataToBizInfos() = %+v; expected %+v", actual, tt.expected)
+t.Errorf("TranslateBizInfosToContainerStatuses() = %+v; expected %+v", actual, tt.expected)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
t.Errorf("TranslateSimpleBizDataToBizInfos() = %+v; expected %+v", actual, tt.expected)
t.Errorf("TranslateBizInfosToContainerStatuses() = %+v; expected %+v", actual, tt.expected)

}
})
}
Expand All @@ -406,13 +408,14 @@ func TestGetContainerStateFromBizState(t *testing.T) {
}{
{"ACTIVATED", vkModel.ContainerStateActivated},
{"DEACTIVATED", vkModel.ContainerStateDeactivated},
{"UNKNOWN", vkModel.ContainerStateResolved},
{"RESOLVED", vkModel.ContainerStateResolved},
{"", vkModel.ContainerStateWaiting},
}

for _, tc := range testCases {
result := GetContainerStateFromBizState(tc.input)
if result != tc.expected {
t.Errorf("GetContainerStateFromBizState(%s) = %v; want %v", tc.input, result, tc.expected)
t.Errorf("GetContainerStateFromSimpleBizState(%s) = %v; want %v", tc.input, result, tc.expected)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct Function Name in Error Message

The function name in the error message GetContainerStateFromSimpleBizState does not match the function being tested GetContainerStateFromBizState. Please update it for consistency.

Apply this diff to correct the function name:

-t.Errorf("GetContainerStateFromSimpleBizState(%s) = %v; want %v", tc.input, result, tc.expected)
+t.Errorf("GetContainerStateFromBizState(%s) = %v; want %v", tc.input, result, tc.expected)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
t.Errorf("GetContainerStateFromSimpleBizState(%s) = %v; want %v", tc.input, result, tc.expected)
t.Errorf("GetContainerStateFromBizState(%s) = %v; want %v", tc.input, result, tc.expected)

}
}
}
Expand Down Expand Up @@ -518,3 +521,129 @@ func TestGetLatestStateInvalidChangeTime(t *testing.T) {
t.Errorf("Expected message %s, got %s", expectedMessage, message)
}
}

func TestTranslateHealthDataToNodeStatus(t *testing.T) {
testCases := []struct {
input ark.HealthData
expected vkModel.NodeStatusData
}{
{
input: ark.HealthData{
Jvm: ark.JvmInfo{
JavaMaxMetaspace: 1024,
JavaCommittedMetaspace: 0,
},
},
expected: vkModel.NodeStatusData{
Resources: map[corev1.ResourceName]vkModel.NodeResource{
corev1.ResourceMemory: {
Capacity: resource.MustParse("1Ki"),
Allocatable: resource.MustParse("1Ki"),
},
},
},
},
}

for _, tc := range testCases {
result := TranslateHealthDataToNodeStatus(tc.input)
if result.Resources[corev1.ResourceMemory].Capacity != tc.expected.Resources[corev1.ResourceMemory].Capacity {
t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
}
if result.Resources[corev1.ResourceMemory].Allocatable != tc.expected.Resources[corev1.ResourceMemory].Allocatable {
t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
}
Comment on lines +551 to +555
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use 'Equal' Method for Comparing 'resource.Quantity'

When comparing resource.Quantity types, use the Equal method instead of the != operator. Direct comparison may not yield accurate results due to the internal representation of resource.Quantity.

Apply this diff to use the Equal method:

-if result.Resources[corev1.ResourceMemory].Capacity != tc.expected.Resources[corev1.ResourceMemory].Capacity {
+if !result.Resources[corev1.ResourceMemory].Capacity.Equal(tc.expected.Resources[corev1.ResourceMemory].Capacity) {
     t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
 }
-if result.Resources[corev1.ResourceMemory].Allocatable != tc.expected.Resources[corev1.ResourceMemory].Allocatable {
+if !result.Resources[corev1.ResourceMemory].Allocatable.Equal(tc.expected.Resources[corev1.ResourceMemory].Allocatable) {
     t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
 }

Committable suggestion was skipped due to low confidence.

}
}
Comment on lines +525 to +557
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure Accurate Comparison of Nested Structures

When comparing complex nested structures in tests, consider using assert.Equal or reflect.DeepEqual to ensure all fields are correctly compared.

Apply this change to enhance the test:

-    if result.Resources[corev1.ResourceMemory].Capacity != tc.expected.Resources[corev1.ResourceMemory].Capacity {
-        t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
-    }
-    if result.Resources[corev1.ResourceMemory].Allocatable != tc.expected.Resources[corev1.ResourceMemory].Allocatable {
-        t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
-    }
+    assert.Equal(t, tc.expected, result, "TranslateHealthDataToNodeStatus(%v) result mismatch", tc.input)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func TestTranslateHealthDataToNodeStatus(t *testing.T) {
testCases := []struct {
input ark.HealthData
expected vkModel.NodeStatusData
}{
{
input: ark.HealthData{
Jvm: ark.JvmInfo{
JavaMaxMetaspace: 1024,
JavaCommittedMetaspace: 0,
},
},
expected: vkModel.NodeStatusData{
Resources: map[corev1.ResourceName]vkModel.NodeResource{
corev1.ResourceMemory: {
Capacity: resource.MustParse("1Ki"),
Allocatable: resource.MustParse("1Ki"),
},
},
},
},
}
for _, tc := range testCases {
result := TranslateHealthDataToNodeStatus(tc.input)
if result.Resources[corev1.ResourceMemory].Capacity != tc.expected.Resources[corev1.ResourceMemory].Capacity {
t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
}
if result.Resources[corev1.ResourceMemory].Allocatable != tc.expected.Resources[corev1.ResourceMemory].Allocatable {
t.Errorf("TranslateHealthDataToNodeStatus(%v) = %v; want %v", tc.input, result, tc.expected)
}
}
}
func TestTranslateHealthDataToNodeStatus(t *testing.T) {
testCases := []struct {
input ark.HealthData
expected vkModel.NodeStatusData
}{
{
input: ark.HealthData{
Jvm: ark.JvmInfo{
JavaMaxMetaspace: 1024,
JavaCommittedMetaspace: 0,
},
},
expected: vkModel.NodeStatusData{
Resources: map[corev1.ResourceName]vkModel.NodeResource{
corev1.ResourceMemory: {
Capacity: resource.MustParse("1Ki"),
Allocatable: resource.MustParse("1Ki"),
},
},
},
},
}
for _, tc := range testCases {
result := TranslateHealthDataToNodeStatus(tc.input)
assert.Equal(t, tc.expected, result, "TranslateHealthDataToNodeStatus(%v) result mismatch", tc.input)
}
}


func TestTranslateHeartBeatDataToBaselineQuery(t *testing.T) {
testCases := []struct {
input model.Metadata
expected model.QueryBaselineRequest
}{
{
input: model.Metadata{
Name: "test",
Version: "1.0.0",
},
expected: model.QueryBaselineRequest{
Name: "test",
Version: "1.0.0",
CustomLabels: map[string]string{
model.LabelKeyOfTechStack: "java",
},
},
},
}

for _, tc := range testCases {
result := TranslateHeartBeatDataToBaselineQuery(tc.input)
if result.Name != tc.expected.Name || result.Version != tc.expected.Version || len(result.CustomLabels) != len(tc.expected.CustomLabels) {
t.Errorf("TranslateHeartBeatDataToBaselineQuery(%s) = %v; want %v", tc.input, result, tc.expected)
}
}
}

func TestTranslateSimpleBizDataToArkBizInfos(t *testing.T) {
testCases := []struct {
input model.ArkSimpleAllBizInfoData
expected []ark.ArkBizInfo
}{
{
input: model.ArkSimpleAllBizInfoData{
[]string{
"biz1", "0.0.1", "3",
},
[]string{},
},
expected: []ark.ArkBizInfo{
{
BizName: "biz1",
BizState: "ACTIVATED",
BizVersion: "0.0.1",
},
},
},
}

for _, tc := range testCases {
result := TranslateSimpleBizDataToBizInfos(tc.input)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update Function Call to Correct Function Name

The function TranslateSimpleBizDataToBizInfos called in the test does not exist. It should be TranslateSimpleBizDataToArkBizInfos to match the implemented function.

Apply this diff to update the function call:

-result := TranslateSimpleBizDataToBizInfos(tc.input)
+result := TranslateSimpleBizDataToArkBizInfos(tc.input)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
result := TranslateSimpleBizDataToBizInfos(tc.input)
result := TranslateSimpleBizDataToArkBizInfos(tc.input)

if len(result) != 1 {
t.Errorf("TranslateHeartBeatDataToBaselineQuery(%s) = %v; want %v", tc.input, result, tc.expected)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct Function Name in Error Message

The error message in t.Errorf incorrectly refers to TranslateHeartBeatDataToBaselineQuery. It should be TranslateSimpleBizDataToArkBizInfos to match the function being tested.

Apply this diff to correct the function name:

-t.Errorf("TranslateHeartBeatDataToBaselineQuery(%s) = %v; want %v", tc.input, result, tc.expected)
+t.Errorf("TranslateSimpleBizDataToArkBizInfos(%s) = %v; want %v", tc.input, result, tc.expected)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
t.Errorf("TranslateHeartBeatDataToBaselineQuery(%s) = %v; want %v", tc.input, result, tc.expected)
t.Errorf("TranslateSimpleBizDataToArkBizInfos(%s) = %v; want %v", tc.input, result, tc.expected)

}
}
}

func TestTranslateSimpleBizDataToArkBizInfo(t *testing.T) {
info := TranslateSimpleBizDataToArkBizInfo([]string{})
assert.Nil(t, info)
info = TranslateSimpleBizDataToArkBizInfo([]string{
"biz1", "0.0.1", "3",
})
assert.NotNil(t, info)
}

func TestGetArkBizStateFromSimpleBizState(t *testing.T) {
testCases := map[string]string{
"2": "RESOLVED",
"3": "ACTIVATED",
"4": "DEACTIVATED",
"123": "",
}
for input, expected := range testCases {
state := GetArkBizStateFromSimpleBizState(input)
assert.Equal(t, expected, state)
}
}

func TestGetLatestState_ChangeTimeLenLt3(t *testing.T) {
updatedTime, reason, message := GetLatestState("ACTIVATED", []ark.ArkBizStateRecord{
{
State: "ACTIVATED",
ChangeTime: "",
},
})
assert.Zero(t, updatedTime.UnixMilli())
assert.Empty(t, reason)
assert.Empty(t, message)
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/eclipse/paho.mqtt.golang v1.5.0
github.com/google/uuid v1.6.0
github.com/koupleless/arkctl v0.2.2-0.20240702132710-aba4f6ced448
github.com/koupleless/virtual-kubelet v0.2.2
github.com/koupleless/virtual-kubelet v0.3.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Unnecessary dependency on k8s.io/utils detected.

The k8s.io/utils module is listed in both go.mod and go.sum but does not appear to be required by any other dependencies. Consider removing it to simplify the dependency management.

  • Remove k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 from go.mod
🔗 Analysis chain

Verify compatibility with the updated virtual-kubelet version.

The github.com/koupleless/virtual-kubelet dependency has been updated from v0.2.2 to v0.3.0. This minor version update might introduce new features or changes that are not backward-compatible.

Please ensure the following:

  1. Check the changelog for any breaking changes or new features that might affect your code.
  2. Thoroughly test the application with this new version to ensure compatibility.
  3. Update any code that might be affected by changes in the new version.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Fetch the changelog or release notes for the new version
gh repo view github.com/koupleless/virtual-kubelet --json url -q .url.html_url | xargs -I {} echo "Please check the changelog at: {}/releases/tag/v0.3.0"

Length of output: 279


Script:

#!/bin/bash
# Identify direct dependencies that require k8s.io/utils
echo "Direct dependencies that might be using k8s.io/utils:"
# Search for import statements referencing k8s.io/utils in vendor directory
grep -rl 'k8s.io/utils' vendor/ || echo "No dependencies found using k8s.io/utils."

Length of output: 282


Script:

#!/bin/bash
# List all modules and identify which ones depend on k8s.io/utils
echo "Modules that depend on k8s.io/utils:"
go list -m all | grep 'k8s.io/utils' || echo "No modules depend on k8s.io/utils."

Length of output: 268


Script:

#!/bin/bash
# Search for k8s.io/utils in go.mod and go.sum
echo "Searching for 'k8s.io/utils' in go.mod and go.sum:"
grep 'k8s.io/utils' go.mod go.sum || echo "'k8s.io/utils' not found in go.mod or go.sum."

Length of output: 419

github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/sirupsen/logrus v1.9.3
Expand All @@ -17,6 +17,7 @@ require (
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/controller-runtime v0.19.0
)

Expand Down Expand Up @@ -79,7 +80,6 @@ require (
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down
25 changes: 2 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/koupleless/arkctl v0.2.2-0.20240702132710-aba4f6ced448 h1:+RS4uCLAhY/QsPr/HR7+GQdimSOEoEtzF5mW5FdEgfQ=
github.com/koupleless/arkctl v0.2.2-0.20240702132710-aba4f6ced448/go.mod h1:nbnAiPEv7x/ZDQ+QsjFWkqwxMDofGmqnFPHa3XpXHyE=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240905074001-df0ce8aedc2b h1:d7M4aJcyRCAXAC939g+Uf/1U0ual2p5i67ENjqWynQU=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240905074001-df0ce8aedc2b/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240919112519-bbc96f7614fc h1:SOkMIvlCgw+8CypvbgXPWSW/SgAmCqVReNp8BaDBQ8I=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240919112519-bbc96f7614fc/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240919125632-8c441f34609d h1:83oK1Wp8cZlxBpj5jk0EwbuF373DZZbTI+a4BKZBcJs=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240919125632-8c441f34609d/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920032706-1a49789fad23 h1:FUZRtcDE1PGQIrkn4FqeW3JqFtRlbwIfJVl/pevL1Bc=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920032706-1a49789fad23/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920035329-d02033168dab h1:hpPQOCXsbaMzxBLPsIPlg7YfXzHUxHNrBUT/jYihn/8=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920035329-d02033168dab/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920061256-67b28d0335ab h1:rBL98OJ3kH/FYCjqI37EDl5uJOiZeqm9NdU5e2t42s8=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920061256-67b28d0335ab/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920065827-fb6b06a41452 h1:cTOe4PxkSlWDA5nWbunUqGgp6Jmbg831k7nodFb369Y=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240920065827-fb6b06a41452/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240923032529-9b813c8f7750 h1:uxoCLVQ4nV49W/rwEDBc4ZY4IRBWS7ZbYH7OMurKxj4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240923032529-9b813c8f7750/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240923041130-b8ceb1901dd8 h1:O2i6j2dvJfgE2Chrf9Y2gv8Miyo1vGtFrPFOfItwKiI=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240923041130-b8ceb1901dd8/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240924074746-0210732eca6a h1:fzqOVopXWgM/+7Jf0FoQ6vMXR4cME1TZo1i7MjJtP2Y=
github.com/koupleless/virtual-kubelet v0.1.1-0.20240924074746-0210732eca6a/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.2.1/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.2.2 h1:PuLsNShfUh+iDUV1/RUHC4Onmzi+P+WfH3Zz4HLLMlo=
github.com/koupleless/virtual-kubelet v0.2.2/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/koupleless/virtual-kubelet v0.3.0 h1:IZXlK/ypKAgbWLJ5k4/kr661Q1oz4NKXLSJEB1biK+U=
github.com/koupleless/virtual-kubelet v0.3.0/go.mod h1:W64xRKk/hDpGW6WaJdxtY9KQHg0YKHeilBRm0ARxni4=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
Expand Down
Loading