Skip to content

Commit

Permalink
🌱 Bump to CAPI main (v1.8.0 pre alpha) (#3033)
Browse files Browse the repository at this point in the history
* Bump to CAPI main

* Bump go in the Makefile

* Bump controller gen and conversion gen

* Fix CI, pick latest CAPI and go version

* Address comments

* More comments

* Fix comment about variables overrides

* Add calls to ensure-go.sh for unit and E2E tests
  • Loading branch information
fabriziopandini committed Jun 11, 2024
1 parent 8ce0137 commit f237a0f
Show file tree
Hide file tree
Showing 38 changed files with 3,685 additions and 2,837 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: '1.21'
go-version: '1.22'
- run: "PATH=/usr/local/go/bin:$PATH make test-cover"
# Retry codecov upload. It is flaky due to a known issue https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
- uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # v3.5.0
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 10m
go: "1.21"
go: "1.22"
skip-files:
- "zz_generated.*\\.go$"
- "_conversion\\.go$"
Expand Down
26 changes: 10 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ SHELL:=/usr/bin/env bash
#
# Go.
#
GO_VERSION ?= 1.21.11
GO_VERSION ?= 1.22.4
GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION)
GO_DIRECTIVE_VERSION ?= 1.21.0
GO_DIRECTIVE_VERSION ?= 1.22.0

# Use GOPROXY environment variable if set
GOPROXY := $(shell go env GOPROXY)
Expand Down Expand Up @@ -68,13 +68,6 @@ GO_TOOLS_BUILD := ./hack/go-tools-build.sh

export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)

# Set --output-base for conversion-gen if we are not within GOPATH
ifneq ($(abspath $(ROOT_DIR)),$(shell go env GOPATH)/src/sigs.k8s.io/cluster-api-provider-vsphere)
CONVERSION_GEN_OUTPUT_BASE := --output-base=$(ROOT_DIR)
else
export GOPATH := $(shell go env GOPATH)
endif

#
# Ginkgo configuration.
#
Expand Down Expand Up @@ -119,7 +112,7 @@ SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest

CONTROLLER_GEN_VER := v0.13.0
CONTROLLER_GEN_VER := v0.15.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER))
CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen
Expand All @@ -129,7 +122,7 @@ GOTESTSUM_BIN := gotestsum
GOTESTSUM := $(abspath $(TOOLS_BIN_DIR)/$(GOTESTSUM_BIN)-$(GOTESTSUM_VER))
GOTESTSUM_PKG := gotest.tools/gotestsum

CONVERSION_GEN_VER := v0.28.0
CONVERSION_GEN_VER := v0.30.0
CONVERSION_GEN_BIN := conversion-gen
# We are intentionally using the binary without version suffix, to avoid the version
# in generated files.
Expand Down Expand Up @@ -341,11 +334,10 @@ generate-go-deepcopy: $(CONTROLLER_GEN) ## Generate deepcopy go code for core
generate-go-conversions: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate targets
$(MAKE) clean-generated-conversions SRC_DIRS="./apis/v1alpha3,./apis/v1alpha4"
$(CONVERSION_GEN) \
--input-dirs=./apis/v1alpha3 \
--input-dirs=./apis/v1alpha4 \
--build-tag=ignore_autogenerated \
--output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
--output-file=zz_generated.conversion.go \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
./apis/v1alpha3 \
./apis/v1alpha4

.PHONY: generate-modules
generate-modules: ## Run go mod tidy to ensure modules are up to date
Expand Down Expand Up @@ -592,6 +584,8 @@ test-verbose: ## Run unit tests with verbose flag

