Skip to content

Commit

Permalink
[Feature]: go1.22 support (#487)
Browse files Browse the repository at this point in the history
* update toolchain to use 1.22
* update GH actions to use go1.22
* specify go1.22 in docs
* update controller-gen to 0.14 (controller-gen 0.13.0 panics on go1.22 - known issue #kubernetes-sigs/controller-tools/issues/880)

---------

Signed-off-by: Etai Lev Ran <elevran@gmail.com>
  • Loading branch information
elevran committed Apr 4, 2024
1 parent 91e5dc1 commit aae5e4b
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 326 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/dev/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/mfridman/tparse@latest
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go install mvdan.cc/gofumpt@v0.6.0
4 changes: 2 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.22'
- name: Setup goimports
run: go install golang.org/x/tools/cmd/goimports@v0.13.0
- name: Check go.mod and go.sum
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20']
go: ['1.22']
steps:
- name: set up go 1.x
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20']
go: ['1.22']

steps:
- name: checkout
Expand Down
2 changes: 1 addition & 1 deletion Containerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/library/golang:1.20-bullseye
FROM docker.io/library/golang:1.22-bullseye

# To allow installing kubectl
RUN mkdir /etc/apt/keyrings &&\
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ endif

# Controller Gen for crds
CONTROLLER_GEN ?= $(GOBIN)/controller-gen
CONTROLLER_TOOLS_VERSION ?= v0.13.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The ClusterLink APIs use the following entities for configuring cross cluster co

Here are the key steps for setting up your developer environment, making a change and testing it:

1. Install Go version 1.20 or higher.
1. Install Go version 1.22 or higher.
1. Clone our repository with `git clone git@github.com:clusterlink-net/clusterlink.git`.
1. Run `make test-prereqs` and manually install any missing required development tools.
1. Run `make build` to ensure the code builds fine. This will pull in all needed
Expand Down
102 changes: 53 additions & 49 deletions config/crds/clusterlink.net_accesspolicies.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.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: accesspolicies.clusterlink.net
spec:
group: clusterlink.net
Expand All @@ -17,20 +17,26 @@ spec:
- name: v1alpha1
schema:
openAPIV3Schema:
description: AccessPolicy defines whether a group of potential connections
should be allowed or denied. If multiple AccessPolicy objects match a given
connection, privileged policies take precedence over non-privileged, and
within each tier deny policies take precedence over allow policies.
description: |-
AccessPolicy defines whether a group of potential connections should be allowed or denied.
If multiple AccessPolicy objects match a given connection, privileged policies
take precedence over non-privileged, and within each tier deny policies take
precedence over allow policies.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -45,9 +51,9 @@ spec:
description: From specifies the set of source workload to which this
policy refers.
items:
description: WorkloadSetOrSelector describes a set of workloads,
based on their attributes (labels). Exactly one of the two fields
should be non-empty.
description: |-
WorkloadSetOrSelector describes a set of workloads, based on their attributes (labels).
Exactly one of the two fields should be non-empty.
properties:
workloadSelector:
description: WorkloadSelector is a K8s-style label selector,
Expand All @@ -57,25 +63,25 @@ spec:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that relates
the key and values.
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values.
If the operator is In or NotIn, the values array
must be non-empty. If the operator is Exists or
DoesNotExist, the values array must be empty. This
array is replaced during a strategic merge patch.
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
Expand All @@ -87,11 +93,10 @@ spec:
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs.
A single {key,value} in the matchLabels map is equivalent
to an element of matchExpressions, whose key field is
"key", the operator is "In", and the values array contains
only "value". The requirements are ANDed.
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
Expand All @@ -107,9 +112,9 @@ spec:
description: To specifies the set of destination services to which
this policy refers.
items:
description: WorkloadSetOrSelector describes a set of workloads,
based on their attributes (labels). Exactly one of the two fields
should be non-empty.
description: |-
WorkloadSetOrSelector describes a set of workloads, based on their attributes (labels).
Exactly one of the two fields should be non-empty.
properties:
workloadSelector:
description: WorkloadSelector is a K8s-style label selector,
Expand All @@ -119,25 +124,25 @@ spec:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that relates
the key and values.
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: values is an array of string values.
If the operator is In or NotIn, the values array
must be non-empty. If the operator is Exists or
DoesNotExist, the values array must be empty. This
array is replaced during a strategic merge patch.
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
Expand All @@ -149,11 +154,10 @@ spec:
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs.
A single {key,value} in the matchLabels map is equivalent
to an element of matchExpressions, whose key field is
"key", the operator is "In", and the values array contains
only "value". The requirements are ANDed.
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
Expand Down
Loading

0 comments on commit aae5e4b

Please sign in to comment.