Skip to content

Commit

Permalink
CAPI 1.5 -> 1.7 (#277)
Browse files Browse the repository at this point in the history
* bump capi to 1.6

* bump to 1.7

* bump go to 1.22
  • Loading branch information
astaninger committed Jun 5, 2024
1 parent 8b4b954 commit 0d80350
Show file tree
Hide file tree
Showing 22 changed files with 462 additions and 421 deletions.
2 changes: 1 addition & 1 deletion .pipelines/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- task: GoTool@0
inputs:
version: "1.20.13"
version: "1.22.4"
displayName: "Install Go"

- script: |-
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SHELL:=/usr/bin/env bash
# Go version
GO_VERSION := $(shell go env GOVERSION | sed "s/[^[:digit:].-]//g")
ifeq ($(GO_VERSION),)
GO_VERSION := 1.20.13
GO_VERSION := 1.22.4
endif

# Use GOPROXY environment variable if set
Expand Down Expand Up @@ -64,7 +64,7 @@ export PATH := $(TOOLS_BIN_DIR):$(PATH)
OUTPUT_BASE := --output-base=$(ROOT_DIR)

# the current cluster API version
CAPI_VERSION := v1.5.3
CAPI_VERSION := v1.7.2

# Binaries.
GO_INSTALL = ./scripts/go_install.sh
Expand All @@ -74,11 +74,11 @@ CLUSTERCTL_VER := $(CAPI_VERSION)
CLUSTERCTL_BIN := clusterctl
CLUSTERCTL := $(TOOLS_BIN_DIR)/$(CLUSTERCTL_BIN)-$(CLUSTERCTL_VER)

CONTROLLER_GEN_VER := v0.11.4
CONTROLLER_GEN_VER := v0.15.0
CONTROLLER_GEN_BIN := controller-gen
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)

CONVERSION_GEN_VER := v0.23.6
CONVERSION_GEN_VER := v0.30.0
CONVERSION_GEN_BIN := conversion-gen
CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER)

Expand All @@ -102,15 +102,15 @@ RELEASE_NOTES_VER := v0.12.0
RELEASE_NOTES_BIN := release-notes
RELEASE_NOTES := $(TOOLS_BIN_DIR)/$(RELEASE_NOTES_BIN)-$(RELEASE_NOTES_VER)

GO_APIDIFF_VER := v0.6.0
GO_APIDIFF_VER := v0.8.2
GO_APIDIFF_BIN := go-apidiff
GO_APIDIFF := $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN)

GINKGO_VER := v2.9.2
GINKGO_VER := v2.19.0
GINKGO_BIN := ginkgo
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)

KUBECTL_VER := v1.26.6
KUBECTL_VER := v1.29.0
KUBECTL_BIN := kubectl
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcicluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ type AzureStackHCIClusterList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCICluster{}, &AzureStackHCIClusterList{})
objectTypes = append(objectTypes, &AzureStackHCICluster{}, &AzureStackHCIClusterList{})
}
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhciclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type AzureStackHCIClusterTemplateList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCIClusterTemplate{}, &AzureStackHCIClusterTemplateList{})
objectTypes = append(objectTypes, &AzureStackHCIClusterTemplate{}, &AzureStackHCIClusterTemplateList{})
}

// AzureStackHCIClusterTemplateResource describes the data needed to create an AzureStackHCICluster from a template
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhciloadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,5 @@ type AzureStackHCILoadBalancerList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCILoadBalancer{}, &AzureStackHCILoadBalancerList{})
objectTypes = append(objectTypes, &AzureStackHCILoadBalancer{}, &AzureStackHCILoadBalancerList{})
}
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcimachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ type AzureStackHCIMachineList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCIMachine{}, &AzureStackHCIMachineList{})
objectTypes = append(objectTypes, &AzureStackHCIMachine{}, &AzureStackHCIMachineList{})
}
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcimachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type AzureStackHCIMachineTemplateList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCIMachineTemplate{}, &AzureStackHCIMachineTemplateList{})
objectTypes = append(objectTypes, &AzureStackHCIMachineTemplate{}, &AzureStackHCIMachineTemplateList{})
}

// AzureStackHCIMachineTemplateResource describes the data needed to create an AzureStackHCIMachine from a template
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcivirtualmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ type AzureStackHCIVirtualMachineList struct {
}

func init() {
SchemeBuilder.Register(&AzureStackHCIVirtualMachine{}, &AzureStackHCIVirtualMachineList{})
objectTypes = append(objectTypes, &AzureStackHCIVirtualMachine{}, &AzureStackHCIVirtualMachineList{})
}
37 changes: 0 additions & 37 deletions api/v1beta1/decode.go

This file was deleted.

17 changes: 13 additions & 4 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,26 @@ limitations under the License.
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// schemeBuilder is used to add go types to the GroupVersionKind scheme.
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
AddToScheme = schemeBuilder.AddToScheme

objectTypes = []runtime.Object{}
)

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion, objectTypes...)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}
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.

2 changes: 1 addition & 1 deletion azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ steps:
containerRegistry: mocimages-connection
- task: GoTool@0
inputs:
version: "1.20.13"
version: "1.22.4"

- script: |
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
Expand Down
7 changes: 1 addition & 6 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"k8s.io/klog/v2/klogr"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/noderefutil"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"
Expand Down Expand Up @@ -134,11 +133,7 @@ func (m *MachineScope) Role() string {

// GetVMID returns the AzureStackHCIMachine instance id by parsing Spec.ProviderID.
func (m *MachineScope) GetVMID() *string {
parsed, err := noderefutil.NewProviderID(m.GetProviderID())
if err != nil {
return nil
}
return pointer.StringPtr(parsed.ID())
return pointer.String(m.GetProviderID())
}

// GetLogger returns the logger.
Expand Down
35 changes: 20 additions & 15 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ import (
infrav1beta1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1"

// +kubebuilder:scaffold:imports

"github.com/microsoft/cluster-api-provider-azurestackhci/controllers"
"github.com/microsoft/cluster-api-provider-azurestackhci/pkg/network"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
cgrecord "k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/util/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/healthz"
ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/microsoft/cluster-api-provider-azurestackhci/controllers"
"k8s.io/client-go/util/workqueue"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)

var (
Expand All @@ -64,7 +64,6 @@ func init() {
}

var (
metricsAddr string
enableLeaderElection bool
watchNamespace string
profilerAddress string
Expand All @@ -78,12 +77,6 @@ var (
)

func InitFlags(fs *pflag.FlagSet) {
flag.StringVar(
&metricsAddr,
"metrics-bind-addr",
":8080",
"The address the metric endpoint binds to.",
)

flag.BoolVar(
&enableLeaderElection,
Expand Down Expand Up @@ -176,16 +169,28 @@ func main() {
BurstSize: 100,
})

var watchNamespaces map[string]cache.Config
if watchNamespace != "" {
watchNamespaces = map[string]cache.Config{
watchNamespace: {},
}
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "controller-leader-election-caph",
SyncPeriod: &syncPeriod,
Namespace: watchNamespace,
HealthProbeBindAddress: healthAddr,
Port: webhookPort,
EventBroadcaster: broadcaster,
Cache: cache.Options{
DefaultNamespaces: watchNamespaces,
SyncPeriod: &syncPeriod,
},
WebhookServer: webhook.NewServer(
webhook.Options{
Port: webhookPort,
},
),
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down
Loading

0 comments on commit 0d80350

Please sign in to comment.