.PHONY: test-junit
test-junit: $(SETUP_ENVTEST) $(GOTESTSUM) $(GOVC) ## Run unit tests
# Note: running ensure.go to make sure tests run with the correct kube-kins image in CI
hack/ensure-go.sh
# Note: ARTIFACTS must be set so the ginkgo suites write junit reports to the ARTIFACTS folder
set +o errexit; (ARTIFACTS=$(ARTIFACTS) KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" GOVC_BIN_PATH=$(GOVC) go test -json ./apis/... ./controllers/... ./pkg/... ./internal/... $(TEST_ARGS); echo $$? > $(ARTIFACTS)/junit.exitcode) | tee $(ARTIFACTS)/junit.stdout
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml --raw-command cat $(ARTIFACTS)/junit.stdout
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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.15.0
name: vsphereclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand All @@ -20,18 +20,26 @@ spec:
name: v1alpha4
schema:
openAPIV3Schema:
description: "VSphereClusterTemplate is the Schema for the vsphereclustertemplates
API \n Deprecated: This type will be removed in one of the next releases."
description: |-
VSphereClusterTemplate is the Schema for the vsphereclustertemplates API
Deprecated: This type will be removed in one of the next releases.
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 @@ -59,9 +67,9 @@ spec:
- port
type: object
identityRef:
description: IdentityRef is a reference to either a Secret
or VSphereClusterIdentity that contains the identity to
use when reconciling the cluster.
description: |-
IdentityRef is a reference to either a Secret or VSphereClusterIdentity that contains
the identity to use when reconciling the cluster.
properties:
kind:
description: Kind of the identity. Can either be VSphereClusterIdentity
Expand Down Expand Up @@ -102,14 +110,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 All @@ -124,30 +137,28 @@ spec:
description: VSphereClusterSpec defines the desired state of VSphereCluster.
properties:
clusterModules:
description: ClusterModules hosts information regarding the
anti-affinity vSphere constructs for each of the objects
responsible for creation of VM objects belonging to the
cluster.
description: |-
ClusterModules hosts information regarding the anti-affinity vSphere constructs
for each of the objects responsible for creation of VM objects belonging to the cluster.
items:
description: ClusterModule holds the anti affinity construct
`ClusterModule` identifier in use by the VMs owned by
the object referred by the TargetObjectName field.
description: |-
ClusterModule holds the anti affinity construct `ClusterModule` identifier
in use by the VMs owned by the object referred by the TargetObjectName field.
properties:
controlPlane:
description: ControlPlane indicates whether the referred
object is responsible for control plane nodes. Currently,
only the KubeadmControlPlane objects have this flag
set to true. Only a single object in the slice can
have this value set to true.
description: |-
ControlPlane indicates whether the referred object is responsible for control plane nodes.
Currently, only the KubeadmControlPlane objects have this flag set to true.
Only a single object in the slice can have this value set to true.
type: boolean
moduleUUID:
description: ModuleUUID is the unique identifier of
the `ClusterModule` used by the object.
type: string
targetObjectName:
description: TargetObjectName points to the object that
uses the Cluster Module information to enforce anti-affinity
amongst its descendant VM objects.
description: |-
TargetObjectName points to the object that uses the Cluster Module information to enforce
anti-affinity amongst its descendant VM objects.
type: string
required:
- controlPlane
Expand All @@ -171,60 +182,60 @@ spec:
- port
type: object
failureDomainSelector:
description: FailureDomainSelector is the label selector to
use for failure domain selection for the control plane nodes
of the cluster. If not set (`nil`), selecting failure domains
will be disabled. An empty value (`{}`) selects all existing
failure domains. A valid selector will select all failure
domains which match the selector.
description: |-
FailureDomainSelector is the label selector to use for failure domain selection
for the control plane nodes of the cluster.
If not set (`nil`), selecting failure domains will be disabled.
An empty value (`{}`) selects all existing failure domains.
A valid selector will select all failure domains which match the selector.
properties:
matchExpressions:
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
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
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
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
identityRef:
description: IdentityRef is a reference to either a Secret
or VSphereClusterIdentity that contains the identity to
use when reconciling the cluster.
description: |-
IdentityRef is a reference to either a Secret or VSphereClusterIdentity that contains
the identity to use when reconciling the cluster.
properties:
kind:
description: Kind of the identity. Can either be VSphereClusterIdentity
Expand Down
Loading

0 comments on commit f237a0f

Please sign in to comment.