Skip to content

Commit

Permalink
Bump Go version to 1.22 & controller-gen to 0.14 (#1437)
Browse files Browse the repository at this point in the history
* bump go version to 1.22

* bump controller-gen to 0.14

* make manifests & generate deepcopy

* ensure latest go-licenses version

* make licenses

* cache on go.mod as well as go.sum

* specify full version in go.mod

* avoid using main branch when label added

* changes as per review

* Remove checkout ref from e2e gov tests

Co-authored-by: josvaz <jose.vazquez@mongodb.com>

---------

Co-authored-by: josvaz <jose.vazquez@mongodb.com>
  • Loading branch information
roothorp and josvazg authored Mar 22, 2024
1 parent e29274d commit 065d6f0
Show file tree
Hide file tree
Showing 29 changed files with 360 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-push-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ runs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}
- name: Download go build dependencies
shell: bash
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/gen-install-scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21
FROM golang:1.22

ENV KUBECTL_VERSION 1.18.12
ENV GO111MODULE on
Expand All @@ -15,7 +15,7 @@ RUN cd /usr/local/bin &&\
RUN CONTROLLER_GEN_TMP_DIR=$(mktemp -d) && \
cd $CONTROLLER_GEN_TMP_DIR && \
go mod init tmp && \
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2 && \
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 && \
rm -rf $CONTROLLER_GEN_TMP_DIR && \
CONTROLLER_GEN=${GOBIN}/controller-gen

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}

- name: Setup Go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rebuild-released-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}
- name: Download go build dependencies
shell: bash
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum', '**/go.mod') }}
- name: Get go dependencies if cache is missed
if: steps.cache-go.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-full-${{ hashFiles('**/go.sum', '**/go.mod') }}
- name: Get go dependencies if cache is missed
if: steps.get-go-deps.outputs.cache-hit != 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}
- name: Setup Go
uses: actions/setup-go@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}

- name: Setup Go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum', '**/go.mod') }}

- name: Setup Go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .licenses-gomod.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
100644 4b8a340e51c1d5690d82b9cd1e9c768de7db84e9 go.mod
100644 7a60e838b5b0f5aa778a2eb04ee5a06e8838c43c go.mod
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 as builder
FROM golang:1.22 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.post-install
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 as builder
FROM golang:1.22 as builder

ENV CGO_ENABLED=0
ENV GOOS=linux
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ help: ## Show this help screen
all: manager ## Build all binaries

go-licenses:
@which go-licenses || go install github.com/google/go-licenses@latest
go install github.com/google/go-licenses@latest

licenses.csv: go-licenses go.mod ## Track licenses in a CSV file
@echo "Tracking licenses into file $@"
Expand Down Expand Up @@ -239,7 +239,7 @@ vet: $(TIMESTAMPS_DIR)/vet ## Run go vet against code

.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary
@which controller-gen || go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0

.PHONY: generate
generate: controller-gen ${GO_SOURCES} ## Generate code
Expand Down
35 changes: 18 additions & 17 deletions config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: atlasbackuppolicies.atlas.mongodb.com
spec:
group: atlas.mongodb.com
Expand All @@ -21,14 +20,19 @@ spec:
description: AtlasBackupPolicy is the Schema for the atlasbackuppolicies API
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 @@ -40,11 +44,9 @@ spec:
items:
properties:
frequencyInterval:
description: Desired frequency of the new backup policy item
specified by FrequencyType. A value of 1 specifies the first
instance of the corresponding FrequencyType. The only accepted
value you can set for frequency interval with NVMe clusters
is 12.
description: |-
Desired frequency of the new backup policy item specified by FrequencyType. A value of 1 specifies the first instance of the corresponding FrequencyType.
The only accepted value you can set for frequency interval with NVMe clusters is 12.
enum:
- 1
- 2
Expand Down Expand Up @@ -148,10 +150,9 @@ spec:
type: object
type: array
observedGeneration:
description: ObservedGeneration indicates the generation of the resource
specification that the Atlas Operator is aware of. The Atlas Operator
updates this field to the 'metadata.generation' as soon as it starts
reconciliation of the resource.
description: |-
ObservedGeneration indicates the generation of the resource specification that the Atlas Operator is aware of.
The Atlas Operator updates this field to the 'metadata.generation' as soon as it starts reconciliation of the resource.
format: int64
type: integer
required:
Expand Down
27 changes: 15 additions & 12 deletions config/crd/bases/atlas.mongodb.com_atlasbackupschedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: atlasbackupschedules.atlas.mongodb.com
spec:
group: atlas.mongodb.com
Expand All @@ -22,14 +21,19 @@ spec:
API
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 Down Expand Up @@ -175,10 +179,9 @@ spec:
type: string
type: array
observedGeneration:
description: ObservedGeneration indicates the generation of the resource
specification that the Atlas Operator is aware of. The Atlas Operator
updates this field to the 'metadata.generation' as soon as it starts
reconciliation of the resource.
description: |-
ObservedGeneration indicates the generation of the resource specification that the Atlas Operator is aware of.
The Atlas Operator updates this field to the 'metadata.generation' as soon as it starts reconciliation of the resource.
format: int64
type: integer
required:
Expand Down
Loading

0 comments on commit 065d6f0

Please sign in to comment.