You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by ch...@apache.org on 2024/07/10 13:55:49 UTC

(yunikorn-k8shim) branch master updated: [YUNIKORN2729] remove --new-from-rev from Makefile (#875)

This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new 81051230 [YUNIKORN2729] remove --new-from-rev from Makefile (#875)
81051230 is described below

commit 8105123032892c47f1d90c91c87a1fa3e8c6427a
Author: rich7420 <rc...@gmail.com>
AuthorDate: Wed Jul 10 21:55:25 2024 +0800

    [YUNIKORN2729] remove --new-from-rev from Makefile (#875)
    
    Closes: #875
    
    Signed-off-by: Chia-Ping Tsai <ch...@gmail.com>
---
 Makefile                                           |  2 +-
 pkg/cache/context.go                               |  2 +-
 pkg/cache/task_state_test.go                       | 26 +++++++++++-----------
 pkg/cache/task_test.go                             |  1 +
 pkg/client/kubeclient.go                           |  1 -
 pkg/cmd/shim/main.go                               |  3 ++-
 pkg/plugin/predicates/predicate_manager_test.go    |  2 +-
 test/e2e/framework/helpers/common/utils.go         |  1 +
 test/e2e/gang_scheduling/gang_scheduling_test.go   |  8 +++----
 .../spark_jobs_scheduling_test.go                  | 10 +++------
 10 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 5c5ea7c6..030a68b1 100644
--- a/Makefile
+++ b/Makefile
@@ -291,7 +291,7 @@ lint: $(GOLANGCI_LINT_BIN)
 	@git symbolic-ref -q HEAD && REV="origin/HEAD" || REV="HEAD^" ; \
 	headSHA=$$(git rev-parse --short=12 $${REV}) ; \
 	echo "checking against commit sha $${headSHA}" ; \
-	"${GOLANGCI_LINT_BIN}" run --new-from-rev=$${headSHA}
+	"${GOLANGCI_LINT_BIN}" run
 
 # Check scripts
 .PHONY: check_scripts
diff --git a/pkg/cache/context.go b/pkg/cache/context.go
index f2870519..f9abaed6 100644
--- a/pkg/cache/context.go
+++ b/pkg/cache/context.go
@@ -809,7 +809,7 @@ func (ctx *Context) AssumePod(name, node string) error {
 			// assume pod volumes, this will update bindings info in cache
 			// assume pod volumes before assuming the pod
 			// this will update scheduler cache with essential PV/PVC binding info
-			var allBound = true
+			var allBound bool
 			var err error
 			// retrieve the volume claims
 			podVolumeClaims, err := ctx.apiProvider.GetAPIs().VolumeBinder.GetPodVolumeClaims(ctx.klogger, pod)
diff --git a/pkg/cache/task_state_test.go b/pkg/cache/task_state_test.go
index bca7a224..57b69f36 100644
--- a/pkg/cache/task_state_test.go
+++ b/pkg/cache/task_state_test.go
@@ -1,19 +1,19 @@
 /*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
 
-     http://www.apache.org/licenses/LICENSE-2.0
+	http://www.apache.org/licenses/LICENSE-2.0
 
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
 package cache
 
diff --git a/pkg/cache/task_test.go b/pkg/cache/task_test.go
index 41cebf79..2e2faf8f 100644
--- a/pkg/cache/task_test.go
+++ b/pkg/cache/task_test.go
@@ -148,6 +148,7 @@ func TestTaskIllegalEventHandling(t *testing.T) {
 	assert.Equal(t, task.GetTaskState(), TaskStates().Pending)
 }
 
+//nolint:funlen
 func TestReleaseTaskAllocation(t *testing.T) {
 	mockedSchedulerApi := newMockSchedulerAPI()
 	mockedContext := initContextForTest()
diff --git a/pkg/client/kubeclient.go b/pkg/client/kubeclient.go
index fba506c9..ef8393ae 100644
--- a/pkg/client/kubeclient.go
+++ b/pkg/client/kubeclient.go
@@ -138,7 +138,6 @@ func (nc SchedulerKubeClient) Create(pod *v1.Pod) (*v1.Pod, error) {
 }
 
 func (nc SchedulerKubeClient) Delete(pod *v1.Pod) error {
-	// TODO make this configurable for pods
 	gracefulSeconds := int64(3)
 	if err := nc.clientSet.CoreV1().Pods(pod.Namespace).Delete(context.Background(), pod.Name, apis.DeleteOptions{
 		GracePeriodSeconds: &gracefulSeconds,
diff --git a/pkg/cmd/shim/main.go b/pkg/cmd/shim/main.go
index 5d31e6a8..b053194c 100644
--- a/pkg/cmd/shim/main.go
+++ b/pkg/cmd/shim/main.go
@@ -23,9 +23,10 @@ import (
 	"os/signal"
 	"syscall"
 
+	"go.uber.org/zap"
+
 	"github.com/apache/yunikorn-k8shim/pkg/client"
 	"github.com/apache/yunikorn-k8shim/pkg/common/constants"
-	"go.uber.org/zap"
 
 	"github.com/apache/yunikorn-core/pkg/entrypoint"
 	"github.com/apache/yunikorn-k8shim/pkg/conf"
diff --git a/pkg/plugin/predicates/predicate_manager_test.go b/pkg/plugin/predicates/predicate_manager_test.go
index 96beb38e..24c7d919 100644
--- a/pkg/plugin/predicates/predicate_manager_test.go
+++ b/pkg/plugin/predicates/predicate_manager_test.go
@@ -221,7 +221,7 @@ func newPod(host string, hostPortInfos ...string) *v1.Pod {
 	for _, portInfo := range hostPortInfos {
 		split := strings.Split(portInfo, "/")
 		//nolint:errcheck
-		hostPort, _ := strconv.Atoi(split[2])
+		hostPort, _ := strconv.ParseInt(split[2], 10, 32)
 
 		networkPorts = append(networkPorts, v1.ContainerPort{
 			HostIP:   split[1],
diff --git a/test/e2e/framework/helpers/common/utils.go b/test/e2e/framework/helpers/common/utils.go
index ed4f130d..fc26c77c 100644
--- a/test/e2e/framework/helpers/common/utils.go
+++ b/test/e2e/framework/helpers/common/utils.go
@@ -102,6 +102,7 @@ func RandSeq(n int) string {
 	var letters = []rune("abcdefghijklmnopqrstuvwxyz0123456789")
 	b := make([]rune, n)
 	for i := range b {
+		//nolint:gosec
 		b[i] = letters[rand.Intn(len(letters))]
 	}
 	return string(b)
diff --git a/test/e2e/gang_scheduling/gang_scheduling_test.go b/test/e2e/gang_scheduling/gang_scheduling_test.go
index 7169a45b..a4aa85bb 100644
--- a/test/e2e/gang_scheduling/gang_scheduling_test.go
+++ b/test/e2e/gang_scheduling/gang_scheduling_test.go
@@ -708,12 +708,12 @@ func verifyOriginatorDeletionCase(withOwnerRef bool) {
 			},
 		}
 		defer func() {
-			err := kClient.DeleteConfigMap(testConfigmap.Name, ns)
-			Ω(err).NotTo(HaveOccurred())
+			deleteErr := kClient.DeleteConfigMap(testConfigmap.Name, ns)
+			Ω(deleteErr).NotTo(HaveOccurred())
 		}()
 
-		testConfigmap, err := kClient.CreateConfigMap(testConfigmap, ns)
-		Ω(err).NotTo(HaveOccurred())
+		testConfigmap, testErr := kClient.CreateConfigMap(testConfigmap, ns)
+		Ω(testErr).NotTo(HaveOccurred())
 
 		podTest.OwnerReferences = []metav1.OwnerReference{
 			{
diff --git a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
index 8dc4821a..4bd2ad21 100644
--- a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
+++ b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
@@ -43,7 +43,7 @@ var _ = Describe("", func() {
 
 	var kClient k8s.KubeCtl
 	var restClient yunikorn.RClient
-	var err error
+	var exErr error
 	var sparkNS = "spark-" + common.RandSeq(10)
 	var svcAcc = "svc-acc-" + common.RandSeq(10)
 	var config *rest.Config
@@ -51,10 +51,6 @@ var _ = Describe("", func() {
 	var roleName = "spark-jobs-role-" + common.RandSeq(5)
 	var clusterEditRole = "edit"
 	var sparkImage = os.Getenv("SPARK_PYTHON_IMAGE")
-	var sparkHome = os.Getenv("SPARK_HOME")
-	if sparkHome == "" {
-		sparkHome = "/usr/local/"
-	}
 	var sparkExecutorCount = 3
 
 	BeforeEach(func() {
@@ -62,7 +58,7 @@ var _ = Describe("", func() {
 		Ω(sparkImage).NotTo(BeEmpty())
 		kClient = k8s.KubeCtl{}
 		Ω(kClient.SetClient()).To(BeNil())
-		Ω(err).NotTo(HaveOccurred())
+		Ω(exErr).NotTo(HaveOccurred())
 		By(fmt.Sprintf("Creating namespace: %s for spark jobs", sparkNS))
 		ns1, err := kClient.CreateNamespace(sparkNS, nil)
 		Ω(err).NotTo(HaveOccurred())
@@ -158,7 +154,7 @@ var _ = Describe("", func() {
 
 		By("Killing all spark jobs")
 		// delete the Spark pods one by one
-		err = kClient.DeletePods(sparkNS)
+		err := kClient.DeletePods(sparkNS)
 		Ω(err).NotTo(HaveOccurred())
 
 		By("Deleting cluster role bindings ")


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org