Skip to content

Commit

Permalink
chore(deps): bump golangci-lint from v1.51.2 to v1.53.3 (#7334)
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana authored and kumahq[bot] committed Sep 25, 2023
1 parent 4de28c4 commit 4a9c16f
Show file tree
Hide file tree
Showing 41 changed files with 182 additions and 78 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Golangci-lint
on:
push:
pull_request:
permissions:
contents: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
cache: false
go-version: 1.20.5
- uses: golangci/golangci-lint-action@v3
with:
args: --verbose
version: v1.53.3
2 changes: 1 addition & 1 deletion app/kumactl/cmd/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var _ = Describe("kumactl get ", func() {
It("should have get commands for all defined types", func() {
// when
all := registry.Global().ObjectDescriptors(model.HasKumactlEnabled())
Expect(len(getCmd.Commands()) > len(all)).To(BeTrue())
Expect(len(getCmd.Commands())).To(BeNumerically(">", len(all)))

// then
for _, sub := range all {
Expand Down
4 changes: 4 additions & 0 deletions mk/dependencies/deps.lock
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
50cf4b94403bc1e03c8ca18db970b193881ef991
=======
ddcb18fef158bd55f6534f1a4ab75af4f9db3b6f
>>>>>>> 409438fbc (chore(deps): bump golangci-lint from v1.51.2 to v1.53.3 (#7334))
7 changes: 7 additions & 0 deletions mk/dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ endif
CI_TOOLS_BIN_DIR=$(CI_TOOLS_DIR)/bin

# Change here and `make check` ensures these are used for CI
<<<<<<< HEAD
K8S_MIN_VERSION = v1.20.15-k3s1
K8S_MAX_VERSION = v1.26.1-k3s1
GO_VERSION := 1.21.1
=======
K8S_MIN_VERSION = v1.22.9-k3s1
K8S_MAX_VERSION = v1.27.1-k3s1
export GO_VERSION=1.20.5
export GOLANGCI_LINT_VERSION=v1.53.3
>>>>>>> 409438fbc (chore(deps): bump golangci-lint from v1.51.2 to v1.53.3 (#7334))
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)

Expand Down
2 changes: 1 addition & 1 deletion pkg/core/logs/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ var _ = Describe("Matcher", func() {

// then
Expect(err).ToNot(HaveOccurred())
Expect(log).To(HaveLen(0))
Expect(log).To(BeEmpty())
})

It("should skip unknown backends", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var _ = Describe("DataplaneInsight Manager", func() {
Expect(err).ToNot(HaveOccurred())

// then
Expect(actual.Spec.Subscriptions).To(HaveLen(0))
Expect(actual.Spec.Subscriptions).To(BeEmpty())
Expect(actual.Spec.Subscriptions).To(BeNil())
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("ZoneEgressInsight Manager", func() {
Expect(err).ToNot(HaveOccurred())

// then
Expect(actual.Spec.Subscriptions).To(HaveLen(0))
Expect(actual.Spec.Subscriptions).To(BeEmpty())
Expect(actual.Spec.Subscriptions).To(BeNil())
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("ZoneIngressInsight Manager", func() {
Expect(err).ToNot(HaveOccurred())

// then
Expect(actual.Spec.Subscriptions).To(HaveLen(0))
Expect(actual.Spec.Subscriptions).To(BeEmpty())
Expect(actual.Spec.Subscriptions).To(BeNil())
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("ZoneInsight Manager", func() {
Expect(err).ToNot(HaveOccurred())

// then
Expect(actual.Spec.Subscriptions).To(HaveLen(0))
Expect(actual.Spec.Subscriptions).To(BeEmpty())
Expect(actual.Spec.Subscriptions).To(BeNil())
})
})
2 changes: 1 addition & 1 deletion pkg/intercp/catalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ var _ = Describe("Catalog", func() {

// then
Expect(err).ToNot(HaveOccurred())
Expect(instances).To(HaveLen(0))
Expect(instances).To(BeEmpty())
})

It("should handle IPV6 addresses when building inter cp URL", func() {
Expand Down
16 changes: 5 additions & 11 deletions pkg/kds/server/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func New(
insight bool,
nackBackoff time.Duration,
) (Server, error) {
hasher, cache := newKDSContext(log)
hashFn, cache := newKDSContext(log)
generator := reconcile.NewSnapshotGenerator(rt.ReadOnlyResourceManager(), providedTypes, filter, mapper)
versioner := util_xds_v3.SnapshotAutoVersioner{UUID: core.NewUUID}
statsCallbacks, err := util_xds.NewStatsCallbacks(rt.Metrics(), "kds")
if err != nil {
return nil, err
}
reconciler := reconcile.NewReconciler(hasher, cache, generator, versioner, rt.Config().Mode, statsCallbacks)
reconciler := reconcile.NewReconciler(hashFn, cache, generator, versioner, rt.Config().Mode, statsCallbacks)
syncTracker, err := newSyncTracker(log, reconciler, refresh, rt.Metrics())
if err != nil {
return nil, err
Expand Down Expand Up @@ -114,14 +114,8 @@ func newSyncTracker(log logr.Logger, reconciler reconcile.Reconciler, refresh ti
}), nil
}

func newKDSContext(log logr.Logger) (envoy_cache.NodeHash, util_xds_v3.SnapshotCache) {
hasher := hasher{}
func newKDSContext(log logr.Logger) (envoy_cache.NodeHash, util_xds_v3.SnapshotCache) { //nolint:unparam
hashFn := util_xds_v3.IDHash{}
logger := util_xds.NewLogger(log)
return hasher, util_xds_v3.NewSnapshotCache(false, hasher, logger)
}

type hasher struct{}

func (_ hasher) ID(node *envoy_core.Node) string {
return node.Id
return hashFn, util_xds_v3.NewSnapshotCache(false, hashFn, logger)
}
2 changes: 1 addition & 1 deletion pkg/kds/v2/client/zone_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var _ = Describe("Zone Delta Sync", func() {
actual := mesh.MeshResourceList{}
err := zoneStore.List(context.Background(), &actual)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(actual.Items).To(HaveLen(0))
g.Expect(actual.Items).To(BeEmpty())
}, "5s", "100ms").Should(Succeed())
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/kds/v2/server/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func newSyncTracker(log logr.Logger, reconciler reconcile_v2.Reconciler, refresh
}), nil
}

func newKDSContext(log logr.Logger) (envoy_cache.NodeHash, envoy_cache.SnapshotCache) {
func newKDSContext(log logr.Logger) (envoy_cache.NodeHash, envoy_cache.SnapshotCache) { //nolint:unparam
hasher := hasher{}
logger := util_xds.NewLogger(log)
return hasher, envoy_cache.NewSnapshotCache(false, hasher, logger)
Expand Down
2 changes: 1 addition & 1 deletion pkg/mads/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var _ = Describe("MADS Server", func() {

assignments, err := stream.WaitForAssignments()
Expect(err).ToNot(HaveOccurred())
Expect(assignments).To(HaveLen(0))
Expect(assignments).To(BeEmpty())
})

It("should serve HTTP/1.1 requests", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/resources/k8s/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ var _ = Describe("KubernetesStore", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(trl.Items).To(HaveLen(0))
Expect(trl.Items).To(BeEmpty())
})

It("should return a list of matching resource", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ var _ = Describe("NamespaceReconciler", func() {
nads := &v1.NetworkAttachmentDefinitionList{}
err = kubeClient.List(context.Background(), nads)
Expect(err).ToNot(HaveOccurred())
Expect(nads.Items).To(HaveLen(0))
Expect(nads.Items).To(BeEmpty())
})

It("should ignore namespace namespaces without label", func() {
Expand All @@ -189,7 +189,7 @@ var _ = Describe("NamespaceReconciler", func() {
nads := &v1.NetworkAttachmentDefinitionList{}
err = kubeClient.List(context.Background(), nads)
Expect(err).ToNot(HaveOccurred())
Expect(nads.Items).To(HaveLen(0))
Expect(nads.Items).To(BeEmpty())
})

It("should skip creating NetworkAttachmentDefinition when CRD is absent in the cluster", func() {
Expand All @@ -212,6 +212,6 @@ var _ = Describe("NamespaceReconciler", func() {
nads := &v1.NetworkAttachmentDefinitionList{}
err = kubeClient.List(context.Background(), nads)
Expect(err).ToNot(HaveOccurred())
Expect(nads.Items).To(HaveLen(0))
Expect(nads.Items).To(BeEmpty())
})
})
8 changes: 4 additions & 4 deletions pkg/plugins/runtime/k8s/controllers/pod_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ var _ = Describe("PodReconciler", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(dataplanes.Items).To(HaveLen(0))
Expect(dataplanes.Items).To(BeEmpty())
})

It("should ignore Pods without Kuma sidecar", func() {
Expand All @@ -330,7 +330,7 @@ var _ = Describe("PodReconciler", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(dataplanes.Items).To(HaveLen(0))
Expect(dataplanes.Items).To(BeEmpty())
})

It("should not reconcile Ingress with namespace other than system", func() {
Expand Down Expand Up @@ -407,7 +407,7 @@ var _ = Describe("PodReconciler", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(dataplanes.Items).To(HaveLen(0))
Expect(dataplanes.Items).To(BeEmpty())
})

It("should ignore Pods without IP address", func() {
Expand All @@ -430,7 +430,7 @@ var _ = Describe("PodReconciler", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(dataplanes.Items).To(HaveLen(0))
Expect(dataplanes.Items).To(BeEmpty())
})

It("should generate Dataplane resource for every Pod that has Kuma sidecar injected", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/secrets/k8s/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ var _ = Describe("KubernetesStore", func() {
// then
Expect(err).ToNot(HaveOccurred())
// and
Expect(secrets.Items).To(HaveLen(0))
Expect(secrets.Items).To(BeEmpty())
})

Describe("with resources loaded", func() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/test/store/store_test_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func ExecuteStoreTests(
// and
Expect(list.Pagination.Total).To(Equal(uint32(0)))
// and
Expect(list.Items).To(HaveLen(0))
Expect(list.Items).To(BeEmpty())
})

It("should return a list of resources", func() {
Expand Down Expand Up @@ -338,7 +338,7 @@ func ExecuteStoreTests(
// and
Expect(list.Pagination.Total).To(Equal(uint32(0)))
// and
Expect(list.Items).To(HaveLen(0))
Expect(list.Items).To(BeEmpty())
})

It("should return a list of resources with prefix from all meshes", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/xds/sync/dataplane_watchdog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var _ = Describe("Dataplane Watchdog", func() {
var ctx context.Context

BeforeEach(func() {
Expect(samples.MeshDefaultBuilder().Create(resManager))
Expect(samples.MeshDefaultBuilder().Create(resManager)).To(Succeed())
Expect(samples.DataplaneBackendBuilder().Create(resManager)).To(Succeed())
resKey = core_model.MetaToResourceKey(samples.DataplaneBackend().GetMeta())

Expand Down
4 changes: 2 additions & 2 deletions test/blackbox_network_tests/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ var _ = Describe("Outbound IPv4 DNS/UDP traffic to port 53 only for addresses in

// and do not redirect any dns request
Eventually(ns.UnsafeExec(func() {
Expect(udp.DialUDPAddrWithHelloMsgAndGetReply(randomAddressDnsRequest, randomAddressDnsRequest))
Expect(udp.DialUDPAddrWithHelloMsgAndGetReply(randomAddressDnsRequest, randomAddressDnsRequest)).To(Succeed())
})).ShouldNot(BeClosed())

// then
Expand Down Expand Up @@ -880,7 +880,7 @@ var _ = Describe("Outbound IPv6 DNS/UDP traffic to port 53 only for addresses in

// and do not redirect any dns request
Eventually(ns.UnsafeExec(func() {
Expect(udp.DialUDPAddrWithHelloMsgAndGetReply(randomAddressDnsRequest, randomAddressDnsRequest))
Expect(udp.DialUDPAddrWithHelloMsgAndGetReply(randomAddressDnsRequest, randomAddressDnsRequest)).To(Succeed())
})).ShouldNot(BeClosed())

// then
Expand Down
87 changes: 87 additions & 0 deletions test/e2e_env/kubernetes/connectivity/headless_services.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package connectivity

import (
"github.com/gruntwork-io/terratest/modules/k8s"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"

. "github.com/kumahq/kuma/test/framework"
"github.com/kumahq/kuma/test/framework/client"
"github.com/kumahq/kuma/test/framework/deployments/testserver"
"github.com/kumahq/kuma/test/framework/envs/kubernetes"
)

func HeadlessServices() {
meshName := "headless-svc"
namespace := "headless-svc"

BeforeAll(func() {
err := NewClusterSetup().
Install(MTLSMeshKubernetes(meshName)).
Install(NamespaceWithSidecarInjection(namespace)).
Install(testserver.Install(
testserver.WithName("demo-client"),
testserver.WithMesh(meshName),
testserver.WithNamespace(namespace),
)).
Install(testserver.Install(
testserver.WithName("test-server"),
testserver.WithMesh(meshName),
testserver.WithNamespace(namespace),
)).
Setup(kubernetes.Cluster)
Expect(err).ToNot(HaveOccurred())

err = k8s.RunKubectlE(
kubernetes.Cluster.GetTesting(),
kubernetes.Cluster.GetKubectlOptions(namespace),
"delete", "svc", "test-server", "-n", namespace,
)
Expect(err).ToNot(HaveOccurred())

// create headless service with port that is not the same as app port
headlessSvc := &corev1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "test-server-headless",
Namespace: namespace,
},
Spec: corev1.ServiceSpec{
Ports: []corev1.ServicePort{
{
Name: "main",
Port: int32(9090),
TargetPort: intstr.FromString("main"),
},
},
Selector: map[string]string{
"app": "test-server",
},
},
}
Expect(kubernetes.Cluster.Install(YamlK8sObject(headlessSvc))).To(Succeed())
})

E2EAfterAll(func() {
Expect(kubernetes.Cluster.TriggerDeleteNamespace(namespace)).To(Succeed())
Expect(kubernetes.Cluster.DeleteMesh(meshName)).To(Succeed())
})

It("should be able to connect to the headless service", func() {
Eventually(func(g Gomega) {
_, err := client.CollectEchoResponse(
kubernetes.Cluster,
"demo-client",
"test-server-headless:9090",
client.FromKubernetesPod(namespace, "demo-client"),
)
g.Expect(err).ToNot(HaveOccurred())
}, "30s", "1s").Should(Succeed())
})
}
2 changes: 1 addition & 1 deletion test/e2e_env/kubernetes/gateway/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:

g.Expect(err).ToNot(HaveOccurred())
g.Expect(response.Instance).To(Equal("kubernetes"))
}, "20s", "1s")
}, "20s", "1s").Should(Succeed())

By("allowing more than 1 connection without a limit")

Expand Down
2 changes: 1 addition & 1 deletion test/e2e_env/kubernetes/graceful/graceful.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ spec:

E2EAfterAll(func() {
Expect(kubernetes.Cluster.TriggerDeleteNamespace(namespace)).To(Succeed())
Expect(kubernetes.Cluster.DeleteMesh(mesh))
Expect(kubernetes.Cluster.DeleteMesh(mesh)).To(Succeed())
})

requestThroughGateway := func() error {
Expand Down
Loading

0 comments on commit 4a9c16f

Please sign in to comment.