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 ee1f91f
Show file tree
Hide file tree
Showing 36 changed files with 487 additions and 1,323 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
22 changes: 11 additions & 11 deletions apis/apps/v1beta3/emqxbroker_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

var v1bete3EmqxBroker = &EmqxBroker{
Expand All @@ -40,7 +40,7 @@ var v1bete3EmqxBroker = &EmqxBroker{
},
},
Spec: EmqxBrokerSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Env: []corev1.EnvVar{
{
Name: "foo",
Expand Down Expand Up @@ -77,7 +77,7 @@ var v1bete3EmqxBroker = &EmqxBroker{
},
},
Persistent: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
InitContainers: []corev1.Container{
{
Expand All @@ -97,9 +97,9 @@ var v1bete3EmqxBroker = &EmqxBroker{
ACL: []string{"allow, all."},
ImagePullPolicy: corev1.PullIfNotPresent,
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
ExtraVolumes: []corev1.Volume{
Expand Down Expand Up @@ -202,10 +202,10 @@ var v1beta4EmqxBroker = &v1beta4.EmqxBroker{
},
},
Spec: v1beta4.EmqxBrokerSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Persistent: &corev1.PersistentVolumeClaimTemplate{
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
},
Template: v1beta4.EmqxTemplate{
Expand Down Expand Up @@ -333,9 +333,9 @@ var v1beta4EmqxBroker = &v1beta4.EmqxBroker{
},
},
PodSecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
},
Expand Down
22 changes: 11 additions & 11 deletions apis/apps/v1beta3/emqxenterprise_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

var v1bete3EmqxEnterprise = &EmqxEnterprise{
Expand All @@ -40,7 +40,7 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
},
},
Spec: EmqxEnterpriseSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
Env: []corev1.EnvVar{
{
Name: "foo",
Expand Down Expand Up @@ -77,7 +77,7 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
},
},
Persistent: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
InitContainers: []corev1.Container{
{
Expand All @@ -100,9 +100,9 @@ var v1bete3EmqxEnterprise = &EmqxEnterprise{
ACL: []string{"allow, all."},
ImagePullPolicy: corev1.PullIfNotPresent,
SecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
ExtraVolumes: []corev1.Volume{
Expand Down Expand Up @@ -205,13 +205,13 @@ var v1beta4EmqxEnterprise = &v1beta4.EmqxEnterprise{
},
},
Spec: v1beta4.EmqxEnterpriseSpec{
Replicas: pointer.Int32(3),
Replicas: ptr.To(int32(3)),
License: v1beta4.EmqxLicense{
SecretName: "fake-license-secret",
},
Persistent: &corev1.PersistentVolumeClaimTemplate{
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("foo"),
StorageClassName: ptr.To("foo"),
},
},
Template: v1beta4.EmqxTemplate{
Expand Down Expand Up @@ -339,9 +339,9 @@ var v1beta4EmqxEnterprise = &v1beta4.EmqxEnterprise{
},
},
PodSecurityContext: &corev1.PodSecurityContext{
RunAsUser: pointer.Int64(1000),
RunAsGroup: pointer.Int64(1000),
FSGroup: pointer.Int64(1000),
RunAsUser: ptr.To(int64(1000)),
RunAsGroup: ptr.To(int64(1000)),
FSGroup: ptr.To(int64(1000)),
FSGroupChangePolicy: &[]corev1.PodFSGroupChangePolicy{corev1.FSGroupChangeAlways}[0],
},
},
Expand Down
17 changes: 9 additions & 8 deletions apis/apps/v1beta4/emqxbroker_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 Down Expand Up @@ -64,19 +65,19 @@ func (r *EmqxBroker) Default() {
var _ webhook.Validator = &EmqxBroker{}

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

if err := validateImageVersion(r, nil); err != nil {
emqxbrokerlog.Error(err, "validate create failed")
return err
return nil, err
}

return nil
return nil, nil
}

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

callbacks := []func(new, old Emqx) error{
Expand All @@ -88,17 +89,17 @@ func (r *EmqxBroker) ValidateUpdate(old runtime.Object) error {
for _, cb := range callbacks {
if err := cb(r, old.(*EmqxBroker)); err != nil {
emqxbrokerlog.Error(err, "validate create failed")
return err
return nil, err
}
}
return nil
return nil, nil
}

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

return nil
return nil, nil
}

func defaultLabelsAndAnnotations(r Emqx) {
Expand Down
Loading

0 comments on commit ee1f91f

Please sign in to comment.