From 676969bf1a03b84b9aacf0ff7e0ffa97b9ffb50b Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 14 Aug 2023 13:00:32 -0400 Subject: [PATCH 1/6] Removing deprecated ioutil --- internal/monitor/integration_steps_test.go | 3 +-- internal/monitor/node.go | 5 ++--- test/podmontest/podmontest.go | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/monitor/integration_steps_test.go b/internal/monitor/integration_steps_test.go index 24f87e8a..2edefbe8 100644 --- a/internal/monitor/integration_steps_test.go +++ b/internal/monitor/integration_steps_test.go @@ -19,7 +19,6 @@ package monitor import ( "context" "fmt" - "io/ioutil" "math" "os" "os/exec" @@ -1091,7 +1090,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error { return mkDirErr } - files, err := ioutil.ReadDir(i.scriptsDir) + files, err := os.ReadDir(i.scriptsDir) if err != nil { return err } diff --git a/internal/monitor/node.go b/internal/monitor/node.go index 679015ce..e86a03dd 100644 --- a/internal/monitor/node.go +++ b/internal/monitor/node.go @@ -20,7 +20,6 @@ import ( "context" "errors" "fmt" - "io/ioutil" "os" "podmon/internal/criapi" "podmon/internal/k8sapi" @@ -178,7 +177,7 @@ func (pm *PodMonitorType) nodeModePodHandler(pod *v1.Pod, eventType watch.EventT // Scan for mounts csiVolumesPath := fmt.Sprintf(CSIVolumePathFormat, string(pod.ObjectMeta.UID)) log.Debugf("csiVolumesPath: %s", csiVolumesPath) - volumeEntries, err := ioutil.ReadDir(csiVolumesPath) + volumeEntries, err := os.ReadDir(csiVolumesPath) if err != nil && !os.IsNotExist(err) { log.WithFields(fields).Errorf("Couldn't read directory %s: %s", csiVolumesPath, err.Error()) return err @@ -206,7 +205,7 @@ func (pm *PodMonitorType) nodeModePodHandler(pod *v1.Pod, eventType watch.EventT // Scan for block devices csiDevicesPath := fmt.Sprintf(CSIDevicePathFormat, string(pod.ObjectMeta.UID)) log.Infof("csiDevicesPath: %s", csiDevicesPath) - deviceEntries, err := ioutil.ReadDir(csiDevicesPath) + deviceEntries, err := os.ReadDir(csiDevicesPath) if err != nil && !os.IsNotExist(err) { log.WithFields(fields).Errorf("Couldn't read directory %s: %s", csiDevicesPath, err.Error()) return err diff --git a/test/podmontest/podmontest.go b/test/podmontest/podmontest.go index fbe265b5..306a4d23 100644 --- a/test/podmontest/podmontest.go +++ b/test/podmontest/podmontest.go @@ -21,7 +21,6 @@ import ( "crypto/rand" "flag" "fmt" - "io/ioutil" "os" "strings" "time" @@ -66,7 +65,7 @@ func readExistingEntries(rootDir string) bool { reportedOtherKeys := make(map[string]bool) initialPod := true - entries, err := ioutil.ReadDir(rootDir) + entries, err := os.ReadDir(rootDir) if err != nil { fmt.Printf("Couldn't read %s\n", rootDir) return true @@ -136,7 +135,7 @@ var counter int func makeEntry(podTag, rootDir string, index int, initialPod bool) { tag := fmt.Sprintf("%x %s\n", podTag, time.Now().Format(time.Stamp)) - entries, err := ioutil.ReadDir(rootDir) + entries, err := os.ReadDir(rootDir) if err != nil { fmt.Printf("Couldn't read %s\n", rootDir) return From e04eab96b7c553b5775ca6b504932337f7d9acec Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 14 Aug 2023 15:31:17 -0400 Subject: [PATCH 2/6] test change --- internal/monitor/integration_steps_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/monitor/integration_steps_test.go b/internal/monitor/integration_steps_test.go index 2edefbe8..43e6c12f 100644 --- a/internal/monitor/integration_steps_test.go +++ b/internal/monitor/integration_steps_test.go @@ -1102,7 +1102,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error { } } - // After copying the files, add execute permissions and list the directory + // After copying the files, add execute permissions and list thee directory lsDirCmd := fmt.Sprintf("chmod +x %s/* ; ls -ltr %s", remoteScriptDir, remoteScriptDir) if lsErr := client.Run(lsDirCmd); lsErr == nil { for _, out := range client.GetOutput() { From 3969b04df7444508ebe2302dba9385198de98473 Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 14 Aug 2023 15:33:52 -0400 Subject: [PATCH 3/6] Revert test change --- internal/monitor/integration_steps_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/monitor/integration_steps_test.go b/internal/monitor/integration_steps_test.go index 43e6c12f..2edefbe8 100644 --- a/internal/monitor/integration_steps_test.go +++ b/internal/monitor/integration_steps_test.go @@ -1102,7 +1102,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error { } } - // After copying the files, add execute permissions and list thee directory + // After copying the files, add execute permissions and list the directory lsDirCmd := fmt.Sprintf("chmod +x %s/* ; ls -ltr %s", remoteScriptDir, remoteScriptDir) if lsErr := client.Run(lsDirCmd); lsErr == nil { for _, out := range client.GetOutput() { From 07c5a2f9813eb77bebbde8b058d6095c3a7f9ec1 Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 14 Aug 2023 16:32:56 -0400 Subject: [PATCH 4/6] test workflow change --- internal/monitor/integration_steps_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/monitor/integration_steps_test.go b/internal/monitor/integration_steps_test.go index 2edefbe8..43e6c12f 100644 --- a/internal/monitor/integration_steps_test.go +++ b/internal/monitor/integration_steps_test.go @@ -1102,7 +1102,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error { } } - // After copying the files, add execute permissions and list the directory + // After copying the files, add execute permissions and list thee directory lsDirCmd := fmt.Sprintf("chmod +x %s/* ; ls -ltr %s", remoteScriptDir, remoteScriptDir) if lsErr := client.Run(lsDirCmd); lsErr == nil { for _, out := range client.GetOutput() { From 2e2bbfea0dfcb929c609b56ddb98291a81a5cef2 Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 14 Aug 2023 16:34:15 -0400 Subject: [PATCH 5/6] Removing test Signed-off-by: arnchiequ-dell --- internal/monitor/integration_steps_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/monitor/integration_steps_test.go b/internal/monitor/integration_steps_test.go index 43e6c12f..2edefbe8 100644 --- a/internal/monitor/integration_steps_test.go +++ b/internal/monitor/integration_steps_test.go @@ -1102,7 +1102,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error { } } - // After copying the files, add execute permissions and list thee directory + // After copying the files, add execute permissions and list the directory lsDirCmd := fmt.Sprintf("chmod +x %s/* ; ls -ltr %s", remoteScriptDir, remoteScriptDir) if lsErr := client.Run(lsDirCmd); lsErr == nil { for _, out := range client.GetOutput() { From 5ae0b9bb5ac24efb7417287632f16575d2e3ed39 Mon Sep 17 00:00:00 2001 From: arnchiequ-dell Date: Mon, 21 Aug 2023 11:21:21 -0400 Subject: [PATCH 6/6] Updating go version --- .github/workflows/actions.yml | 4 ++-- .github/workflows/linters.yaml | 2 +- go.mod | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 477c3aa6..386718d5 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -72,10 +72,10 @@ jobs: name: Image Scanner runs-on: ubuntu-latest steps: - - name: Set up Go 1.20+ + - name: Set up Go 1.21+ uses: actions/setup-go@v4 with: - go-version: ^1.20 + go-version: ^1.21 cache: false id: go - name: Checkout the code diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index e7aad32e..87494023 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: "1.20" + go-version: "1.21" cache: false - name: Checkout the code uses: actions/checkout@v3.2.0 diff --git a/go.mod b/go.mod index 02c0c200..e741eefa 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module podmon -go 1.20 +go 1.21 require ( github.com/bramvdbogaerde/go-scp v0.0.0-20201229172121-7a6c0268fa67