Skip to content

Commit

Permalink
Upgrading cluster-api dependency to support k8s v1.24
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjumani committed Nov 21, 2022
1 parent 31ea9f2 commit 85ec9d0
Show file tree
Hide file tree
Showing 24 changed files with 1,331 additions and 853 deletions.
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
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
60 changes: 48 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,61 @@ go 1.16

require (
github.com/ReneKroon/ttlcache v1.7.0
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/apache/cloudstack-go/v2 v2.13.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/coredns/caddy v1.1.1 // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3
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/golang/mock v1.6.0
github.com/google/gnostic v0.6.9 // indirect
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/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c // indirect
github.com/onsi/ginkgo v1.16.5
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/shopspring/decimal v1.3.1 // indirect
github.com/smallfish/simpleyaml v0.1.0
github.com/spf13/cobra v1.6.1 // indirect
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
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/net v0.2.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/text v0.4.0
golang.org/x/time v0.2.0 // indirect
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd // indirect
gopkg.in/yaml.v3 v3.0.1
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
k8s.io/api v0.25.3
k8s.io/apiextensions-apiserver v0.25.3 // indirect
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.3
k8s.io/cluster-bootstrap v0.25.3 // indirect
k8s.io/klog/v2 v2.80.1
k8s.io/kube-openapi v0.0.0-20221106113015-f73e7dbcfe29 // indirect
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
sigs.k8s.io/cluster-api v1.2.2
sigs.k8s.io/cluster-api/test v0.0.0-00010101000000-000000000000
sigs.k8s.io/controller-runtime v0.13.1
)

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.2

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

0 comments on commit 85ec9d0

Please sign in to comment.