Skip to content

Commit

Permalink
upgrade ubuntu and go version to make the ci pass
Browse files Browse the repository at this point in the history
Signed-off-by: changzhen <changzhen5@huawei.com>
  • Loading branch information
XiShanYongYe-Chang committed Feb 27, 2024
1 parent 9598309 commit 2beda5f
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ concurrency:
jobs:
golangci:
name: lint
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: checkout code
uses: actions/checkout@v3
- name: install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.5
go-version: 1.20.11
- name: lint
run: hack/verify-staticcheck.sh
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.5
go-version: 1.20.11
- name: Build
run: go build -v ./...
- name: Test
Expand Down
16 changes: 8 additions & 8 deletions fake/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *Provider) LoadBalancer() (multiclusterprovider.LoadBalancer, bool) {
}

// GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer.
func (p *Provider) GetLoadBalancer(ctx context.Context, mci *networkingv1alpha1.MultiClusterIngress) (*networkingv1.IngressLoadBalancerStatus, bool, error) {
func (p *Provider) GetLoadBalancer(_ context.Context, mci *networkingv1alpha1.MultiClusterIngress) (*networkingv1.IngressLoadBalancerStatus, bool, error) {
p.addCall("get")
namespacedName := types.NamespacedName{Namespace: mci.Namespace, Name: mci.Name}.String()
for name := range p.Balancers {
Expand All @@ -83,7 +83,7 @@ func (p *Provider) GetLoadBalancer(ctx context.Context, mci *networkingv1alpha1.
}

// EnsureLoadBalancer is a stub implementation of LoadBalancer.EnsureLoadBalancer.
func (p *Provider) EnsureLoadBalancer(ctx context.Context, mci *networkingv1alpha1.MultiClusterIngress) (status *networkingv1.IngressLoadBalancerStatus, err error) {
func (p *Provider) EnsureLoadBalancer(_ context.Context, mci *networkingv1alpha1.MultiClusterIngress) (status *networkingv1.IngressLoadBalancerStatus, err error) {
p.addCall("create")
if p.Balancers == nil {
p.Balancers = make(map[string]Balancer)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (p *Provider) EnsureLoadBalancer(ctx context.Context, mci *networkingv1alph
}

// UpdateLoadBalancer is a stub implementation of LoadBalancer.UpdateLoadBalancer.
func (p *Provider) UpdateLoadBalancer(ctx context.Context, mci *networkingv1alpha1.MultiClusterIngress) (status *networkingv1.IngressLoadBalancerStatus, err error) {
func (p *Provider) UpdateLoadBalancer(_ context.Context, mci *networkingv1alpha1.MultiClusterIngress) (status *networkingv1.IngressLoadBalancerStatus, err error) {
p.addCall("update")
namespacedName := types.NamespacedName{Namespace: mci.Namespace, Name: mci.Name}.String()
lb, exist := p.Balancers[namespacedName]
Expand All @@ -135,7 +135,7 @@ func (p *Provider) UpdateLoadBalancer(ctx context.Context, mci *networkingv1alph
}

// EnsureLoadBalancerDeleted is a stub implementation of LoadBalancer.EnsureLoadBalancerDeleted.
func (p *Provider) EnsureLoadBalancerDeleted(ctx context.Context, mci *networkingv1alpha1.MultiClusterIngress) error {
func (p *Provider) EnsureLoadBalancerDeleted(_ context.Context, mci *networkingv1alpha1.MultiClusterIngress) error {
p.addCall("delete")
namespacedName := types.NamespacedName{Namespace: mci.Namespace, Name: mci.Name}.String()
delete(p.Balancers, namespacedName)
Expand All @@ -149,7 +149,7 @@ func (p *Provider) MCSLoadBalancer() (multiclusterprovider.MCSLoadBalancer, bool
}

// GetMCSLoadBalancer is a stub implementation of LoadBalancer.GetMCSLoadBalancer.
func (p *Provider) GetMCSLoadBalancer(ctx context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, exist bool, err error) {
func (p *Provider) GetMCSLoadBalancer(_ context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, exist bool, err error) {
p.addCall("get")
namespacedName := types.NamespacedName{Namespace: mcs.Namespace, Name: mcs.Name}.String()
for name := range p.MCSBalancers {
Expand All @@ -164,7 +164,7 @@ func (p *Provider) GetMCSLoadBalancer(ctx context.Context, mcs *networkingv1alph
}

// EnsureMCSLoadBalancer is a stub implementation of LoadBalancer.EnsureMCSLoadBalancer.
func (p *Provider) EnsureMCSLoadBalancer(ctx context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, err error) {
func (p *Provider) EnsureMCSLoadBalancer(_ context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, err error) {
p.addCall("create")
if p.MCSBalancers == nil {
p.MCSBalancers = make(map[string]MCSBalancer)
Expand Down Expand Up @@ -192,7 +192,7 @@ func (p *Provider) EnsureMCSLoadBalancer(ctx context.Context, mcs *networkingv1a
}

// UpdateMCSLoadBalancer is a stub implementation of LoadBalancer.UpdateMCSLoadBalancer.
func (p *Provider) UpdateMCSLoadBalancer(ctx context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, err error) {
func (p *Provider) UpdateMCSLoadBalancer(_ context.Context, mcs *networkingv1alpha1.MultiClusterService) (status *corev1.LoadBalancerStatus, err error) {
p.addCall("update")
namespacedName := types.NamespacedName{Namespace: mcs.Namespace, Name: mcs.Name}.String()
lb, exist := p.MCSBalancers[namespacedName]
Expand All @@ -212,7 +212,7 @@ func (p *Provider) UpdateMCSLoadBalancer(ctx context.Context, mcs *networkingv1a
}

// EnsureMCSLoadBalancerDeleted is a stub implementation of LoadBalancer.EnsureMCSLoadBalancerDeleted.
func (p *Provider) EnsureMCSLoadBalancerDeleted(ctx context.Context, mcs *networkingv1alpha1.MultiClusterService) error {
func (p *Provider) EnsureMCSLoadBalancerDeleted(_ context.Context, mcs *networkingv1alpha1.MultiClusterService) error {
p.addCall("delete")
namespacedName := types.NamespacedName{Namespace: mcs.Namespace, Name: mcs.Name}.String()
delete(p.MCSBalancers, namespacedName)
Expand Down
2 changes: 1 addition & 1 deletion hack/verify-staticcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o nounset
set -o pipefail

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
GOLANGCI_LINT_VER="v1.49.0"
GOLANGCI_LINT_VER="v1.55.2"

cd "${REPO_ROOT}"
source "hack/util.sh"
Expand Down
32 changes: 16 additions & 16 deletions pkg/controllers/multiclusteringress/eventhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type multiClusterIngressEventHandler struct {
ingClassName string
}

func (h *multiClusterIngressEventHandler) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterIngressEventHandler) Create(_ context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
mci := e.Object.(*networkingv1alpha1.MultiClusterIngress)
if !util.CheckIngressClassMatched(h.ctx, h.client, mci, h.ingClassName) {
return
Expand All @@ -48,7 +48,7 @@ func (h *multiClusterIngressEventHandler) Create(ctx context.Context, e event.Cr
}})
}

func (h *multiClusterIngressEventHandler) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterIngressEventHandler) Update(_ context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
mciOld := e.ObjectOld.(*networkingv1alpha1.MultiClusterIngress)
mciNew := e.ObjectNew.(*networkingv1alpha1.MultiClusterIngress)
if !util.CheckIngressClassMatched(h.ctx, h.client, mciNew, h.ingClassName) {
Expand All @@ -68,12 +68,12 @@ func (h *multiClusterIngressEventHandler) Update(ctx context.Context, e event.Up
}})
}

func (h *multiClusterIngressEventHandler) Delete(ctx context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *multiClusterIngressEventHandler) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) {
// Since finalizer is added to the multiClusterIngress object,
// the delete event is processed by the update event.
}

func (h *multiClusterIngressEventHandler) Generic(ctx context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterIngressEventHandler) Generic(_ context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
mci := e.Object.(*networkingv1alpha1.MultiClusterIngress)
if !util.CheckIngressClassMatched(h.ctx, h.client, mci, h.ingClassName) {
return
Expand All @@ -98,11 +98,11 @@ type serviceEventHandler struct {
client client.Client
}

func (h *serviceEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Create(_ context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCI(e.Object.GetNamespace(), e.Object.GetName())
}

func (h *serviceEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Update(_ context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
svcOld := e.ObjectOld.(*corev1.Service)
svcNew := e.ObjectNew.(*corev1.Service)

Expand All @@ -116,11 +116,11 @@ func (h *serviceEventHandler) Update(ctx context.Context, e event.UpdateEvent, _
h.enqueueImpactedMCI(svcNew.Namespace, svcNew.Name)
}

func (h *serviceEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Delete(_ context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCI(e.Object.GetNamespace(), e.Object.GetName())
}

func (h *serviceEventHandler) Generic(ctx context.Context, e event.GenericEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Generic(_ context.Context, e event.GenericEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCI(e.Object.GetNamespace(), e.Object.GetName())
}

Expand Down Expand Up @@ -156,19 +156,19 @@ type endpointSlicesEventHandler struct {
svcEventChan chan<- event.GenericEvent
}

func (h *endpointSlicesEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Create(_ context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.Object)
}

func (h *endpointSlicesEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Update(_ context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.ObjectNew)
}

func (h *endpointSlicesEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Delete(_ context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.Object)
}

func (h *endpointSlicesEventHandler) Generic(ctx context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
}

func (h *endpointSlicesEventHandler) enqueueImpactedSvc(obj client.Object) {
Expand Down Expand Up @@ -201,11 +201,11 @@ type secretEventHandler struct {
client client.Client
}

func (h *secretEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
func (h *secretEventHandler) Create(_ context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCI(e.Object.GetNamespace(), e.Object.GetName())
}

func (h *secretEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
func (h *secretEventHandler) Update(_ context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
secretOld := e.ObjectOld.(*corev1.Secret)
secretNew := e.ObjectNew.(*corev1.Secret)

Expand All @@ -218,7 +218,7 @@ func (h *secretEventHandler) Update(ctx context.Context, e event.UpdateEvent, _
h.enqueueImpactedMCI(secretNew.Namespace, secretNew.Name)
}

func (h *secretEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *secretEventHandler) Delete(_ context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCI(e.Object.GetNamespace(), e.Object.GetName())
}

Expand All @@ -239,5 +239,5 @@ func (h *secretEventHandler) enqueueImpactedMCI(secretNamespace, secretName stri
}
}

func (h *secretEventHandler) Generic(ctx context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
func (h *secretEventHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
}
24 changes: 12 additions & 12 deletions pkg/controllers/multiclusterservice/eventhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var _ handler.EventHandler = (*multiClusterServiceEventHandler)(nil)
type multiClusterServiceEventHandler struct {
}

func (h *multiClusterServiceEventHandler) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterServiceEventHandler) Create(_ context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
mcs := e.Object.(*networkingv1alpha1.MultiClusterService)
if !util.MCSContainLoadBalanceType(mcs) {
return
Expand All @@ -41,7 +41,7 @@ func (h *multiClusterServiceEventHandler) Create(ctx context.Context, e event.Cr
}})
}

func (h *multiClusterServiceEventHandler) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterServiceEventHandler) Update(_ context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
mcsOld := e.ObjectOld.(*networkingv1alpha1.MultiClusterService)
mcsNew := e.ObjectNew.(*networkingv1alpha1.MultiClusterService)
if !util.MCSContainLoadBalanceType(mcsOld) && !util.MCSContainLoadBalanceType(mcsNew) {
Expand All @@ -61,12 +61,12 @@ func (h *multiClusterServiceEventHandler) Update(ctx context.Context, e event.Up
}})
}

func (h *multiClusterServiceEventHandler) Delete(ctx context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *multiClusterServiceEventHandler) Delete(_ context.Context, _ event.DeleteEvent, _ workqueue.RateLimitingInterface) {
// Since finalizer is added to the MultiClusterService object,
// the delete event is processed by the update event.
}

func (h *multiClusterServiceEventHandler) Generic(ctx context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
func (h *multiClusterServiceEventHandler) Generic(_ context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
queue.Add(reconcile.Request{NamespacedName: types.NamespacedName{
Namespace: e.Object.GetNamespace(),
Name: e.Object.GetName(),
Expand All @@ -87,11 +87,11 @@ type serviceEventHandler struct {
client client.Client
}

func (h *serviceEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Create(_ context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCS(e.Object.GetNamespace(), e.Object.GetName())
}

func (h *serviceEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Update(_ context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
svcOld := e.ObjectOld.(*corev1.Service)
svcNew := e.ObjectNew.(*corev1.Service)

Expand All @@ -104,11 +104,11 @@ func (h *serviceEventHandler) Update(ctx context.Context, e event.UpdateEvent, _
h.enqueueImpactedMCS(svcNew.Namespace, svcNew.Name)
}

func (h *serviceEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Delete(_ context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCS(e.Object.GetNamespace(), e.Object.GetName())
}

func (h *serviceEventHandler) Generic(ctx context.Context, e event.GenericEvent, _ workqueue.RateLimitingInterface) {
func (h *serviceEventHandler) Generic(_ context.Context, e event.GenericEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedMCS(e.Object.GetNamespace(), e.Object.GetName())
}

Expand Down Expand Up @@ -136,19 +136,19 @@ type endpointSlicesEventHandler struct {
svcEventChan chan<- event.GenericEvent
}

func (h *endpointSlicesEventHandler) Create(ctx context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Create(_ context.Context, e event.CreateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.Object)
}

func (h *endpointSlicesEventHandler) Update(ctx context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Update(_ context.Context, e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.ObjectNew)
}

func (h *endpointSlicesEventHandler) Delete(ctx context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Delete(_ context.Context, e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
h.enqueueImpactedSvc(e.Object)
}

func (h *endpointSlicesEventHandler) Generic(ctx context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
func (h *endpointSlicesEventHandler) Generic(_ context.Context, _ event.GenericEvent, _ workqueue.RateLimitingInterface) {
}

func (h *endpointSlicesEventHandler) enqueueImpactedSvc(obj client.Object) {
Expand Down
Loading

0 comments on commit 2beda5f

Please sign in to comment.