Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maintenance] Bump Go to 1.20.7 #1374

Merged
merged 3 commits into from
Aug 3, 2023
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: go

go:
- "1.19"
- "1.20"

go_import_path: github.com/arangodb/kube-arangodb

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- (Maintenance) Bump K8S Version to 1.23.17
- (Maintenance) Bump K8S Version to 1.24.16
- (Maintenance) Bump K8S Version to 1.25.12
- (Maintenance) Bump Go to 1.20.7

## [1.2.31](https://github.com/arangodb/kube-arangodb/tree/1.2.31) (2023-07-14)
- (Improvement) Block traffic on the services if there is more than 1 active leader in ActiveFailover mode
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/arangodb/kube-arangodb

go 1.19
go 1.20

replace (
github.com/arangodb/go-driver => github.com/arangodb/go-driver v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/jwt.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/member_status_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
package v1

import (
"math/rand"
"sort"
"time"

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand Down Expand Up @@ -188,7 +188,7 @@ func (l MemberStatusList) SelectMemberToRemove(selectors ...MemberToRemoveSelect
}

// Pick a random member that is in created state
perm := rand.Perm(len(l))
perm := util.Rand().Perm(len(l))
for _, idx := range perm {
m := l[idx]
if m.Phase == MemberPhaseCreated {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/plan_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v2alpha1/member_status_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
package v2alpha1

import (
"math/rand"
"sort"
"time"

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand Down Expand Up @@ -188,7 +188,7 @@ func (l MemberStatusList) SelectMemberToRemove(selectors ...MemberToRemoveSelect
}

// Pick a random member that is in created state
perm := rand.Perm(len(l))
perm := util.Rand().Perm(len(l))
for _, idx := range perm {
m := l[idx]
if m.Phase == MemberPhaseCreated {
Expand Down
1 change: 0 additions & 1 deletion pkg/deployment/acs/acs.community.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package acs

Expand Down
1 change: 0 additions & 1 deletion pkg/deployment/agency/loader.community.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
//

//go:build !enterprise
// +build !enterprise

package agency

Expand Down
5 changes: 3 additions & 2 deletions pkg/deployment/agency/state/generator_jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ package state

import (
"fmt"
"math/rand"
"testing"

"github.com/arangodb/kube-arangodb/pkg/util"
)

func NewJobsGenerator() JobsGeneratorInterface {
Expand Down Expand Up @@ -52,7 +53,7 @@ func (j *jobsGenerator) Jobs(phase JobPhase, jobs int, jobTypes ...string) JobsG
j.id++
id := fmt.Sprintf("s%07d", q)
z[JobID(id)] = Job{
Type: jobTypes[rand.Intn(len(jobTypes))],
Type: jobTypes[util.Rand().Intn(len(jobTypes))],
}
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/deployment/agency/state/jobs_performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ package state

import (
"fmt"
"math/rand"
"testing"

"github.com/stretchr/testify/require"

"github.com/arangodb/kube-arangodb/pkg/util"
)

func caseJobPerformance(t *testing.T, jobs int) {
Expand All @@ -38,7 +39,7 @@ func caseJobPerformance(t *testing.T, jobs int) {
JobPhasePending,
JobPhaseFinished,
} {
z := rand.Intn(currentJobs + 1)
z := util.Rand().Intn(currentJobs + 1)

j = j.Jobs(p, z)
currentJobs -= z
Expand All @@ -63,7 +64,7 @@ func caseJobPerformance(t *testing.T, jobs int) {
})

runCountWithMeasure(t, 16, "Lookup", func(t *testing.T) {
id := jids[rand.Intn(len(jids))]
id := jids[util.Rand().Intn(len(jids))]

_, z := s.Target.GetJob(id)
require.NotEqual(t, JobPhaseUnknown, z)
Expand Down
5 changes: 3 additions & 2 deletions pkg/deployment/agency/state/state_performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ package state

import (
"fmt"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/arangodb/kube-arangodb/pkg/util"
)

func runCountWithMeasure(t *testing.T, c int, name string, f func(t *testing.T)) {
Expand Down Expand Up @@ -157,7 +158,7 @@ func generateServersSublist(servers int) Servers {
s[id] = Server(fmt.Sprintf("server-%d", id))
}

rand.Shuffle(len(s), func(i, j int) {
util.Rand().Shuffle(len(s), func(i, j int) {
s[i], s[j] = s[j], s[i]
})

Expand Down
6 changes: 3 additions & 3 deletions pkg/deployment/chaos/monkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ package chaos

import (
"context"
"math/rand"

"github.com/rs/zerolog"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/arangodb/kube-arangodb/pkg/logging"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/timer"
)
Expand Down Expand Up @@ -69,7 +69,7 @@ func (m Monkey) Run(stopCh <-chan struct{}) {
if spec.Chaos.IsEnabled() {
// Gamble to set if we must introduce chaos
chance := float64(spec.Chaos.GetKillPodProbability()) / 100.0
if rand.Float64() < chance {
if util.Rand().Float64() < chance {
// Let's introduce pod chaos
if err := m.killRandomPod(ctx); err != nil {
m.log.Err(err).Info("Failed to kill random pod")
Expand Down Expand Up @@ -97,7 +97,7 @@ func (m Monkey) killRandomPod(ctx context.Context) error {
// Not enough pods
return nil
}
p := pods[rand.Intn(len(pods))]
p := pods[util.Rand().Intn(len(pods))]
m.log.Str("pod-name", p.GetName()).Info("Killing pod")
if err := m.context.DeletePod(ctx, p.GetName(), meta.DeleteOptions{}); err != nil {
return errors.WithStack(err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/deployment/member/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package member

import (
"context"
"math/rand"
"sync"

"github.com/rs/zerolog"
Expand All @@ -33,6 +32,7 @@ import (
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/deployment/reconciler"
"github.com/arangodb/kube-arangodb/pkg/logging"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/arangod"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/globals"
Expand Down Expand Up @@ -164,7 +164,7 @@ func (s *stateInspector) RefreshState(ctx context.Context, members api.Deploymen
if v, ok := h.Members[driver.ServerID(m.Member.ID)]; ok {
results[i].IsClusterHealthy = v.Status == driver.ServerStatusGood
if results[i].IsServing() && v.SyncStatus == driver.ServerSyncStatusServing {
if cs.client == nil || rand.Intn(100) > 50 {
if cs.client == nil || util.Rand().Intn(100) > 50 {
// Set client from nil or take next client with 50% probability.
cs.client = results[i].client
cs.Version = results[i].Version
Expand Down
1 change: 0 additions & 1 deletion pkg/deployment/members.community.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package deployment

Expand Down
1 change: 0 additions & 1 deletion pkg/deployment/pod/topology.community.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package pod

Expand Down
3 changes: 1 addition & 2 deletions pkg/deployment/reconcile/action_bootstrap_set_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package reconcile

import (
"context"
"crypto/rand"
"encoding/hex"

"github.com/arangodb/go-driver"
Expand Down Expand Up @@ -133,7 +132,7 @@ func (a actionBootstrapSetPassword) ensureUserPasswordSecret(ctx context.Context
if auth, ok := a.actionCtx.ACS().CurrentClusterCache().Secret().V1().GetSimple(secret); !ok {
// Create new one
tokenData := make([]byte, 32)
if _, err := rand.Read(tokenData); err != nil {
if _, err := util.Rand().Read(tokenData); err != nil {
return "", err
}
token := hex.EncodeToString(tokenData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
1 change: 0 additions & 1 deletion pkg/deployment/reconcile/action_placeholder.community.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//go:build !enterprise
// +build !enterprise

package reconcile

Expand Down
Loading