Skip to content

Commit

Permalink
Update Cluster API version and update devbox components
Browse files Browse the repository at this point in the history
Also fix and update go, clusterctl, kind, ko, and other tooling
dependencies' version in devbox.
  • Loading branch information
thunderboltsid committed Mar 7, 2024
1 parent aec5951 commit 59074fb
Show file tree
Hide file tree
Showing 31 changed files with 553 additions and 702 deletions.
1 change: 1 addition & 0 deletions api/v1alpha4/nutanixcluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha4
import (
infrav1beta1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
apiconversion "k8s.io/apimachinery/pkg/conversion"
//nolint:staticcheck
capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/nutanixcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha4
import (
credentialTypes "github.com/nutanix-cloud-native/prism-go-client/environment/credentials"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
//nolint:staticcheck
capiv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/errors"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/nutanixmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
//nolint:staticcheck
capiv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/errors"
)
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/nutanixmachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package v1alpha4
import (
infrav1beta1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
apiconversion "k8s.io/apimachinery/pkg/conversion"
//nolint:staticcheck
capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/nutanixmachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha4

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
//nolint:staticcheck
capiv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
)

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha4/v1alpha4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/nutanix-cloud-native/prism-go-client/utils"
"github.com/stretchr/testify/assert"
//nolint:staticcheck
"sigs.k8s.io/cluster-api/api/v1alpha4"
)

Expand Down
1 change: 0 additions & 1 deletion api/v1alpha4/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/v1beta1/nutanixcluster_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestNutanixClusterOpenAPIValidationPCAddress(t *testing.T) {
)
g.Expect(err).NotTo(HaveOccurred())

validator, _, err := validation.NewSchemaValidator(unversionedCRValidation)
validator, _, err := validation.NewSchemaValidator(unversionedCRValidation.OpenAPIV3Schema)
g.Expect(err).NotTo(HaveOccurred())

if tc.wantErr {
Expand Down
1 change: 0 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: nutanixclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
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.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: nutanixclustertemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
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.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: nutanixmachines.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -605,8 +604,8 @@ spec:
description: The machine address.
type: string
type:
description: Machine address type, one of Hostname, ExternalIP
or InternalIP.
description: Machine address type, one of Hostname, ExternalIP,
InternalIP, ExternalDNS or InternalDNS.
type: string
required:
- address
Expand Down
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.10.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.13.0
name: nutanixmachinetemplates.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
Expand Down
2 changes: 1 addition & 1 deletion controllers/nutanixcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (r *NutanixClusterReconciler) SetupWithManager(ctx context.Context, mgr ctr

if err = c.Watch(
// Watch the CAPI resource that owns this infrastructure resource.
&source.Kind{Type: &capiv1.Cluster{}},
source.Kind(mgr.GetCache(), &capiv1.Cluster{}),
handler.EnqueueRequestsFromMapFunc(
capiutil.ClusterToInfrastructureMapFunc(
ctx,
Expand Down
20 changes: 9 additions & 11 deletions controllers/nutanixmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ import (
"time"

"github.com/google/uuid"
infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
nutanixClient "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/pkg/client"
nctx "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/pkg/context"
"github.com/nutanix-cloud-native/prism-go-client/utils"
nutanixClientV3 "github.com/nutanix-cloud-native/prism-go-client/v3"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -45,13 +50,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
nutanixClient "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/pkg/client"
nctx "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/pkg/context"
"github.com/nutanix-cloud-native/prism-go-client/utils"
nutanixClientV3 "github.com/nutanix-cloud-native/prism-go-client/v3"
)

const (
Expand Down Expand Up @@ -102,21 +100,21 @@ func (r *NutanixMachineReconciler) SetupWithManager(ctx context.Context, mgr ctr
For(&infrav1.NutanixMachine{}).
// Watch the CAPI resource that owns this infrastructure resource.
Watches(
&source.Kind{Type: &capiv1.Machine{}},
&capiv1.Machine{},
handler.EnqueueRequestsFromMapFunc(
capiutil.MachineToInfrastructureMapFunc(
infrav1.GroupVersion.WithKind("NutanixMachine"))),
).
Watches(
&source.Kind{Type: &infrav1.NutanixCluster{}},
&infrav1.NutanixCluster{},
handler.EnqueueRequestsFromMapFunc(r.mapNutanixClusterToNutanixMachines(ctx)),
).
WithOptions(controller.Options{MaxConcurrentReconciles: r.controllerConfig.MaxConcurrentReconciles}).
Complete(r)
}

func (r *NutanixMachineReconciler) mapNutanixClusterToNutanixMachines(ctx context.Context) handler.MapFunc {
return func(o client.Object) []ctrl.Request {
return func(ctx context.Context, o client.Object) []ctrl.Request {

Check warning on line 117 in controllers/nutanixmachine_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/nutanixmachine_controller.go#L117

Added line #L117 was not covered by tests
log := ctrl.LoggerFrom(ctx)
nutanixCluster, ok := o.(*infrav1.NutanixCluster)
if !ok {
Expand All @@ -133,7 +131,7 @@ func (r *NutanixMachineReconciler) mapNutanixClusterToNutanixMachines(ctx contex
log.Error(err, "error occurred finding CAPI cluster for NutanixCluster")
return nil
}
searchLabels := map[string]string{capiv1.ClusterLabelName: cluster.Name}
searchLabels := map[string]string{capiv1.ClusterNameLabel: cluster.Name}

Check warning on line 134 in controllers/nutanixmachine_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/nutanixmachine_controller.go#L134

Added line #L134 was not covered by tests
machineList := &capiv1.MachineList{}
if err := r.List(ctx, machineList, client.InNamespace(cluster.Namespace), client.MatchingLabels(searchLabels)); err != nil {
log.V(1).Error(err, "failed to list machines for cluster")
Expand Down
18 changes: 9 additions & 9 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"packages": [
"bash@latest",
"clusterctl@latest",
"envsubst@latest",
"gnumake@latest",
"clusterctl@1.6.2",
"envsubst@1.4.2",
"gnumake@4.4.1",
"ginkgo@2.1.4",
"go@1.21.5",
"go@1.22.1",
"gotestsum@1.6.4",
"kind@0.17.0",
"ko@0.11.2",
"yamllint@1.33.0",
"kind@0.22.0",
"ko@0.15.2",
"kubernetes-code-generator@0.25.4",
"kubernetes-controller-tools@0.10.0",
"kustomize@4.5.4",
"kubernetes-controller-tools@0.13.0",
"kustomize@5.3.0",
"yamllint@1.35.1",
"path:./hack/flakes#go-apidiff",
"path:./hack/flakes#go-mod-upgrade",
"path:./hack/flakes#go-junit-report",
Expand Down
Loading

0 comments on commit 59074fb

Please sign in to comment.