Skip to content

Commit

Permalink
Upgrading cluster-api dependency to support k8s v1.24 (kubernetes-sig…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjumani authored and vignesh-goutham committed Jul 12, 2023
1 parent 07b6cfe commit e49ee8a
Show file tree
Hide file tree
Showing 31 changed files with 779 additions and 1,107 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17.8
go-version: 1.19.3
- name: Run go test with coverage
run: COVER_PROFILE=coverage.txt make test
- name: Codecov upload
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ kind-cluster: cluster-api ## Create a kind cluster with a local Docker repositor
./cluster-api/hack/kind-install-for-capd.sh

cluster-api: ## Clone cluster-api repository for tilt use.
git clone --branch v1.0.0 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git
git clone --branch v1.2.7 --depth 1 https://github.com/kubernetes-sigs/cluster-api.git

cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
cp ./hack/tilt-settings.json cluster-api
Expand Down
14 changes: 7 additions & 7 deletions api/v1beta1/cloudstackcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (z *Zone) MetaName() string {
return strings.ToLower(s)
}

//+k8s:conversion-gen=false
// +k8s:conversion-gen=false
// CloudStackClusterSpec defines the desired state of CloudStackCluster.
type CloudStackClusterSpec struct {
Zones []Zone `json:"zones"`
Expand All @@ -101,7 +101,7 @@ type CloudStackClusterSpec struct {
IdentityRef *CloudStackIdentityReference `json:"identityRef,omitempty"`
}

//+k8s:conversion-gen=false
// +k8s:conversion-gen=false
// The status of the abstract CS k8s (not an actual Cloudstack Cluster) cluster.
type CloudStackClusterStatus struct {

Expand Down Expand Up @@ -130,9 +130,9 @@ type CloudStackClusterStatus struct {
LBRuleID string `json:"loadBalancerRuleID,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+k8s:conversion-gen=false
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +k8s:conversion-gen=false
// CloudStackCluster is the Schema for the cloudstackclusters API
type CloudStackCluster struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -144,8 +144,8 @@ type CloudStackCluster struct {
Status CloudStackClusterStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
//+k8s:conversion-gen=false
// +kubebuilder:object:root=true
// +k8s:conversion-gen=false
// CloudStackClusterList contains a list of CloudStackCluster
type CloudStackClusterList struct {
metav1.TypeMeta `json:",inline"`
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/cloudstackzone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type CloudStackZoneStatus struct {
Ready bool `json:"ready"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+k8s:conversion-gen=false
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +k8s:conversion-gen=false
// CloudStackZone is the Schema for the cloudstackzones API
type CloudStackZone struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group
//+kubebuilder:object:generate=true
//+groupName=infrastructure.cluster.x-k8s.io
// +kubebuilder:object:generate=true
// +groupName=infrastructure.cluster.x-k8s.io
package v1beta1

import (
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta2/cloudstackmachinetemplate_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *CloudStackMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) er
Complete()
}

//+kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-cloudstackmachinetemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=cloudstackmachinetemplates,verbs=create;update,versions=v1beta2,name=mcloudstackmachinetemplate.kb.io,admissionReviewVersions=v1beta1
// +kubebuilder:webhook:path=/mutate-infrastructure-cluster-x-k8s-io-v1beta2-cloudstackmachinetemplate,mutating=true,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=cloudstackmachinetemplates,verbs=create;update,versions=v1beta2,name=mcloudstackmachinetemplate.kb.io,admissionReviewVersions=v1beta1
var _ webhook.Defaulter = &CloudStackMachineTemplate{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group
//+kubebuilder:object:generate=true
//+groupName=infrastructure.cluster.x-k8s.io
// +kubebuilder:object:generate=true
// +groupName=infrastructure.cluster.x-k8s.io
package v1beta2

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: cloudstackmachineowners.fakes.infrastructure.cluster.x-k8s.io
spec:
group: fakes.infrastructure.cluster.x-k8s.io
names:
kind: CloudStackMachineOwner
listKind: CloudStackMachineOwnerList
plural: cloudstackmachineowners
singular: cloudstackmachineowner
scope: Namespaced
versions:
- name: fakes
schema:
openAPIV3Schema:
description: CloudStackMachineOwner is the Schema for CloudStack Machine owner
(machineset, etcdadmcluster, kubeadmcontrolplane)
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'
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'
type: string
metadata:
type: object
spec:
description: CloudStackMachineOwnerSpec defines the desired state of CloudStackMachineOwner
properties:
replicas:
format: int32
type: integer
type: object
status:
description: CloudStackMachineOwnerStatus defines the name of the template
properties:
ready:
type: boolean
readyReplicas:
format: int32
type: integer
replicas:
format: int32
type: integer
required:
- replicas
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ spec:
description: Apache CloudStack Endpoint secret reference.
properties:
name:
description: Name is unique within a namespace to reference
description: name is unique within a namespace to reference
a secret resource.
type: string
namespace:
description: Namespace defines the space within which the
description: namespace defines the space within which the
secret name must be unique.
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ spec:
description: Apache CloudStack Endpoint secret reference.
properties:
name:
description: Name is unique within a namespace to reference a
description: name is unique within a namespace to reference a
secret resource.
type: string
namespace:
description: Namespace defines the space within which the secret
description: namespace defines the space within which the secret
name must be unique.
type: string
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ spec:
ready:
description: Ready indicates the readiness of the provider resource.
type: boolean
reason:
description: Reason indicates the reason of status failure
type: string
status:
description: Status indicates the status of the provider resource.
type: string
required:
- ready
type: object
Expand Down
4 changes: 2 additions & 2 deletions controllers/cloudstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (r *CloudStackClusterReconciliationRunner) ReconcileDelete() (ctrl.Result,
}

// Called in main, this registers the cluster reconciler to the CAPI controller manager.
func (reconciler *CloudStackClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (reconciler *CloudStackClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {
controller, err := ctrl.NewControllerManagedBy(mgr).
For(&infrav1.CloudStackCluster{}).
WithEventFilter(
Expand Down Expand Up @@ -186,7 +186,7 @@ func (reconciler *CloudStackClusterReconciler) SetupWithManager(mgr ctrl.Manager
err = controller.Watch(
&source.Kind{Type: &clusterv1.Cluster{}},
handler.EnqueueRequestsFromMapFunc(
util.ClusterToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("CloudStackCluster"))),
util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("CloudStackCluster"), mgr.GetClient(), &infrav1.CloudStackCluster{})),
predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
oldCluster := e.ObjectOld.(*clusterv1.Cluster)
Expand Down
2 changes: 1 addition & 1 deletion controllers/cloudstackcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = Describe("CloudStackClusterReconciler", func() {
Context("With k8s like test environment.", func() {
BeforeEach(func() {
SetupTestEnvironment() // Must happen before setting up managers/reconcilers.
Ω(ClusterReconciler.SetupWithManager(k8sManager)).Should(Succeed()) // Register CloudStack ClusterReconciler.
Ω(ClusterReconciler.SetupWithManager(ctx, k8sManager)).Should(Succeed()) // Register CloudStack ClusterReconciler.
Ω(FailureDomainReconciler.SetupWithManager(k8sManager)).Should(Succeed()) // Register CloudStack FailureDomainReconciler.
})

Expand Down
105 changes: 92 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,107 @@
module sigs.k8s.io/cluster-api-provider-cloudstack

go 1.16
go 1.18

require (
github.com/ReneKroon/ttlcache v1.7.0
github.com/apache/cloudstack-go/v2 v2.13.0
github.com/go-logr/logr v1.2.3
github.com/golang/mock v1.6.0
github.com/hashicorp/go-multierror v1.1.1
github.com/onsi/ginkgo/v2 v2.1.4
github.com/onsi/gomega v1.19.0
github.com/onsi/ginkgo/v2 v2.4.0
github.com/onsi/gomega v1.24.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_golang v1.14.0
github.com/smallfish/simpleyaml v0.1.0
github.com/spf13/pflag v1.0.5
golang.org/x/text v0.3.7
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
k8s.io/api v0.23.0
k8s.io/apimachinery v0.23.0
k8s.io/client-go v0.23.0
k8s.io/klog/v2 v2.30.0
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
sigs.k8s.io/cluster-api v1.0.0
sigs.k8s.io/controller-runtime v0.11.1
golang.org/x/text v0.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.25.3
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.3
k8s.io/klog/v2 v2.80.1
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
sigs.k8s.io/cluster-api v1.2.7
sigs.k8s.io/controller-runtime v0.13.1
)

require (
cloud.google.com/go/compute v1.7.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coredns/caddy v1.1.1 // indirect
github.com/coredns/corefile-migration v1.0.18 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gobuffalo/flect v0.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/stretchr/testify v1.8.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
go4.org/intern v0.0.0-20220617035311-6925f38cc365 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.2.0 // indirect
golang.org/x/time v0.2.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
k8s.io/apiextensions-apiserver v0.25.3 // indirect
k8s.io/cluster-bootstrap v0.25.3 // indirect
k8s.io/component-base v0.25.3 // indirect
k8s.io/kube-openapi v0.0.0-20221106113015-f73e7dbcfe29 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.0.0 // Indirect upgrade to address https://github.com/advisories/GHSA-w73w-5m7g-f7qc

replace sigs.k8s.io/cluster-api/test => sigs.k8s.io/cluster-api/test v1.2.7

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.2.7
Loading

0 comments on commit e49ee8a

Please sign in to comment.