Skip to content

Commit

Permalink
Bump Golang to 1.23.1
Browse files Browse the repository at this point in the history
In order to ensure TLS 1.3 is supportted. We bump Golang version to 1.23.1

In this patch, we do:
1. Bump golangci to v1.61.0 in order to support golang v1.23.1
2. To increase flexibility for downstream consumers, we set a lower Go version in `go.mod` for API module (nsx-operator/pkg/apis), allowing them to choose their preferred Go version. However, we will keep the main module (nsx-operator) on the latest Go version. Currently, we set Go 1.21 for the API module.
3. Update controller-runtime to v0.19.0 for this issue:
kubernetes-sigs/controller-runtime#2925
4. Update controller-gen to v16.5 to resolve the error below.
```
/Users/hsuy/Desktop/nsx-operator/bin/controller-gen rbac:roleName=manager-role crd webhook paths="github.com/vmware-tanzu/nsx-operator/pkg/apis/legacy/v1alpha1" output:crd:artifacts:config=build/yaml/crd/legacy/
/Users/hsuy/go/pkg/mod/k8s.io/[email protected]/core/v1/doc.go:21:1: missing argument "" (at <input>)
/Users/hsuy/go/pkg/mod/k8s.io/[email protected]/core/v1/doc.go:21:1: missing argument "" (at <input>)
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ConditionStatus
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ConditionStatus
github.com/vmware-tanzu/nsx-operator/pkg/apis/legacy/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".ConditionStatus
```

Signed-off-by: Yun-Tang Hsu <[email protected]>
  • Loading branch information
yuntanghsu committed Nov 12, 2024
1 parent 5c31cb6 commit 1ee91f4
Show file tree
Hide file tree
Showing 50 changed files with 753 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
go-version: 1.23.1

- name: Run golangci-lint
run: make golangci
Expand Down
12 changes: 8 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
run:
tests: true
timeout: 15m
skip-files:
- third_party/
- pkg/client/
issues:
exclude-files:
- third_party/
- pkg/client/
skip-dirs-use-default: true

linters-settings:
Expand All @@ -21,6 +22,9 @@ linters-settings:
- name: superfluous-else
- name: var-declaration
- name: duplicated-imports
gosec:
excludes:
- G115

linters:
disable-all: true
Expand All @@ -31,7 +35,7 @@ linters:
- staticcheck
- gosec
- goimports
- vet
- govet
- revive

issues:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GOFLAGS :=
BINDIR ?= $(CURDIR)/bin
GO_FILES := $(shell find . -type d -name '.cache' -prune -o -type f -name '*.go' -print)

GOLANGCI_LINT_VERSION := v1.54.0
GOLANGCI_LINT_VERSION := v1.61.0
GOLANGCI_LINT_BINDIR := $(CURDIR)/.golangci-bin
GOLANGCI_LINT_BIN := $(GOLANGCI_LINT_BINDIR)/$(GOLANGCI_LINT_VERSION)/golangci-lint

Expand Down Expand Up @@ -146,7 +146,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5)

KUSTOMIZE = $(shell pwd)/bin/kustomize
.PHONY: kustomize
Expand Down
2 changes: 1 addition & 1 deletion build/image/photon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.7 as golang-build
FROM golang:1.23.1 as golang-build

WORKDIR /source

Expand Down
21 changes: 4 additions & 17 deletions build/yaml/crd/legacy/nsx.vmware.com_nsxserviceaccounts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: nsxserviceaccounts.nsx.vmware.com
spec:
group: nsx.vmware.com
Expand Down Expand Up @@ -58,16 +58,8 @@ spec:
Represents the realization status of a NSXServiceAccount's current state.
Known .status.conditions.type is: "Realized"
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -108,12 +100,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
3 changes: 1 addition & 2 deletions build/yaml/crd/legacy/nsx.vmware.com_securitypolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: securitypolicies.nsx.vmware.com
spec:
group: nsx.vmware.com
Expand Down Expand Up @@ -448,7 +448,6 @@ spec:
description: Port is the name or port number.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
Protocol(TCP, UDP) is the protocol to match traffic.
It is TCP by default.
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_addressbindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: addressbindings.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: ipaddressallocations.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_ipblocksinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: ipblocksinfos.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: networkinfos.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
3 changes: 1 addition & 2 deletions build/yaml/crd/vpc/crd.nsx.vmware.com_securitypolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: securitypolicies.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down Expand Up @@ -448,7 +448,6 @@ spec:
description: Port is the name or port number.
x-kubernetes-int-or-string: true
protocol:
default: TCP
description: |-
Protocol(TCP, UDP) is the protocol to match traffic.
It is TCP by default.
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_staticroutes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: staticroutes.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: subnetconnectionbindingmaps.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_subnetports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: subnetports.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_subnets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: subnets.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
2 changes: 1 addition & 1 deletion build/yaml/crd/vpc/crd.nsx.vmware.com_subnetsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: subnetsets.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.16.5
name: vpcnetworkconfigurations.crd.nsx.vmware.com
spec:
group: crd.nsx.vmware.com
Expand Down
34 changes: 18 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vmware-tanzu/nsx-operator

go 1.22.5
go 1.23.1

replace (
github.com/vmware-tanzu/nsx-operator/pkg/apis => ./pkg/apis
Expand All @@ -24,10 +24,10 @@ require (
github.com/google/uuid v1.6.0
github.com/kevinburke/ssh_config v1.2.0
github.com/openlyinc/pointy v1.1.2
github.com/prometheus/client_golang v1.16.0
github.com/sirupsen/logrus v1.9.0
github.com/prometheus/client_golang v1.19.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241028071655-1650a84c7862
github.com/vmware-tanzu/nsx-operator/pkg/apis v0.0.0-20241112035853-5c31cb6ee66e
github.com/vmware-tanzu/nsx-operator/pkg/client v0.0.0-20240102061654-537b080e159f
github.com/vmware-tanzu/vm-operator/api v1.8.2
github.com/vmware/govmomi v0.27.4
Expand All @@ -40,22 +40,23 @@ require (
golang.org/x/crypto v0.24.0
golang.org/x/time v0.3.0
gopkg.in/ini.v1 v1.66.4
k8s.io/api v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
k8s.io/code-generator v0.30.1
sigs.k8s.io/controller-runtime v0.18.4
k8s.io/api v0.31.2
k8s.io/apimachinery v0.31.2
k8s.io/client-go v0.31.2
k8s.io/code-generator v0.31.0
sigs.k8s.io/controller-runtime v0.19.0
)

require (
github.com/beevik/etree v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gibson042/canonicaljson-go v1.0.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand All @@ -71,19 +72,19 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // 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.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
Expand All @@ -94,10 +95,11 @@ require (
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.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.30.1 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
Expand Down
Loading

0 comments on commit 1ee91f4

Please sign in to comment.