Skip to content

Commit

Permalink
chore: update golang x tools version
Browse files Browse the repository at this point in the history
Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z committed Apr 8, 2024
1 parent a761bf3 commit 185dbaf
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 1,116 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- name: install kubebuilder
run: |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- name: Deploy operator
timeout-minutes: 5
uses: ./.github/actions/deploy-operator
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
--set installCRDs=true
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- uses: actions/checkout@v3
- name: Build image
env:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- uses: golangci/golangci-lint-action@v3
with:
## TODO: https://github.com/golangci/golangci-lint-action/issues/759
version: v1.52.2
args: --timeout=5m
- run: go install github.com/google/go-licenses@latest
- run: $(go env GOPATH)/bin/go-licenses check . --disallowed_types forbidden,restricted,unknown
Expand Down Expand Up @@ -80,7 +78,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- run: go install github.com/onsi/ginkgo/v2/ginkgo@latest
- name: Install Telepresence
env:
Expand Down Expand Up @@ -110,7 +108,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- run: make test
- uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
--set installCRDs=true
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down
19 changes: 10 additions & 9 deletions apis/apps/v2beta1/rebalance_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// log is for logging in this package.
Expand All @@ -41,41 +42,41 @@ func (r *Rebalance) SetupWebhookWithManager(mgr ctrl.Manager) error {
var _ webhook.Validator = &Rebalance{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Rebalance) ValidateCreate() error {
func (r *Rebalance) ValidateCreate() (admission.Warnings, error) {
rebalancelog.Info("validate create", "name", r.Name)

if len(r.Spec.RebalanceStrategy.RelConnThreshold) > 0 {
_, err := strconv.ParseFloat(r.Spec.RebalanceStrategy.RelConnThreshold, 64)
if err != nil {
return errors.New(`the field ".spec.rebalanceStrategy.relConnThreshold" must be float64`)
return nil, errors.New(`the field ".spec.rebalanceStrategy.relConnThreshold" must be float64`)
}
}

if len(r.Spec.RebalanceStrategy.RelSessThreshold) > 0 {
_, err := strconv.ParseFloat(r.Spec.RebalanceStrategy.RelSessThreshold, 64)
if err != nil {
return errors.New(`the field ".spec.rebalanceStrategy.relSessThreshold" must be float64`)
return nil, errors.New(`the field ".spec.rebalanceStrategy.relSessThreshold" must be float64`)
}
}
return nil
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Rebalance) ValidateUpdate(old runtime.Object) error {
func (r *Rebalance) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
rebalancelog.Info("validate update", "name", r.Name)
oldRebalance := old.(*Rebalance)

if r.GetGeneration() != oldRebalance.GetGeneration() {
return errors.New("the Rebalance spec don't allow update")
return nil, errors.New("the Rebalance spec don't allow update")
}

return nil
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Rebalance) ValidateDelete() error {
func (r *Rebalance) ValidateDelete() (admission.Warnings, error) {
rebalancelog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
return nil
return nil, nil
}
94 changes: 44 additions & 50 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
module github.com/emqx/emqx-operator

go 1.20
go 1.21

toolchain go1.21.3

require (
emperror.dev/errors v0.8.1
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.4
github.com/stretchr/testify v1.8.0
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.30.0
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.14.2
github.com/tidwall/sjson v1.2.5
go.uber.org/zap v1.22.0
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v0.24.3
sigs.k8s.io/controller-runtime v0.12.3
go.uber.org/zap v1.26.0
k8s.io/api v0.29.0
k8s.io/apimachinery v0.29.0
k8s.io/client-go v0.29.0
sigs.k8s.io/controller-runtime v0.17.2
)

require (
Expand All @@ -25,76 +27,68 @@ require (
)

require (
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
golang.org/x/tools v0.7.0 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/tools v0.20.0 // indirect
)

require (
cloud.google.com/go/compute v1.7.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-logr/logr v1.2.3
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.22.0 // indirect
github.com/go-logr/logr v1.4.1
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
// github.com/gurkankaymak/hocon v1.2.7
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sethvargo/go-password v0.2.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.17.0
golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.24.0
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.24.3 // indirect
k8s.io/component-base v0.24.3 // indirect
k8s.io/klog/v2 v2.70.1
k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
k8s.io/component-base v0.29.0 // indirect
k8s.io/klog/v2 v2.110.1
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit 185dbaf

Please sign in to comment.