diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a85092..b7a47ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ on: env: # Common versions - GO_VERSION: '1.23.10' - GOLANGCI_VERSION: 'v2.1.2' + GO_VERSION: '1.24.10' + GOLANGCI_VERSION: 'v2.6.2' DOCKER_BUILDX_VERSION: 'v0.23.0' # Common users. We can't run a step 'if secrets.XXX != ""' but we can run a diff --git a/README.md b/README.md index 5bfdce1..811ae85 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,6 @@ The RabbitMQ provider offers the following features: - **Bindings**: Configure bindings between exchanges and queues - **Permissions**: Manage user permissions within virtual hosts -Planned features: - -- **Policies**: Manage RabbitMQ policies for queues and exchanges -- **Operator policies**: Manage operator policies for queues -- **Topic permissions**: Manage a user's set of topic permissions -- **Federation upstream**: Manage federation upstream -- **Shovel**: Manage dynamic shovel - ## Getting Started ### Installation @@ -147,6 +139,14 @@ As a next step you can apply some examples from the [examples/sample](examples/s console from localhost execute the command: `k port-forward svc/rabbitmq 15672:15672 -n rabbitmq` and then open http://localhost:15672 in your browser. Login with username `guest` and password `guest`. +## Crossplane V2 Migration + +As with version 2 of crossplane the namespace resources have been supported below you will find the migration guide for the provider. + +1. Switch provider resource group from `rabbitmq.crossplane.io` to `rabbitmq.m.crossplane.io`. For example: + +`TODO` + ## Development For information on how to contribute to this provider, please see the [Development Guide](DEVELOPMENT.md). diff --git a/apis/core/core.go b/apis/core/core.go index 006439c..2cb6434 100644 --- a/apis/core/core.go +++ b/apis/core/core.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The Crossplane Authors. +Copyright 2025 The Crossplane Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/apis/core/v1alpha1/binding_types.go b/apis/core/v1alpha1/binding_types.go index 225ec46..c33ebeb 100644 --- a/apis/core/v1alpha1/binding_types.go +++ b/apis/core/v1alpha1/binding_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // BindingParameters are the configurable fields of a Binding. @@ -55,8 +56,8 @@ type BindingObservation struct { // A BindingSpec defines the desired state of a Binding. type BindingSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider BindingParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider BindingParameters `json:"forProvider"` } // A BindingStatus represents the observed state of a Binding. @@ -73,7 +74,7 @@ type BindingStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type Binding struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/doc.go b/apis/core/v1alpha1/doc.go index dc5d3ae..39c7eca 100644 --- a/apis/core/v1alpha1/doc.go +++ b/apis/core/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The Crossplane Authors. +Copyright 2025 The Crossplane Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/apis/core/v1alpha1/exchange_types.go b/apis/core/v1alpha1/exchange_types.go index a286723..8fcec78 100644 --- a/apis/core/v1alpha1/exchange_types.go +++ b/apis/core/v1alpha1/exchange_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // ExchangeParameters are the configurable fields of a Exchange. @@ -60,8 +61,8 @@ type ExchangeObservation struct { // A ExchangeSpec defines the desired state of a Exchange. type ExchangeSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider ExchangeParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider ExchangeParameters `json:"forProvider"` } // A ExchangeStatus represents the observed state of a Exchange. @@ -78,7 +79,7 @@ type ExchangeStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type Exchange struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/groupversion_info.go b/apis/core/v1alpha1/groupversion_info.go index 60f3c27..6af1dfd 100644 --- a/apis/core/v1alpha1/groupversion_info.go +++ b/apis/core/v1alpha1/groupversion_info.go @@ -1,5 +1,5 @@ /* -Copyright 2020 The Crossplane Authors. +Copyright 2025 The Crossplane Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ limitations under the License. // Package v1alpha1 contains the v1alpha1 group Sample resources of the RabbitMq provider. // +kubebuilder:object:generate=true -// +groupName=core.rabbitmq.crossplane.io +// +groupName=core.rabbitmq.m.crossplane.io // +versionName=v1alpha1 package v1alpha1 @@ -27,7 +27,7 @@ import ( // Package type metadata. const ( - Group = "core.rabbitmq.crossplane.io" + Group = "core.rabbitmq.m.crossplane.io" Version = "v1alpha1" ) diff --git a/apis/core/v1alpha1/permissions_types.go b/apis/core/v1alpha1/permissions_types.go index 60ce464..a64a351 100644 --- a/apis/core/v1alpha1/permissions_types.go +++ b/apis/core/v1alpha1/permissions_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // PermissionsParameters are the configurable fields of a Permissions. @@ -52,8 +53,8 @@ type PermissionsObservation struct { // A PermissionsSpec defines the desired state of a Permissions. type PermissionsSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider PermissionsParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider PermissionsParameters `json:"forProvider"` } // A PermissionsStatus represents the observed state of a Permissions. @@ -70,7 +71,7 @@ type PermissionsStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type Permissions struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/queue_types.go b/apis/core/v1alpha1/queue_types.go index 59e70bd..f3fb3ac 100644 --- a/apis/core/v1alpha1/queue_types.go +++ b/apis/core/v1alpha1/queue_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // QueueParameters are the configurable fields of a Queue. @@ -60,8 +61,8 @@ type QueueObservation struct { // A QueueSpec defines the desired state of a Queue. type QueueSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider QueueParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider QueueParameters `json:"forProvider"` } // A QueueStatus represents the observed state of a Queue. @@ -78,7 +79,7 @@ type QueueStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type Queue struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/user_types.go b/apis/core/v1alpha1/user_types.go index 639a0d5..b60e251 100644 --- a/apis/core/v1alpha1/user_types.go +++ b/apis/core/v1alpha1/user_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // UserParameters are the configurable fields of a User. @@ -50,8 +51,8 @@ type UserObservation struct { // A UserSpec defines the desired state of a User. type UserSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider UserParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider UserParameters `json:"forProvider"` } // A UserStatus represents the observed state of a User. @@ -68,7 +69,7 @@ type UserStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type User struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/vhost_types.go b/apis/core/v1alpha1/vhost_types.go index 798d85d..0c98b97 100644 --- a/apis/core/v1alpha1/vhost_types.go +++ b/apis/core/v1alpha1/vhost_types.go @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // VhostParameters are the configurable fields of a Vhost @@ -58,8 +59,8 @@ type VhostObservation struct { // A VhostSpec defines the desired state of a Vhost. type VhostSpec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider VhostParameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider VhostParameters `json:"forProvider"` } // A VhostStatus represents the observed state of a Vhost. @@ -76,7 +77,7 @@ type VhostStatus struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,rabbitmq} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,rabbitmq} type Vhost struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/core/v1alpha1/zz_generated.deepcopy.go b/apis/core/v1alpha1/zz_generated.deepcopy.go index 38c3d31..b3845c1 100644 --- a/apis/core/v1alpha1/zz_generated.deepcopy.go +++ b/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -9,7 +9,7 @@ package v1alpha1 import ( - "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -119,7 +119,7 @@ func (in *BindingParameters) DeepCopy() *BindingParameters { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BindingSpec) DeepCopyInto(out *BindingSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } @@ -296,7 +296,7 @@ func (in *ExchangeSettings) DeepCopy() *ExchangeSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExchangeSpec) DeepCopyInto(out *ExchangeSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } @@ -439,7 +439,7 @@ func (in *PermissionsParameters) DeepCopy() *PermissionsParameters { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PermissionsSpec) DeepCopyInto(out *PermissionsSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } @@ -616,7 +616,7 @@ func (in *QueueSettings) DeepCopy() *QueueSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *QueueSpec) DeepCopyInto(out *QueueSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } @@ -784,7 +784,7 @@ func (in *UserSettings) DeepCopy() *UserSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UserSpec) DeepCopyInto(out *UserSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } @@ -981,7 +981,7 @@ func (in *VhostSettings) DeepCopy() *VhostSettings { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VhostSpec) DeepCopyInto(out *VhostSpec) { *out = *in - in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ManagedResourceSpec.DeepCopyInto(&out.ManagedResourceSpec) in.ForProvider.DeepCopyInto(&out.ForProvider) } diff --git a/apis/core/v1alpha1/zz_generated.managed.go b/apis/core/v1alpha1/zz_generated.managed.go index 3cced7a..b6059b6 100644 --- a/apis/core/v1alpha1/zz_generated.managed.go +++ b/apis/core/v1alpha1/zz_generated.managed.go @@ -6,35 +6,25 @@ package v1alpha1 -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" // GetCondition of this Binding. func (mg *Binding) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this Binding. -func (mg *Binding) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this Binding. func (mg *Binding) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this Binding. -func (mg *Binding) GetProviderConfigReference() *xpv1.Reference { +func (mg *Binding) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this Binding. -func (mg *Binding) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this Binding. -func (mg *Binding) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *Binding) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -43,28 +33,18 @@ func (mg *Binding) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this Binding. -func (mg *Binding) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this Binding. func (mg *Binding) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this Binding. -func (mg *Binding) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *Binding) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this Binding. -func (mg *Binding) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this Binding. -func (mg *Binding) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *Binding) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } @@ -73,28 +53,18 @@ func (mg *Exchange) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this Exchange. -func (mg *Exchange) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this Exchange. func (mg *Exchange) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this Exchange. -func (mg *Exchange) GetProviderConfigReference() *xpv1.Reference { +func (mg *Exchange) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this Exchange. -func (mg *Exchange) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this Exchange. -func (mg *Exchange) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *Exchange) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -103,28 +73,18 @@ func (mg *Exchange) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this Exchange. -func (mg *Exchange) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this Exchange. func (mg *Exchange) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this Exchange. -func (mg *Exchange) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *Exchange) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this Exchange. -func (mg *Exchange) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this Exchange. -func (mg *Exchange) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *Exchange) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } @@ -133,28 +93,18 @@ func (mg *Permissions) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this Permissions. -func (mg *Permissions) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this Permissions. func (mg *Permissions) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this Permissions. -func (mg *Permissions) GetProviderConfigReference() *xpv1.Reference { +func (mg *Permissions) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this Permissions. -func (mg *Permissions) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this Permissions. -func (mg *Permissions) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *Permissions) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -163,28 +113,18 @@ func (mg *Permissions) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this Permissions. -func (mg *Permissions) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this Permissions. func (mg *Permissions) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this Permissions. -func (mg *Permissions) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *Permissions) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this Permissions. -func (mg *Permissions) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this Permissions. -func (mg *Permissions) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *Permissions) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } @@ -193,28 +133,18 @@ func (mg *Queue) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this Queue. -func (mg *Queue) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this Queue. func (mg *Queue) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this Queue. -func (mg *Queue) GetProviderConfigReference() *xpv1.Reference { +func (mg *Queue) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this Queue. -func (mg *Queue) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this Queue. -func (mg *Queue) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *Queue) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -223,28 +153,18 @@ func (mg *Queue) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this Queue. -func (mg *Queue) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this Queue. func (mg *Queue) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this Queue. -func (mg *Queue) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *Queue) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this Queue. -func (mg *Queue) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this Queue. -func (mg *Queue) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *Queue) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } @@ -253,28 +173,18 @@ func (mg *User) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this User. -func (mg *User) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this User. func (mg *User) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this User. -func (mg *User) GetProviderConfigReference() *xpv1.Reference { +func (mg *User) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this User. -func (mg *User) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this User. -func (mg *User) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *User) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -283,28 +193,18 @@ func (mg *User) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this User. -func (mg *User) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this User. func (mg *User) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this User. -func (mg *User) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *User) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this User. -func (mg *User) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this User. -func (mg *User) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *User) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } @@ -313,28 +213,18 @@ func (mg *Vhost) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) } -// GetDeletionPolicy of this Vhost. -func (mg *Vhost) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - // GetManagementPolicies of this Vhost. func (mg *Vhost) GetManagementPolicies() xpv1.ManagementPolicies { return mg.Spec.ManagementPolicies } // GetProviderConfigReference of this Vhost. -func (mg *Vhost) GetProviderConfigReference() *xpv1.Reference { +func (mg *Vhost) GetProviderConfigReference() *xpv1.ProviderConfigReference { return mg.Spec.ProviderConfigReference } -// GetPublishConnectionDetailsTo of this Vhost. -func (mg *Vhost) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - // GetWriteConnectionSecretToReference of this Vhost. -func (mg *Vhost) GetWriteConnectionSecretToReference() *xpv1.SecretReference { +func (mg *Vhost) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { return mg.Spec.WriteConnectionSecretToReference } @@ -343,27 +233,17 @@ func (mg *Vhost) SetConditions(c ...xpv1.Condition) { mg.Status.SetConditions(c...) } -// SetDeletionPolicy of this Vhost. -func (mg *Vhost) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - // SetManagementPolicies of this Vhost. func (mg *Vhost) SetManagementPolicies(r xpv1.ManagementPolicies) { mg.Spec.ManagementPolicies = r } // SetProviderConfigReference of this Vhost. -func (mg *Vhost) SetProviderConfigReference(r *xpv1.Reference) { +func (mg *Vhost) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { mg.Spec.ProviderConfigReference = r } -// SetPublishConnectionDetailsTo of this Vhost. -func (mg *Vhost) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - // SetWriteConnectionSecretToReference of this Vhost. -func (mg *Vhost) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { +func (mg *Vhost) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { mg.Spec.WriteConnectionSecretToReference = r } diff --git a/apis/core/v1alpha1/zz_generated.managedlist.go b/apis/core/v1alpha1/zz_generated.managedlist.go index a106f0f..0d82c84 100644 --- a/apis/core/v1alpha1/zz_generated.managedlist.go +++ b/apis/core/v1alpha1/zz_generated.managedlist.go @@ -6,7 +6,7 @@ package v1alpha1 -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" +import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" // GetItems of this BindingList. func (l *BindingList) GetItems() []resource.Managed { diff --git a/apis/generate.go b/apis/generate.go index 4ff1a7f..ce4a0f9 100644 --- a/apis/generate.go +++ b/apis/generate.go @@ -1,7 +1,5 @@ -//go:build generate - /* -Copyright 2020 The Crossplane Authors. +Copyright 2025 The Crossplane Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -29,9 +27,3 @@ limitations under the License. //go:generate go run -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./... package apis - -import ( - _ "sigs.k8s.io/controller-tools/cmd/controller-gen" //nolint:typecheck - - _ "github.com/crossplane/crossplane-tools/cmd/angryjet" //nolint:typecheck -) diff --git a/apis/v1alpha1/doc.go b/apis/v1alpha1/doc.go index 9c30a17..c66b3c4 100644 --- a/apis/v1alpha1/doc.go +++ b/apis/v1alpha1/doc.go @@ -14,4 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// Package v1alpha1 contains the core resources of the Template provider. +// +kubebuilder:object:generate=true +// +groupName=rabbitmq.m.crossplane.io +// +versionName=v1alpha1 package v1alpha1 diff --git a/apis/v1alpha1/groupversion_info.go b/apis/v1alpha1/groupversion_info.go deleted file mode 100644 index 216758c..0000000 --- a/apis/v1alpha1/groupversion_info.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1alpha1 contains the core resources of the RabbitMq provider. -// +kubebuilder:object:generate=true -// +groupName=rabbitmq.crossplane.io -// +versionName=v1alpha1 -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -// Package type metadata. -const ( - Group = "rabbitmq.crossplane.io" - Version = "v1alpha1" -) - -var ( - // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} -) diff --git a/apis/v1alpha1/providerconfig_types.go b/apis/v1alpha1/providerconfig_types.go deleted file mode 100644 index 75f0611..0000000 --- a/apis/v1alpha1/providerconfig_types.go +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "reflect" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" -) - -// A ProviderConfigSpec defines the desired state of a ProviderConfig. -type ProviderConfigSpec struct { - // Credentials required to authenticate to this provider. - Credentials ProviderCredentials `json:"credentials"` -} - -// ProviderCredentials required to authenticate. -type ProviderCredentials struct { - // Source of the provider credentials. - // +kubebuilder:validation:Enum=None;Secret;InjectedIdentity;Environment;Filesystem - Source xpv1.CredentialsSource `json:"source"` - - xpv1.CommonCredentialSelectors `json:",inline"` -} - -// A ProviderConfigStatus reflects the observed state of a ProviderConfig. -type ProviderConfigStatus struct { - xpv1.ProviderConfigStatus `json:",inline"` -} - -// +kubebuilder:object:root=true - -// A ProviderConfig configures a RabbitMq provider. -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:printcolumn:name="SECRET-NAME",type="string",JSONPath=".spec.credentials.secretRef.name",priority=1 -// +kubebuilder:resource:scope=Cluster -type ProviderConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ProviderConfigSpec `json:"spec"` - Status ProviderConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// ProviderConfigList contains a list of ProviderConfig. -type ProviderConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ProviderConfig `json:"items"` -} - -// ProviderConfig type metadata. -var ( - ProviderConfigKind = reflect.TypeOf(ProviderConfig{}).Name() - ProviderConfigGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigKind}.String() - ProviderConfigKindAPIVersion = ProviderConfigKind + "." + SchemeGroupVersion.String() - ProviderConfigGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigKind) -) - -func init() { - SchemeBuilder.Register(&ProviderConfig{}, &ProviderConfigList{}) -} diff --git a/apis/v1alpha1/providerconfigusage_types.go b/apis/v1alpha1/providerconfigusage_types.go deleted file mode 100644 index 9721798..0000000 --- a/apis/v1alpha1/providerconfigusage_types.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2021 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "reflect" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" -) - -// +kubebuilder:object:root=true - -// A ProviderConfigUsage indicates that a resource is using a ProviderConfig. -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:printcolumn:name="CONFIG-NAME",type="string",JSONPath=".providerConfigRef.name" -// +kubebuilder:printcolumn:name="RESOURCE-KIND",type="string",JSONPath=".resourceRef.kind" -// +kubebuilder:printcolumn:name="RESOURCE-NAME",type="string",JSONPath=".resourceRef.name" -// +kubebuilder:resource:scope=Cluster,categories={crossplane,provider,rabbitmq} -type ProviderConfigUsage struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - xpv1.ProviderConfigUsage `json:",inline"` -} - -// +kubebuilder:object:root=true - -// ProviderConfigUsageList contains a list of ProviderConfigUsage -type ProviderConfigUsageList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ProviderConfigUsage `json:"items"` -} - -// ProviderConfigUsage type metadata. -var ( - ProviderConfigUsageKind = reflect.TypeOf(ProviderConfigUsage{}).Name() - ProviderConfigUsageGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigUsageKind}.String() - ProviderConfigUsageKindAPIVersion = ProviderConfigUsageKind + "." + SchemeGroupVersion.String() - ProviderConfigUsageGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageKind) - - ProviderConfigUsageListKind = reflect.TypeOf(ProviderConfigUsageList{}).Name() - ProviderConfigUsageListGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigUsageListKind}.String() - ProviderConfigUsageListKindAPIVersion = ProviderConfigUsageListKind + "." + SchemeGroupVersion.String() - ProviderConfigUsageListGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageListKind) -) - -func init() { - SchemeBuilder.Register(&ProviderConfigUsage{}, &ProviderConfigUsageList{}) -} diff --git a/apis/v1alpha1/register.go b/apis/v1alpha1/register.go new file mode 100644 index 0000000..cd8d340 --- /dev/null +++ b/apis/v1alpha1/register.go @@ -0,0 +1,61 @@ +package v1alpha1 + +import ( + "reflect" + + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +// Package type metadata. +const ( + Group = "rabbitmq.m.crossplane.io" + Version = "v1alpha1" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) + +// ProviderConfig type metadata. +var ( + ProviderConfigKind = reflect.TypeOf(ProviderConfig{}).Name() + ProviderConfigGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigKind}.String() + ProviderConfigGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigKind) +) + +// ProviderConfigUsage type metadata. +var ( + ProviderConfigUsageKind = reflect.TypeOf(ProviderConfigUsage{}).Name() + ProviderConfigUsageGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageKind) + + ProviderConfigUsageListKind = reflect.TypeOf(ProviderConfigUsageList{}).Name() + ProviderConfigUsageListGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageListKind) +) + +// ClusterProviderConfig type metadata +var ( + ClusterProviderConfigKind = reflect.TypeOf(ClusterProviderConfig{}).Name() + ClusterProviderConfigGroupKind = schema.GroupKind{Group: Group, Kind: ClusterProviderConfigKind}.String() + ClusterProviderConfigGroupVersionKind = SchemeGroupVersion.WithKind(ClusterProviderConfigKind) +) + +// ClusterProviderConfigUsage type metadata. +var ( + ClusterProviderConfigUsageKind = reflect.TypeOf(ClusterProviderConfigUsage{}).Name() + ClusterProviderConfigUsageGroupVersionKind = SchemeGroupVersion.WithKind(ClusterProviderConfigUsageKind) + + ClusterProviderConfigUsageListKind = reflect.TypeOf(ClusterProviderConfigUsageList{}).Name() + ClusterProviderConfigUsageListGroupVersionKind = SchemeGroupVersion.WithKind(ClusterProviderConfigUsageListKind) +) + +func init() { + SchemeBuilder.Register(&ProviderConfig{}, &ProviderConfigList{}) + SchemeBuilder.Register(&ProviderConfigUsage{}, &ProviderConfigUsageList{}) + SchemeBuilder.Register(&ClusterProviderConfig{}, &ClusterProviderConfigList{}) + SchemeBuilder.Register(&ClusterProviderConfigUsage{}, &ClusterProviderConfigUsageList{}) +} diff --git a/apis/v1alpha1/storeconfig_types.go b/apis/v1alpha1/storeconfig_types.go deleted file mode 100644 index 6b88e32..0000000 --- a/apis/v1alpha1/storeconfig_types.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2020 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "reflect" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" -) - -// A StoreConfigSpec defines the desired state of a ProviderConfig. -type StoreConfigSpec struct { - xpv1.SecretStoreConfig `json:",inline"` -} - -// A StoreConfigStatus represents the status of a StoreConfig. -type StoreConfigStatus struct { - xpv1.ConditionedStatus `json:",inline"` -} - -// +kubebuilder:object:root=true - -// A StoreConfig configures how GCP controller should store connection details. -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:printcolumn:name="TYPE",type="string",JSONPath=".spec.type" -// +kubebuilder:printcolumn:name="DEFAULT-SCOPE",type="string",JSONPath=".spec.defaultScope" -// +kubebuilder:resource:scope=Cluster,categories={crossplane,store,gcp} -// +kubebuilder:subresource:status -type StoreConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec StoreConfigSpec `json:"spec"` - Status StoreConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// StoreConfigList contains a list of StoreConfig -type StoreConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []StoreConfig `json:"items"` -} - -// Note(turkenh): To be generated with AngryJet - -// GetStoreConfig returns SecretStoreConfig -func (in *StoreConfig) GetStoreConfig() xpv1.SecretStoreConfig { - return in.Spec.SecretStoreConfig -} - -// GetCondition of this StoreConfig. -func (in *StoreConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return in.Status.GetCondition(ct) -} - -// SetConditions of this StoreConfig. -func (in *StoreConfig) SetConditions(c ...xpv1.Condition) { - in.Status.SetConditions(c...) -} - -// StoreConfig type metadata. -var ( - StoreConfigKind = reflect.TypeOf(StoreConfig{}).Name() - StoreConfigGroupKind = schema.GroupKind{Group: Group, Kind: StoreConfigKind}.String() - StoreConfigKindAPIVersion = StoreConfigKind + "." + SchemeGroupVersion.String() - StoreConfigGroupVersionKind = SchemeGroupVersion.WithKind(StoreConfigKind) -) - -func init() { - SchemeBuilder.Register(&StoreConfig{}, &StoreConfigList{}) -} diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go new file mode 100644 index 0000000..a7be654 --- /dev/null +++ b/apis/v1alpha1/types.go @@ -0,0 +1,125 @@ +package v1alpha1 + +import ( + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// A ProviderConfigStatus defines the status of a Provider. +type ProviderConfigStatus struct { + xpv1.ProviderConfigStatus `json:",inline"` +} + +// ProviderCredentials required to authenticate. +type ProviderCredentials struct { + // Source of the provider credentials. + // +kubebuilder:validation:Enum=None;Secret;InjectedIdentity;Environment;Filesystem + Source xpv1.CredentialsSource `json:"source"` + + xpv1.CommonCredentialSelectors `json:",inline"` +} + +type ProviderConfigSpec struct { + // Credentials required to authenticate to this provider. + Credentials ProviderCredentials `json:"credentials"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="SECRET-NAME",type="string",JSONPath=".spec.credentials.secretRef.name",priority=1 +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,provider,template} +// A ProviderConfig configures a Helm 'provider', i.e. a connection to a particular +type ProviderConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ProviderConfigSpec `json:"spec"` + Status ProviderConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ProviderConfigList contains a list of Provider +type ProviderConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProviderConfig `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="CONFIG-NAME",type="string",JSONPath=".providerConfigRef.name" +// +kubebuilder:printcolumn:name="RESOURCE-KIND",type="string",JSONPath=".resourceRef.kind" +// +kubebuilder:printcolumn:name="RESOURCE-NAME",type="string",JSONPath=".resourceRef.name" +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,provider,template} +// A ProviderConfigUsage indicates that a resource is using a ProviderConfig. +type ProviderConfigUsage struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + xpv2.TypedProviderConfigUsage `json:",inline"` +} + +// +kubebuilder:object:root=true + +// ProviderConfigUsageList contains a list of ProviderConfigUsage +type ProviderConfigUsageList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProviderConfigUsage `json:"items"` +} + +// +kubebuilder:object:root=true + +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="SECRET-NAME",type="string",JSONPath=".spec.credentials.secretRef.name",priority=1 +// +kubebuilder:resource:scope=Cluster,categories={crossplane,provider,template} +// A ClusterProviderConfig configures a Template provider. +type ClusterProviderConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ProviderConfigSpec `json:"spec"` + Status ProviderConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ClusterProviderConfigList contains a list of ProviderConfig. +type ClusterProviderConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterProviderConfig `json:"items"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="CONFIG-NAME",type="string",JSONPath=".providerConfigRef.name" +// +kubebuilder:printcolumn:name="RESOURCE-KIND",type="string",JSONPath=".resourceRef.kind" +// +kubebuilder:printcolumn:name="RESOURCE-NAME",type="string",JSONPath=".resourceRef.name" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,provider,template} +// A ClusterProviderConfigUsage indicates that a resource is using a ClusterProviderConfig. +type ClusterProviderConfigUsage struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + xpv2.TypedProviderConfigUsage `json:",inline"` +} + +// +kubebuilder:object:root=true + +// ClusterProviderConfigUsageList contains a list of ClusterProviderConfigUsage +type ClusterProviderConfigUsageList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterProviderConfigUsage `json:"items"` +} diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 6cd5ab2..efcc1f3 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -13,7 +13,7 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfig) DeepCopyInto(out *ProviderConfig) { +func (in *ClusterProviderConfig) DeepCopyInto(out *ClusterProviderConfig) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -21,18 +21,18 @@ func (in *ProviderConfig) DeepCopyInto(out *ProviderConfig) { in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfig. -func (in *ProviderConfig) DeepCopy() *ProviderConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProviderConfig. +func (in *ClusterProviderConfig) DeepCopy() *ClusterProviderConfig { if in == nil { return nil } - out := new(ProviderConfig) + out := new(ClusterProviderConfig) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProviderConfig) DeepCopyObject() runtime.Object { +func (in *ClusterProviderConfig) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -40,31 +40,31 @@ func (in *ProviderConfig) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfigList) DeepCopyInto(out *ProviderConfigList) { +func (in *ClusterProviderConfigList) DeepCopyInto(out *ClusterProviderConfigList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]ProviderConfig, len(*in)) + *out = make([]ClusterProviderConfig, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigList. -func (in *ProviderConfigList) DeepCopy() *ProviderConfigList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProviderConfigList. +func (in *ClusterProviderConfigList) DeepCopy() *ClusterProviderConfigList { if in == nil { return nil } - out := new(ProviderConfigList) + out := new(ClusterProviderConfigList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProviderConfigList) DeepCopyObject() runtime.Object { +func (in *ClusterProviderConfigList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -72,57 +72,84 @@ func (in *ProviderConfigList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfigSpec) DeepCopyInto(out *ProviderConfigSpec) { +func (in *ClusterProviderConfigUsage) DeepCopyInto(out *ClusterProviderConfigUsage) { *out = *in - in.Credentials.DeepCopyInto(&out.Credentials) + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.TypedProviderConfigUsage.DeepCopyInto(&out.TypedProviderConfigUsage) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigSpec. -func (in *ProviderConfigSpec) DeepCopy() *ProviderConfigSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProviderConfigUsage. +func (in *ClusterProviderConfigUsage) DeepCopy() *ClusterProviderConfigUsage { if in == nil { return nil } - out := new(ProviderConfigSpec) + out := new(ClusterProviderConfigUsage) in.DeepCopyInto(out) return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterProviderConfigUsage) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfigStatus) DeepCopyInto(out *ProviderConfigStatus) { +func (in *ClusterProviderConfigUsageList) DeepCopyInto(out *ClusterProviderConfigUsageList) { *out = *in - in.ProviderConfigStatus.DeepCopyInto(&out.ProviderConfigStatus) + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterProviderConfigUsage, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigStatus. -func (in *ProviderConfigStatus) DeepCopy() *ProviderConfigStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProviderConfigUsageList. +func (in *ClusterProviderConfigUsageList) DeepCopy() *ClusterProviderConfigUsageList { if in == nil { return nil } - out := new(ProviderConfigStatus) + out := new(ClusterProviderConfigUsageList) in.DeepCopyInto(out) return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterProviderConfigUsageList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfigUsage) DeepCopyInto(out *ProviderConfigUsage) { +func (in *ProviderConfig) DeepCopyInto(out *ProviderConfig) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.ProviderConfigUsage.DeepCopyInto(&out.ProviderConfigUsage) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigUsage. -func (in *ProviderConfigUsage) DeepCopy() *ProviderConfigUsage { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfig. +func (in *ProviderConfig) DeepCopy() *ProviderConfig { if in == nil { return nil } - out := new(ProviderConfigUsage) + out := new(ProviderConfig) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProviderConfigUsage) DeepCopyObject() runtime.Object { +func (in *ProviderConfig) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -130,31 +157,31 @@ func (in *ProviderConfigUsage) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderConfigUsageList) DeepCopyInto(out *ProviderConfigUsageList) { +func (in *ProviderConfigList) DeepCopyInto(out *ProviderConfigList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]ProviderConfigUsage, len(*in)) + *out = make([]ProviderConfig, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigUsageList. -func (in *ProviderConfigUsageList) DeepCopy() *ProviderConfigUsageList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigList. +func (in *ProviderConfigList) DeepCopy() *ProviderConfigList { if in == nil { return nil } - out := new(ProviderConfigUsageList) + out := new(ProviderConfigList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProviderConfigUsageList) DeepCopyObject() runtime.Object { +func (in *ProviderConfigList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -162,42 +189,57 @@ func (in *ProviderConfigUsageList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderCredentials) DeepCopyInto(out *ProviderCredentials) { +func (in *ProviderConfigSpec) DeepCopyInto(out *ProviderConfigSpec) { *out = *in - in.CommonCredentialSelectors.DeepCopyInto(&out.CommonCredentialSelectors) + in.Credentials.DeepCopyInto(&out.Credentials) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderCredentials. -func (in *ProviderCredentials) DeepCopy() *ProviderCredentials { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigSpec. +func (in *ProviderConfigSpec) DeepCopy() *ProviderConfigSpec { if in == nil { return nil } - out := new(ProviderCredentials) + out := new(ProviderConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProviderConfigStatus) DeepCopyInto(out *ProviderConfigStatus) { + *out = *in + in.ProviderConfigStatus.DeepCopyInto(&out.ProviderConfigStatus) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigStatus. +func (in *ProviderConfigStatus) DeepCopy() *ProviderConfigStatus { + if in == nil { + return nil + } + out := new(ProviderConfigStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StoreConfig) DeepCopyInto(out *StoreConfig) { +func (in *ProviderConfigUsage) DeepCopyInto(out *ProviderConfigUsage) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) + in.TypedProviderConfigUsage.DeepCopyInto(&out.TypedProviderConfigUsage) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoreConfig. -func (in *StoreConfig) DeepCopy() *StoreConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigUsage. +func (in *ProviderConfigUsage) DeepCopy() *ProviderConfigUsage { if in == nil { return nil } - out := new(StoreConfig) + out := new(ProviderConfigUsage) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *StoreConfig) DeepCopyObject() runtime.Object { +func (in *ProviderConfigUsage) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -205,31 +247,31 @@ func (in *StoreConfig) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StoreConfigList) DeepCopyInto(out *StoreConfigList) { +func (in *ProviderConfigUsageList) DeepCopyInto(out *ProviderConfigUsageList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]StoreConfig, len(*in)) + *out = make([]ProviderConfigUsage, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoreConfigList. -func (in *StoreConfigList) DeepCopy() *StoreConfigList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfigUsageList. +func (in *ProviderConfigUsageList) DeepCopy() *ProviderConfigUsageList { if in == nil { return nil } - out := new(StoreConfigList) + out := new(ProviderConfigUsageList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *StoreConfigList) DeepCopyObject() runtime.Object { +func (in *ProviderConfigUsageList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -237,33 +279,17 @@ func (in *StoreConfigList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StoreConfigSpec) DeepCopyInto(out *StoreConfigSpec) { - *out = *in - in.SecretStoreConfig.DeepCopyInto(&out.SecretStoreConfig) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoreConfigSpec. -func (in *StoreConfigSpec) DeepCopy() *StoreConfigSpec { - if in == nil { - return nil - } - out := new(StoreConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StoreConfigStatus) DeepCopyInto(out *StoreConfigStatus) { +func (in *ProviderCredentials) DeepCopyInto(out *ProviderCredentials) { *out = *in - in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus) + in.CommonCredentialSelectors.DeepCopyInto(&out.CommonCredentialSelectors) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StoreConfigStatus. -func (in *StoreConfigStatus) DeepCopy() *StoreConfigStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderCredentials. +func (in *ProviderCredentials) DeepCopy() *ProviderCredentials { if in == nil { return nil } - out := new(StoreConfigStatus) + out := new(ProviderCredentials) in.DeepCopyInto(out) return out } diff --git a/apis/v1alpha1/zz_generated.pc.go b/apis/v1alpha1/zz_generated.pc.go index a961c7b..046581c 100644 --- a/apis/v1alpha1/zz_generated.pc.go +++ b/apis/v1alpha1/zz_generated.pc.go @@ -6,7 +6,27 @@ package v1alpha1 -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetCondition of this ClusterProviderConfig. +func (p *ClusterProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return p.Status.GetCondition(ct) +} + +// GetUsers of this ClusterProviderConfig. +func (p *ClusterProviderConfig) GetUsers() int64 { + return p.Status.Users +} + +// SetConditions of this ClusterProviderConfig. +func (p *ClusterProviderConfig) SetConditions(c ...xpv1.Condition) { + p.Status.SetConditions(c...) +} + +// SetUsers of this ClusterProviderConfig. +func (p *ClusterProviderConfig) SetUsers(i int64) { + p.Status.Users = i +} // GetCondition of this ProviderConfig. func (p *ProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { diff --git a/apis/v1alpha1/zz_generated.pcu.go b/apis/v1alpha1/zz_generated.pcu.go index c6cda0e..b34ef74 100644 --- a/apis/v1alpha1/zz_generated.pcu.go +++ b/apis/v1alpha1/zz_generated.pcu.go @@ -6,10 +6,30 @@ package v1alpha1 -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + +// GetProviderConfigReference of this ClusterProviderConfigUsage. +func (p *ClusterProviderConfigUsage) GetProviderConfigReference() xpv1.ProviderConfigReference { + return p.ProviderConfigReference +} + +// GetResourceReference of this ClusterProviderConfigUsage. +func (p *ClusterProviderConfigUsage) GetResourceReference() xpv1.TypedReference { + return p.ResourceReference +} + +// SetProviderConfigReference of this ClusterProviderConfigUsage. +func (p *ClusterProviderConfigUsage) SetProviderConfigReference(r xpv1.ProviderConfigReference) { + p.ProviderConfigReference = r +} + +// SetResourceReference of this ClusterProviderConfigUsage. +func (p *ClusterProviderConfigUsage) SetResourceReference(r xpv1.TypedReference) { + p.ResourceReference = r +} // GetProviderConfigReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) GetProviderConfigReference() xpv1.Reference { +func (p *ProviderConfigUsage) GetProviderConfigReference() xpv1.ProviderConfigReference { return p.ProviderConfigReference } @@ -19,7 +39,7 @@ func (p *ProviderConfigUsage) GetResourceReference() xpv1.TypedReference { } // SetProviderConfigReference of this ProviderConfigUsage. -func (p *ProviderConfigUsage) SetProviderConfigReference(r xpv1.Reference) { +func (p *ProviderConfigUsage) SetProviderConfigReference(r xpv1.ProviderConfigReference) { p.ProviderConfigReference = r } diff --git a/apis/v1alpha1/zz_generated.pculist.go b/apis/v1alpha1/zz_generated.pculist.go index 6c06eef..d08543e 100644 --- a/apis/v1alpha1/zz_generated.pculist.go +++ b/apis/v1alpha1/zz_generated.pculist.go @@ -6,7 +6,16 @@ package v1alpha1 -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" +import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + +// GetItems of this ClusterProviderConfigUsageList. +func (p *ClusterProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { + items := make([]resource.ProviderConfigUsage, len(p.Items)) + for i := range p.Items { + items[i] = &p.Items[i] + } + return items +} // GetItems of this ProviderConfigUsageList. func (p *ProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { diff --git a/cmd/provider/main.go b/cmd/provider/main.go index 254ecb2..39a2325 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -17,37 +17,36 @@ limitations under the License. package main import ( - "context" "fmt" "io" "os" "path/filepath" "time" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + "github.com/alecthomas/kingpin/v2" + "github.com/crossplane/crossplane-runtime/v2/pkg/gate" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/customresourcesgate" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/metrics" - "gopkg.in/alecthomas/kingpin.v2" - kerrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/leaderelection/resourcelock" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/log/zap" - changelogsv1alpha1 "github.com/crossplane/crossplane-runtime/apis/changelogs/proto/v1alpha1" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/feature" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/resource" + changelogsv1alpha1 "github.com/crossplane/crossplane-runtime/v2/apis/changelogs/proto/v1alpha1" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "github.com/pnowy/provider-rabbitmq/apis" - "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" rabbitmq "github.com/pnowy/provider-rabbitmq/internal/controller" - "github.com/pnowy/provider-rabbitmq/internal/features" "github.com/pnowy/provider-rabbitmq/internal/version" ) @@ -57,15 +56,15 @@ func main() { debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() - syncInterval = app.Flag("sync", "How often all resources will be double-checked for drift from the desired state.").Short('s').Default("1h").Duration() - pollInterval = app.Flag("poll", "How often individual resources will be checked for drift from the desired state").Default("1m").Duration() + syncInterval = app.Flag("sync", "How often all resources will be double-checked for drift from the desired state.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "How often individual resources will be checked for drift from the desired state").Default("1m").Duration() + pollStateMetricInterval = app.Flag("poll-state-metric", "State metric recording interval").Default("5s").Duration() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() - namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() - enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() - enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() - enableChangeLogs = app.Flag("enable-change-logs", "Enable support for capturing change logs during reconciliation.").Default("false").Envar("ENABLE_CHANGE_LOGS").Bool() - changelogsSocketPath = app.Flag("changelogs-socket-path", "Path for changelogs socket (if enabled)").Default("/var/run/changelogs/changelogs.sock").Envar("CHANGELOGS_SOCKET_PATH").String() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("true").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + enableChangeLogs = app.Flag("enable-changelogs", "Enable support for capturing change logs during reconciliation.").Default("false").Envar("ENABLE_CHANGE_LOGS").Bool() + changelogsSocketPath = app.Flag("changelogs-socket-path", "Path for changelogs socket (if enabled)").Default("/var/run/changelogs/changelogs.sock").Envar("CHANGELOGS_SOCKET_PATH").String() ) kingpin.MustParse(app.Parse(os.Args[1:])) @@ -106,7 +105,15 @@ func main() { RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), }) kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add RabbitMq APIs to scheme") + kingpin.FatalIfError(apiextensionsv1.AddToScheme(mgr.GetScheme()), "Cannot add CustomResourceDefinition to scheme") + + metricRecorder := managed.NewMRMetricRecorder() + stateMetrics := statemetrics.NewMRStateMetrics() + + metrics.Registry.MustRegister(metricRecorder) + metrics.Registry.MustRegister(stateMetrics) o := controller.Options{ Logger: log, @@ -114,30 +121,17 @@ func main() { PollInterval: *pollInterval, GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), Features: &feature.Flags{}, - } - - if *enableExternalSecretStores { - o.Features.Enable(features.EnableAlphaExternalSecretStores) - log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) - - // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ - ObjectMeta: metav1.ObjectMeta{ - Name: "default", - }, - Spec: v1alpha1.StoreConfigSpec{ - // NOTE(turkenh): We only set required spec and expect optional - // ones to properly be initialized with CRD level default values. - SecretStoreConfig: xpv1.SecretStoreConfig{ - DefaultScope: *namespace, - }, - }, - })), "cannot create default store config") + Gate: new(gate.Gate[schema.GroupVersionKind]), + MetricOptions: &controller.MetricOptions{ + PollStateMetricInterval: *pollStateMetricInterval, + MRMetrics: metricRecorder, + MRStateMetrics: stateMetrics, + }, } if *enableManagementPolicies { - o.Features.Enable(features.EnableAlphaManagementPolicies) - log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + o.Features.Enable(feature.EnableBetaManagementPolicies) + log.Info("Beta feature enabled", "flag", feature.EnableBetaManagementPolicies) } if *enableChangeLogs { @@ -155,6 +149,7 @@ func main() { o.ChangeLogOptions = &clo } - kingpin.FatalIfError(rabbitmq.Setup(mgr, o), "Cannot setup RabbitMq controllers") + kingpin.FatalIfError(customresourcesgate.Setup(mgr, o), "Cannot setup CRD gate controller") + kingpin.FatalIfError(rabbitmq.SetupGated(mgr, o), "Cannot setup Template controllers") kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") } diff --git a/examples/provider/config-dev.yaml b/examples/provider/config-dev.yaml index fa21aa6..5d784b6 100644 --- a/examples/provider/config-dev.yaml +++ b/examples/provider/config-dev.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: rabbitmq-credentials - namespace: crossplane-system + namespace: rabbitmq stringData: # for local development/running the rabbitmq address must be forwarder locally, in operator installed within k8s use for example http://rabbitmq.rabbitmq.svc.cluster.local:15672 credentials: | { @@ -11,14 +11,15 @@ stringData: # for local development/running the rabbitmq address must be forward "endpoint": "http://localhost:15672" } --- -apiVersion: rabbitmq.crossplane.io/v1alpha1 +apiVersion: rabbitmq.m.crossplane.io/v1alpha1 kind: ProviderConfig metadata: name: provider-rabbitmq + namespace: rabbitmq spec: credentials: source: Secret secretRef: name: rabbitmq-credentials - namespace: crossplane-system + namespace: rabbitmq key: credentials \ No newline at end of file diff --git a/examples/provider/config.yaml b/examples/provider/config.yaml index f6a75d5..27e37fc 100644 --- a/examples/provider/config.yaml +++ b/examples/provider/config.yaml @@ -7,7 +7,7 @@ apiVersion: v1 kind: Secret metadata: name: rabbitmq-credentials - namespace: crossplane-system + namespace: rabbitmq stringData: credentials: | { @@ -16,14 +16,27 @@ stringData: "endpoint": "http://rabbitmq.rabbitmq.svc.cluster.local:15672" } --- -apiVersion: rabbitmq.crossplane.io/v1alpha1 +apiVersion: rabbitmq.m.crossplane.io/v1alpha1 kind: ProviderConfig metadata: name: provider-rabbitmq + namespace: rabbitmq spec: credentials: source: Secret secretRef: name: rabbitmq-credentials - namespace: crossplane-system + namespace: rabbitmq key: credentials +--- +apiVersion: rabbitmq.m.crossplane.io/v1alpha1 +kind: ClusterProviderConfig +metadata: + name: provider-rabbitmq +spec: + credentials: + source: Secret + secretRef: + name: rabbitmq-credentials + namespace: rabbitmq + key: credentials \ No newline at end of file diff --git a/examples/sample/binding.yaml b/examples/sample/binding.yaml index 0a595ef..4050053 100644 --- a/examples/sample/binding.yaml +++ b/examples/sample/binding.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Binding metadata: name: my-binding + namespace: default spec: forProvider: vhost: demo @@ -13,3 +14,4 @@ spec: region: europe providerConfigRef: name: provider-rabbitmq + kind: ClusterProviderConfig diff --git a/examples/sample/exchange-name-in-provider.yaml b/examples/sample/exchange-name-in-provider.yaml index 05b5c33..fd9319f 100644 --- a/examples/sample/exchange-name-in-provider.yaml +++ b/examples/sample/exchange-name-in-provider.yaml @@ -1,14 +1,16 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Exchange metadata: name: myexchange-name-in-provider + namespace: rabbitmq spec: forProvider: name: crossplane-exchange vhost: demo - exchange_settings: + exchangeSettings: type: direct durable: false - auto_delete: true + autoDelete: true providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/exchange-with-arguments.yaml b/examples/sample/exchange-with-arguments.yaml index 5497908..6cfdcf1 100644 --- a/examples/sample/exchange-with-arguments.yaml +++ b/examples/sample/exchange-with-arguments.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Exchange metadata: - name: myexchange + name: myexchange-with-arguments + namespace: rabbitmq spec: forProvider: vhost: demo @@ -13,4 +14,5 @@ spec: "x-delayed-type": "direct" "x-expires": "300000" # 5 minutes providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/exchange.yaml b/examples/sample/exchange.yaml index ae134aa..c250f59 100644 --- a/examples/sample/exchange.yaml +++ b/examples/sample/exchange.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Exchange metadata: name: myexchange + namespace: rabbitmq spec: forProvider: vhost: demo @@ -10,4 +11,5 @@ spec: durable: true autoDelete: false providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/permissions.yaml b/examples/sample/permissions.yaml index 2048cb5..cef6e21 100644 --- a/examples/sample/permissions.yaml +++ b/examples/sample/permissions.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Permissions metadata: name: demo-user-permissions + namespace: rabbitmq spec: forProvider: vhost: demo @@ -12,3 +13,4 @@ spec: read: .* providerConfigRef: name: provider-rabbitmq + kind: ProviderConfig diff --git a/examples/sample/queue-name-in-provider.yaml b/examples/sample/queue-name-in-provider.yaml index f474609..88d4371 100644 --- a/examples/sample/queue-name-in-provider.yaml +++ b/examples/sample/queue-name-in-provider.yaml @@ -1,14 +1,16 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Queue metadata: name: myqueue-name-in-provider + namespace: rabbitmq spec: forProvider: vhost: demo - name: myqueue + name: myqueue-name-in-provider queueSettings: type: classic durable: true autoDelete: false providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/queue-with-arguments.yaml b/examples/sample/queue-with-arguments.yaml index fbf1acb..e62bde7 100644 --- a/examples/sample/queue-with-arguments.yaml +++ b/examples/sample/queue-with-arguments.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Queue metadata: - name: myqueue + name: myqueue-with-arguments + namespace: rabbitmq spec: forProvider: vhost: demo @@ -10,4 +11,5 @@ spec: "x-queue-type": "classic" "x-message-ttl": "30000" providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/queue.yaml b/examples/sample/queue.yaml index 1627afe..0744cf9 100644 --- a/examples/sample/queue.yaml +++ b/examples/sample/queue.yaml @@ -1,9 +1,11 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Queue metadata: name: myqueue + namespace: rabbitmq spec: forProvider: vhost: demo providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/user-direct-pass.yaml b/examples/sample/user-direct-pass.yaml index f2ebc21..d9c31f3 100644 --- a/examples/sample/user-direct-pass.yaml +++ b/examples/sample/user-direct-pass.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: User metadata: name: demo + namespace: rabbitmq spec: forProvider: username: demo @@ -10,4 +11,5 @@ spec: tags: - "administrator" providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/user-passwordless.yaml b/examples/sample/user-passwordless.yaml index 5abcc95..1df0453 100644 --- a/examples/sample/user-passwordless.yaml +++ b/examples/sample/user-passwordless.yaml @@ -1,9 +1,11 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: User metadata: name: demo + namespace: rabbitmq spec: forProvider: username: demo providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/user-secret-pass.yaml b/examples/sample/user-secret-pass.yaml index d6a9e57..086fb53 100644 --- a/examples/sample/user-secret-pass.yaml +++ b/examples/sample/user-secret-pass.yaml @@ -2,23 +2,25 @@ apiVersion: v1 kind: Secret metadata: name: demo-user-credentials - namespace: crossplane-system + namespace: rabbitmq stringData: password: "admin123" --- -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: User metadata: name: demo + namespace: rabbitmq spec: forProvider: username: demo userSettings: passwordSecretRef: - namespace: crossplane-system + namespace: rabbitmq name: demo-user-credentials key: password tags: - "administrator" providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/examples/sample/vhost.yaml b/examples/sample/vhost.yaml index ed8aefa..ac070f4 100644 --- a/examples/sample/vhost.yaml +++ b/examples/sample/vhost.yaml @@ -1,7 +1,8 @@ -apiVersion: core.rabbitmq.crossplane.io/v1alpha1 +apiVersion: core.rabbitmq.m.crossplane.io/v1alpha1 kind: Vhost metadata: name: demo + namespace: rabbitmq spec: forProvider: hostName: demo @@ -9,4 +10,5 @@ spec: defaultQueueType: quorum description: "Demo Vhost" providerConfigRef: - name: provider-rabbitmq \ No newline at end of file + name: provider-rabbitmq + kind: ProviderConfig \ No newline at end of file diff --git a/go.mod b/go.mod index 367c795..66478d2 100644 --- a/go.mod +++ b/go.mod @@ -1,50 +1,52 @@ module github.com/pnowy/provider-rabbitmq -go 1.23.10 +go 1.24.10 + +tool sigs.k8s.io/controller-tools/cmd/controller-gen + +tool github.com/crossplane/crossplane-tools/cmd/angryjet require ( - github.com/crossplane/crossplane-runtime v1.20.0 - github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 + github.com/alecthomas/kingpin/v2 v2.4.0 + github.com/crossplane/crossplane-runtime/v2 v2.1.0 github.com/google/go-cmp v0.7.0 - github.com/michaelklishin/rabbit-hole/v3 v3.1.0 + github.com/michaelklishin/rabbit-hole/v3 v3.2.0 github.com/pkg/errors v0.9.1 - google.golang.org/grpc v1.65.0 - gopkg.in/alecthomas/kingpin.v2 v2.2.6 - k8s.io/api v0.31.2 - k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.2 - sigs.k8s.io/controller-runtime v0.19.0 - sigs.k8s.io/controller-tools v0.16.5 + google.golang.org/grpc v1.77.0 + k8s.io/api v0.34.2 + k8s.io/apiextensions-apiserver v0.34.1 + k8s.io/apimachinery v0.34.2 + k8s.io/client-go v0.34.1 + sigs.k8s.io/controller-runtime v0.22.4 ) require ( - dario.cat/mergo v1.0.1 // indirect - github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect - github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect + dario.cat/mergo v1.0.2 // indirect + github.com/Masterminds/semver/v3 v3.4.0 // indirect + github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/dave/jennifer v1.4.1 // indirect + github.com/crossplane/crossplane-tools v0.0.0-20251017183449-dd4517244339 // indirect + github.com/dave/jennifer v1.7.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/emicklei/go-restful/v3 v3.12.2 // indirect github.com/evanphx/json-patch v5.9.11+incompatible // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect + github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fatih/color v1.18.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/gofuzz v1.2.0 // indirect + github.com/google/btree v1.1.3 // indirect + github.com/google/gnostic-models v0.7.0 // indirect + github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -52,40 +54,50 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/onsi/ginkgo/v2 v2.25.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.22.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.62.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/cobra v1.9.1 // indirect + github.com/spf13/pflag v1.0.7 // indirect github.com/x448/float16 v0.8.4 // indirect + github.com/xhit/go-str2duration/v2 v2.1.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.38.0 // indirect - golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sync v0.12.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.26.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/mod v0.28.0 // indirect + golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 // indirect + golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/term v0.36.0 // indirect + golang.org/x/text v0.30.0 // indirect + golang.org/x/time v0.9.0 // indirect + golang.org/x/tools v0.37.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect + google.golang.org/protobuf v1.36.10 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.2 // indirect - k8s.io/component-base v0.31.2 // indirect + k8s.io/code-generator v0.34.1 // indirect + k8s.io/component-base v0.34.1 // indirect + k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect + k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect + k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect + sigs.k8s.io/controller-tools v0.19.0 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/go.sum b/go.sum index 0c8e44d..199c459 100644 --- a/go.sum +++ b/go.sum @@ -1,74 +1,88 @@ -dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= -dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= +cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= +dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= +github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= +github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= +github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/crossplane/crossplane-runtime v1.20.0 h1:I54uipRIecqZyms+vz1J/l62yjVQ7HV5w+Nh3RMrUtc= -github.com/crossplane/crossplane-runtime v1.20.0/go.mod h1:lfV1VJenDc9PNVLxDC80YjPoTm+JdSZ13xlS2h37Dvg= -github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y= -github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0= -github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= -github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= +github.com/crossplane/crossplane-runtime/v2 v2.1.0 h1:JBMhL9T+/PfyjLAQEdZWlKLvA3jJVtza8zLLwd9Gs4k= +github.com/crossplane/crossplane-runtime/v2 v2.1.0/go.mod h1:j78pmk0qlI//Ur7zHhqTr8iePHFcwJKrZnzZB+Fg4t0= +github.com/crossplane/crossplane-tools v0.0.0-20251017183449-dd4517244339 h1:MPbMxSlY+82UsjrLUAGyXlh/iX1tL5WNj8W9SOaq/nk= +github.com/crossplane/crossplane-tools v0.0.0-20251017183449-dd4517244339/go.mod h1:8etxwmP4cZwJDwen4+PQlnc1tggltAhEfyyigmdHulQ= +github.com/dave/jennifer v1.7.1 h1:B4jJJDHelWcDhlRQxWeo0Npa/pYKBLrirAQoTN45txo= +github.com/dave/jennifer v1.7.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= +github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.9.11+incompatible h1:ixHHqfcGvxhWkniF1tWxBHA0yb4Z+d1UQi45df52xW8= github.com/evanphx/json-patch v5.9.11+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= -github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= -github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gobuffalo/flect v1.0.3 h1:xeWBM2nui+qnVvNM4S3foBhCAL2XgPU+a7FdpelbTq4= github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= +github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= +github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -77,6 +91,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -84,6 +100,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -91,67 +109,101 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/michaelklishin/rabbit-hole/v3 v3.1.0 h1:ar9/AQedbJzmCaPL8axu18Gm+zvpQk9xjzJQ+daKlHQ= -github.com/michaelklishin/rabbit-hole/v3 v3.1.0/go.mod h1:3pmYEJhHyKcMMYkmWBz1kX4gD0o/ptUgbZqAsbOygQI= +github.com/michaelklishin/rabbit-hole/v3 v3.2.0 h1:N4YdHFj36MP5059Csze9B4TTZPS6j6HPJm9bBeZgvJk= +github.com/michaelklishin/rabbit-hole/v3 v3.2.0/go.mod h1:LTyucfaAV/Y++Y6aVfAmsc6lvKw3y0WEyQa+yPAXcXc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= -github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/gomega v1.35.0 h1:xuM1M/UvMp9BCdS4hojhS9/4jEuVqS9Er3bqupeaoPM= -github.com/onsi/gomega v1.35.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY= +github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk= +github.com/onsi/gomega v1.38.1 h1:FaLA8GlcpXDwsb7m0h2A9ew2aTk3vnZMlzFgg5tz/pk= +github.com/onsi/gomega v1.38.1/go.mod h1:LfcV8wZLvwcYRwPiJysphKAEsmcFnLMK/9c+PjvlX8g= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= +github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io= +github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw= github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= +github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -159,56 +211,63 @@ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= +golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= -golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 h1:6/3JGEh1C88g7m+qzzTbl3A0FtsLguXieqofVLU/JAo= +golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= +golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= +golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= +golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= +golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+VGVgY1nudX5lXY= +golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= +google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 h1:M1rk8KBnUsBDg1oPGHNCxG4vc1f49epmTO7xscSajMk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= +google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -218,36 +277,44 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0= -k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk= -k8s.io/apiextensions-apiserver v0.31.2 h1:W8EwUb8+WXBLu56ser5IudT2cOho0gAKeTOnywBLxd0= -k8s.io/apiextensions-apiserver v0.31.2/go.mod h1:i+Geh+nGCJEGiCGR3MlBDkS7koHIIKWVfWeRFiOsUcM= -k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw= -k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= -k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= -k8s.io/component-base v0.31.2 h1:Z1J1LIaC0AV+nzcPRFqfK09af6bZ4D1nAOpWsy9owlA= -k8s.io/component-base v0.31.2/go.mod h1:9PeyyFN/drHjtJZMCTkSpQJS3U9OXORnHQqMLDz0sUQ= +k8s.io/api v0.34.2 h1:fsSUNZhV+bnL6Aqrp6O7lMTy6o5x2C4XLjnh//8SLYY= +k8s.io/api v0.34.2/go.mod h1:MMBPaWlED2a8w4RSeanD76f7opUoypY8TFYkSM+3XHw= +k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI= +k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc= +k8s.io/apimachinery v0.34.2 h1:zQ12Uk3eMHPxrsbUJgNF8bTauTVR2WgqJsTmwTE/NW4= +k8s.io/apimachinery v0.34.2/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/apiserver v0.34.1 h1:U3JBGdgANK3dfFcyknWde1G6X1F4bg7PXuvlqt8lITA= +k8s.io/apiserver v0.34.1/go.mod h1:eOOc9nrVqlBI1AFCvVzsob0OxtPZUCPiUJL45JOTBG0= +k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= +k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= +k8s.io/code-generator v0.34.1 h1:WpphT26E+j7tEgIUfFr5WfbJrktCGzB3JoJH9149xYc= +k8s.io/code-generator v0.34.1/go.mod h1:DeWjekbDnJWRwpw3s0Jat87c+e0TgkxoR4ar608yqvg= +k8s.io/component-base v0.34.1 h1:v7xFgG+ONhytZNFpIz5/kecwD+sUhVE6HU7qQUiRM4A= +k8s.io/component-base v0.34.1/go.mod h1:mknCpLlTSKHzAQJJnnHVKqjxR7gBeHRv0rPXA7gdtQ0= +k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q= +k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= -sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= -sigs.k8s.io/controller-tools v0.16.5 h1:5k9FNRqziBPwqr17AMEPPV/En39ZBplLAdOwwQHruP4= -sigs.k8s.io/controller-tools v0.16.5/go.mod h1:8vztuRVzs8IuuJqKqbXCSlXcw+lkAv/M2sTpg55qjMY= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/controller-runtime v0.22.4 h1:GEjV7KV3TY8e+tJ2LCTxUTanW4z/FmNB7l327UfMq9A= +sigs.k8s.io/controller-runtime v0.22.4/go.mod h1:+QX1XUpTXN4mLoblf4tqr5CQcyHPAki2HLXqQMY6vh8= +sigs.k8s.io/controller-tools v0.19.0 h1:OU7jrPPiZusryu6YK0jYSjPqg8Vhf8cAzluP9XGI5uk= +sigs.k8s.io/controller-tools v0.19.0/go.mod h1:y5HY/iNDFkmFla2CfQoVb2AQXMsBk4ad84iR1PLANB0= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl b/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl index ed04c5f..0205293 100644 --- a/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl +++ b/hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl @@ -22,7 +22,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" ) // {{ .Env.KIND }}Parameters are the configurable fields of a {{ .Env.KIND }}. @@ -38,8 +39,8 @@ type {{ .Env.KIND }}Observation struct { // A {{ .Env.KIND }}Spec defines the desired state of a {{ .Env.KIND }}. type {{ .Env.KIND }}Spec struct { - xpv1.ResourceSpec `json:",inline"` - ForProvider {{ .Env.KIND }}Parameters `json:"forProvider"` + xpv2.ManagedResourceSpec `json:",inline"` + ForProvider {{ .Env.KIND }}Parameters `json:"forProvider"` } // A {{ .Env.KIND }}Status represents the observed state of a {{ .Env.KIND }}. @@ -56,7 +57,7 @@ type {{ .Env.KIND }}Status struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,{{ .Env.PROVIDER | strings.ToLower }}} +// +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,{{ .Env.PROVIDER | strings.ToLower }}} type {{ .Env.KIND }} struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl b/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl index fd76dc2..1b13e38 100644 --- a/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl +++ b/hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl @@ -20,31 +20,30 @@ import ( "context" "fmt" - "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" - "{{ .Env.PROJECT_REPO | strings.ToLower }}/apis/{{ .Env.GROUP | strings.ToLower }}/{{ .Env.APIVERSION | strings.ToLower }}" + {{ .Env.APIVERSION | strings.ToLower }} "{{ .Env.PROJECT_REPO | strings.ToLower }}/apis/{{ .Env.GROUP | strings.ToLower }}/{{ .Env.APIVERSION | strings.ToLower }}" apisv1alpha1 "{{ .Env.PROJECT_REPO | strings.ToLower }}/apis/v1alpha1" - "{{ .Env.PROJECT_REPO | strings.ToLower }}/internal/features" ) const ( - errNot{{ .Env.KIND }} = "managed resource is not a {{ .Env.KIND }} custom resource" + errNot{{ .Env.KIND }} = "managed resource is not a {{ .Env.KIND }} custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" - errGetPC = "cannot get ProviderConfig" - errGetCreds = "cannot get credentials" + errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" + errGetCreds = "cannot get credentials" errNewClient = "cannot create new Service" ) @@ -56,25 +55,31 @@ var ( newNoOpService = func(_ []byte) (interface{}, error) { return &NoOpService{}, nil } ) -// Setup adds a controller that reconciles {{ .Env.KIND }} managed resources. +// SetupGated adds a controller that reconciles {{ .Env.KIND }} managed resources with safe-start support. +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup {{ .Env.KIND }} controller")) + } + }, v1alpha1.{{ .Env.KIND }}GroupVersionKind) + return nil +} + func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.{{ .Env.KIND }}GroupKind) - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(&connector{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: newNoOpService}), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...), - managed.WithManagementPolicies(), + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) } if o.Features.Enabled(feature.EnableAlphaChangeLogs) { @@ -108,7 +113,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (interface{}, error) } @@ -118,21 +123,37 @@ type connector struct { // 3. Getting the credentials specified by the ProviderConfig. // 4. Using the credentials to form a client. func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.ExternalClient, error) { - cr, ok := mg.(*v1alpha1.{{ .Env.KIND }}) + cr, ok := mg.(*{{ .Env.APIVERSION | strings.ToLower }}.{{ .Env.KIND }}) if !ok { return nil, errors.New(errNot{{ .Env.KIND }}) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) - } + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() - cd := pc.Spec.Credentials + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) + } data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) @@ -155,7 +176,7 @@ type external struct { } func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.ExternalObservation, error) { - cr, ok := mg.(*v1alpha1.{{ .Env.KIND }}) + cr, ok := mg.(*{{ .Env.APIVERSION | strings.ToLower }}.{{ .Env.KIND }}) if !ok { return managed.ExternalObservation{}, errors.New(errNot{{ .Env.KIND }}) } @@ -181,7 +202,7 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex } func (c *external) Create(ctx context.Context, mg resource.Managed) (managed.ExternalCreation, error) { - cr, ok := mg.(*v1alpha1.{{ .Env.KIND }}) + cr, ok := mg.(*{{ .Env.APIVERSION | strings.ToLower }}.{{ .Env.KIND }}) if !ok { return managed.ExternalCreation{}, errors.New(errNot{{ .Env.KIND }}) } @@ -196,7 +217,7 @@ func (c *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext } func (c *external) Update(ctx context.Context, mg resource.Managed) (managed.ExternalUpdate, error) { - cr, ok := mg.(*v1alpha1.{{ .Env.KIND }}) + cr, ok := mg.(*{{ .Env.APIVERSION | strings.ToLower }}.{{ .Env.KIND }}) if !ok { return managed.ExternalUpdate{}, errors.New(errNot{{ .Env.KIND }}) } @@ -211,7 +232,7 @@ func (c *external) Update(ctx context.Context, mg resource.Managed) (managed.Ext } func (c *external) Delete(ctx context.Context, mg resource.Managed) (managed.ExternalDelete, error) { - cr, ok := mg.(*v1alpha1.{{ .Env.KIND }}) + cr, ok := mg.(*{{ .Env.APIVERSION | strings.ToLower }}.{{ .Env.KIND }}) if !ok { return managed.ExternalDelete{}, errors.New(errNot{{ .Env.KIND }}) } diff --git a/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl b/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl index d137228..283b1ae 100644 --- a/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl +++ b/hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl @@ -22,9 +22,9 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" ) // Unlike many Kubernetes projects Crossplane does not use third party testing diff --git a/helm/rabbitmq/Chart.yaml b/helm/rabbitmq/Chart.yaml index 4d2bbf9..a47a2ba 100644 --- a/helm/rabbitmq/Chart.yaml +++ b/helm/rabbitmq/Chart.yaml @@ -4,5 +4,5 @@ version: 1.0.0 dependencies: - name: rabbitmq - version: 15.4.0 - repository: oci://registry-1.docker.io/bitnamicharts + version: 0.5.1 + repository: oci://ghcr.io/solidcharts/helm-charts # https://github.com/solidcharts/helm-charts/blob/main/charts diff --git a/internal/controller/binding/binding.go b/internal/controller/binding/binding.go index 526ef68..16509cd 100644 --- a/internal/controller/binding/binding.go +++ b/internal/controller/binding/binding.go @@ -21,23 +21,23 @@ import ( "net/url" "strings" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pkg/errors" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" @@ -48,6 +48,7 @@ const ( errNotBinding = "managed resource is not a Binding custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errNewClient = "cannot create new Service" errGetFailed = "cannot get RabbitMq Binding" @@ -57,18 +58,21 @@ const ( propertiesKeyExpectedPartsCounter = 5 ) +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup Binding controller")) + } + }, v1alpha1.BindingGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles Binding managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.BindingGroupKind) - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.BindingGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -76,7 +80,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.BindingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.Binding") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.BindingGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -90,7 +117,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -106,16 +133,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotBinding) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/binding/binding_test.go b/internal/controller/binding/binding_test.go index a149556..3f3f646 100644 --- a/internal/controller/binding/binding_test.go +++ b/internal/controller/binding/binding_test.go @@ -23,11 +23,13 @@ import ( "net/http" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" pkgErrors "github.com/pkg/errors" @@ -56,7 +58,7 @@ func TestConnect(t *testing.T) { ) type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) } @@ -90,11 +92,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -102,9 +100,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Binding{ Spec: v1alpha1.BindingSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -128,11 +127,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -140,9 +135,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Binding{ Spec: v1alpha1.BindingSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -167,11 +163,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -179,9 +171,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Binding{ Spec: v1alpha1.BindingSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -208,11 +201,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, errors.New("Error in RabbitmqService NewClient") }, @@ -220,9 +209,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Binding{ Spec: v1alpha1.BindingSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -230,47 +220,6 @@ func TestConnect(t *testing.T) { }, want: pkgErrors.Wrap(errors.New("Error in RabbitmqService NewClient"), "cannot create new Service"), }, - "Error in Track": { - reason: "Error should be returned.", - fields: fields{ - kube: &test.MockClient{ - MockGet: func(ctx context.Context, key client.ObjectKey, obj client.Object) error { - switch o := obj.(type) { - case *apisv1alpha1.ProviderConfig: - o.Spec.Credentials.Source = credentialsSource - o.Spec.Credentials.SecretRef = &xpv1.SecretKeySelector{ - Key: "creds", - } - case *corev1.Secret: - o.Data = map[string][]byte{ - "creds": []byte("{\"APIKey\":\"foo\",\"Email\":\"foo@bar.com\"}"), - } - } - return nil - }, - }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return errors.New("Error in Track") - }, - }, - newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { - return &rabbitmqclient.RabbitMqService{}, errors.New("Error in RabbitmqService NewClient") - }, - }, - args: args{ - mg: &v1alpha1.Binding{ - Spec: v1alpha1.BindingSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "testing-provider-config", - }, - }, - }, - }, - }, - want: pkgErrors.Wrap(errors.New("Error in Track"), "cannot track ProviderConfig usage"), - }, "Binding No found error ": { reason: "We should return error", fields: fields{ @@ -290,11 +239,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&test.MockClient{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, diff --git a/internal/controller/config/config.go b/internal/controller/config/config.go index bfab079..adb6cb5 100644 --- a/internal/controller/config/config.go +++ b/internal/controller/config/config.go @@ -17,11 +17,11 @@ limitations under the License. package config import ( - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/providerconfig" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/providerconfig" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" ctrl "sigs.k8s.io/controller-runtime" "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" @@ -30,10 +30,18 @@ import ( // Setup adds a controller that reconciles ProviderConfigs by accounting for // their current usage. func Setup(mgr ctrl.Manager, o controller.Options) error { + if err := setupNamespacedProviderConfig(mgr, o); err != nil { + return err + } + return setupClusterProviderConfig(mgr, o) +} + +func setupNamespacedProviderConfig(mgr ctrl.Manager, o controller.Options) error { name := providerconfig.ControllerName(v1alpha1.ProviderConfigGroupKind) of := resource.ProviderConfigKinds{ Config: v1alpha1.ProviderConfigGroupVersionKind, + Usage: v1alpha1.ProviderConfigUsageGroupVersionKind, UsageList: v1alpha1.ProviderConfigUsageListGroupVersionKind, } @@ -48,3 +56,23 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { Watches(&v1alpha1.ProviderConfigUsage{}, &resource.EnqueueRequestForProviderConfig{}). Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) } + +func setupClusterProviderConfig(mgr ctrl.Manager, o controller.Options) error { + name := providerconfig.ControllerName(v1alpha1.ClusterProviderConfigGroupKind) + of := resource.ProviderConfigKinds{ + Config: v1alpha1.ClusterProviderConfigGroupVersionKind, + Usage: v1alpha1.ClusterProviderConfigUsageGroupVersionKind, + UsageList: v1alpha1.ClusterProviderConfigUsageListGroupVersionKind, + } + + r := providerconfig.NewReconciler(mgr, of, + providerconfig.WithLogger(o.Logger.WithValues("controller", name)), + providerconfig.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name)))) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1alpha1.ClusterProviderConfig{}). + Watches(&v1alpha1.ClusterProviderConfigUsage{}, &resource.EnqueueRequestForProviderConfig{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/exchange/exchange.go b/internal/controller/exchange/exchange.go index 4223fe3..6abf8bb 100644 --- a/internal/controller/exchange/exchange.go +++ b/internal/controller/exchange/exchange.go @@ -19,9 +19,11 @@ package exchange import ( "context" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pkg/errors" @@ -30,23 +32,22 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" ) const ( errNotExchange = "managed resource is not a Exchange custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errGetFailed = "cannot get RabbitMq Exchange" errNewClient = "cannot create new Service" @@ -56,18 +57,21 @@ const ( exchangeDefaultType = "fanout" ) +// SetupGated adds a controller that reconciles MyType managed resources with safe-start support. +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup Exchange controller")) + } + }, v1alpha1.ExchangeGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles Exchange managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.ExchangeGroupKind) - - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.ExchangeGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -75,7 +79,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.ExchangeList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.ExchangeList") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.ExchangeGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -89,7 +116,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -105,16 +132,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotExchange) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/exchange/exchange_test.go b/internal/controller/exchange/exchange_test.go index 3b72644..474d3a1 100644 --- a/internal/controller/exchange/exchange_test.go +++ b/internal/controller/exchange/exchange_test.go @@ -21,28 +21,30 @@ import ( "errors" "testing" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "net/http" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" pkgErrors "github.com/pkg/errors" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient/fake" corev1 "k8s.io/api/core/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) // Unlike many Kubernetes projects Crossplane does not use third party testing @@ -60,7 +62,7 @@ func TestConnect(t *testing.T) { ) type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) } @@ -94,11 +96,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -106,9 +104,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Exchange{ Spec: v1alpha1.ExchangeSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -132,11 +131,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -144,9 +139,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Exchange{ Spec: v1alpha1.ExchangeSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -171,11 +167,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -183,9 +175,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Exchange{ Spec: v1alpha1.ExchangeSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -212,11 +205,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, errors.New("error in RabbitmqService NewClient") }, @@ -224,9 +213,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Exchange{ Spec: v1alpha1.ExchangeSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -234,47 +224,6 @@ func TestConnect(t *testing.T) { }, want: pkgErrors.Wrap(errors.New("error in RabbitmqService NewClient"), "cannot create new Service"), }, - "Error in Track": { - reason: "Error should be returned.", - fields: fields{ - kube: &test.MockClient{ - MockGet: func(ctx context.Context, key client.ObjectKey, obj client.Object) error { - switch o := obj.(type) { - case *apisv1alpha1.ProviderConfig: - o.Spec.Credentials.Source = "Secret" - o.Spec.Credentials.SecretRef = &xpv1.SecretKeySelector{ - Key: "creds", - } - case *corev1.Secret: - o.Data = map[string][]byte{ - "creds": []byte("{\"APIKey\":\"foo\",\"Email\":\"foo@bar.com\"}"), - } - } - return nil - }, - }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return errors.New("error in Track") - }, - }, - newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { - return &rabbitmqclient.RabbitMqService{}, errors.New("error in RabbitmqService NewClient") - }, - }, - args: args{ - mg: &v1alpha1.Exchange{ - Spec: v1alpha1.ExchangeSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "testing-provider-config", - }, - }, - }, - }, - }, - want: pkgErrors.Wrap(errors.New("error in Track"), "cannot track ProviderConfig usage"), - }, "Resource No found error ": { reason: "We should return error", fields: fields{ @@ -294,11 +243,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, diff --git a/internal/controller/permissions/permissions.go b/internal/controller/permissions/permissions.go index cecf5e9..99b9452 100644 --- a/internal/controller/permissions/permissions.go +++ b/internal/controller/permissions/permissions.go @@ -19,11 +19,13 @@ package permissions import ( "context" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" @@ -33,21 +35,20 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" ) const ( errNotPermissions = "managed resource is not a Permissions custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errGetFailed = "cannot get RabbitMq User Permissions" errNewClient = "cannot create new Service" @@ -56,18 +57,21 @@ const ( errUpdateFailed = "cannot update User Permissions" ) +// SetupGated adds a controller that reconciles Permissions managed resources with safe-start support. +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup Permissions controller")) + } + }, v1alpha1.PermissionsGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles Permissions managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.PermissionsGroupKind) - - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.PermissionsGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -75,7 +79,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.PermissionsList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.Permissions") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.PermissionsGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -89,7 +116,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -107,16 +134,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotPermissions) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/permissions/permissions_test.go b/internal/controller/permissions/permissions_test.go index 4de6b47..a18eafc 100644 --- a/internal/controller/permissions/permissions_test.go +++ b/internal/controller/permissions/permissions_test.go @@ -21,6 +21,8 @@ import ( "errors" "testing" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,11 +32,11 @@ import ( pkgErrors "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" @@ -58,7 +60,7 @@ func TestConnect(t *testing.T) { ) type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -93,11 +95,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -106,9 +104,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Permissions{ Spec: v1alpha1.PermissionsSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -132,11 +131,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -145,9 +140,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Permissions{ Spec: v1alpha1.PermissionsSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -172,11 +168,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -185,9 +177,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Permissions{ Spec: v1alpha1.PermissionsSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -214,11 +207,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, errors.New("Error in RabbitmqService NewClient") }, @@ -227,9 +216,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Permissions{ Spec: v1alpha1.PermissionsSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -237,48 +227,6 @@ func TestConnect(t *testing.T) { }, want: pkgErrors.Wrap(errors.New("Error in RabbitmqService NewClient"), "cannot create new Service"), }, - "Error in Track": { - reason: "Error should be returned.", - fields: fields{ - kube: &test.MockClient{ - MockGet: func(ctx context.Context, key client.ObjectKey, obj client.Object) error { - switch o := obj.(type) { - case *apisv1alpha1.ProviderConfig: - o.Spec.Credentials.Source = "Secret" - o.Spec.Credentials.SecretRef = &xpv1.SecretKeySelector{ - Key: "creds", - } - case *corev1.Secret: - o.Data = map[string][]byte{ - "creds": []byte("{\"APIKey\":\"foo\",\"Email\":\"foo@bar.com\"}"), - } - } - return nil - }, - }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return errors.New("Error in Track") - }, - }, - newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { - return &rabbitmqclient.RabbitMqService{}, errors.New("Error in RabbitmqService NewClient") - }, - logger: &fake.MockLog{}, - }, - args: args{ - mg: &v1alpha1.Permissions{ - Spec: v1alpha1.PermissionsSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "testing-provider-config", - }, - }, - }, - }, - }, - want: pkgErrors.Wrap(errors.New("Error in Track"), "cannot track ProviderConfig usage"), - }, "Resource No found error ": { reason: "We should return error", fields: fields{ @@ -298,11 +246,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, diff --git a/internal/controller/queue/queue.go b/internal/controller/queue/queue.go index 8c21ca1..bba602e 100644 --- a/internal/controller/queue/queue.go +++ b/internal/controller/queue/queue.go @@ -19,11 +19,13 @@ package queue import ( "context" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" @@ -33,16 +35,14 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" ) const ( @@ -53,23 +53,27 @@ const ( errUpdateFailed = "cannot update RabbitMq queue" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errNewClient = "cannot create new Service" ) +// SetupGated adds a controller that reconciles Queue managed resources with safe-start support. +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup Queue controller")) + } + }, v1alpha1.QueueGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles Queue managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.QueueGroupKind) - - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.QueueGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -77,7 +81,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.QueueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.Queue") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.QueueGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -91,7 +118,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -107,16 +134,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotQueue) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/queue/queue_test.go b/internal/controller/queue/queue_test.go index 194f4f4..6f68c8a 100644 --- a/internal/controller/queue/queue_test.go +++ b/internal/controller/queue/queue_test.go @@ -21,13 +21,15 @@ import ( "net/http" "testing" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" corev1 "k8s.io/api/core/v1" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pkg/errors" @@ -696,7 +698,7 @@ func TestConnect(t *testing.T) { type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -728,38 +730,22 @@ func TestConnect(t *testing.T) { err: errors.New(errNotQueue), }, }, - "ErrTrackProviderConfigUsage": { - reason: "Should return error if we can't track ProviderConfig usage", - fields: fields{ - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return errBoom }, - }, - logger: &fake.MockLog{}, - }, - args: args{ - mg: &v1alpha1.Queue{}, - }, - want: want{ - err: errors.Wrap(errBoom, errTrackPCUsage), - }, - }, "ErrGetProviderConfig": { reason: "Should return error if we can't get ProviderConfig", fields: fields{ kube: &test.MockClient{ MockGet: test.NewMockGetFn(errBoom), }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return nil }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), logger: &fake.MockLog{}, }, args: args{ mg: &v1alpha1.Queue{ Spec: v1alpha1.QueueSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "test", + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ + Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -790,9 +776,7 @@ func TestConnect(t *testing.T) { return nil }), }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return nil }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -801,9 +785,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Queue{ Spec: v1alpha1.QueueSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "test", + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ + Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, diff --git a/internal/controller/rabbitmq.go b/internal/controller/register.go similarity index 78% rename from internal/controller/rabbitmq.go rename to internal/controller/register.go index 0575a30..67963c3 100644 --- a/internal/controller/rabbitmq.go +++ b/internal/controller/register.go @@ -17,7 +17,7 @@ limitations under the License. package controller import ( - "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" "github.com/pnowy/provider-rabbitmq/internal/controller/binding" "github.com/pnowy/provider-rabbitmq/internal/controller/exchange" "github.com/pnowy/provider-rabbitmq/internal/controller/permissions" @@ -29,17 +29,17 @@ import ( "github.com/pnowy/provider-rabbitmq/internal/controller/vhost" ) -// Setup creates all RabbitMq controllers with the supplied logger and adds them to +// SetupGated Setup creates all RabbitMq controllers with the supplied logger and adds them to // the supplied manager. -func Setup(mgr ctrl.Manager, o controller.Options) error { +func SetupGated(mgr ctrl.Manager, o controller.Options) error { for _, setup := range []func(ctrl.Manager, controller.Options) error{ config.Setup, - vhost.Setup, - user.Setup, - exchange.Setup, - queue.Setup, - binding.Setup, - permissions.Setup, + vhost.SetupGated, + user.SetupGated, + exchange.SetupGated, + queue.SetupGated, + binding.SetupGated, + permissions.SetupGated, } { if err := setup(mgr, o); err != nil { return err diff --git a/internal/controller/user/user.go b/internal/controller/user/user.go index b1a565d..aca7aad 100644 --- a/internal/controller/user/user.go +++ b/internal/controller/user/user.go @@ -24,11 +24,13 @@ import ( "encoding/base64" "net/http" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" @@ -39,16 +41,14 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" ) @@ -57,6 +57,7 @@ const ( errGetFailed = "cannot get RabbitMq User" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errCreateFailed = "cannot create RabbitMq user" errUpdateFailed = "cannot update RabbitMq user" @@ -65,18 +66,21 @@ const ( errNewClient = "cannot create new Service" ) +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup User controller")) + } + }, v1alpha1.UserGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles User managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.UserGroupKind) - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.UserGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -84,7 +88,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.UserList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.UserList") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.UserGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -98,7 +125,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -114,16 +141,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotUser) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/user/user_test.go b/internal/controller/user/user_test.go index 5c56e26..1d3570b 100644 --- a/internal/controller/user/user_test.go +++ b/internal/controller/user/user_test.go @@ -21,13 +21,15 @@ import ( "net/http" "testing" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pkg/errors" @@ -1054,7 +1056,7 @@ func TestConnect(t *testing.T) { type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -1086,38 +1088,22 @@ func TestConnect(t *testing.T) { err: errors.New(errNotUser), }, }, - "ErrTrackProviderConfigUsage": { - reason: "Should return error if we can't track ProviderConfig usage", - fields: fields{ - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return errBoom }, - }, - logger: &fake.MockLog{}, - }, - args: args{ - mg: &v1alpha1.User{}, - }, - want: want{ - err: errors.Wrap(errBoom, errTrackPCUsage), - }, - }, "ErrGetProviderConfig": { reason: "Should return error if we can't get ProviderConfig", fields: fields{ kube: &test.MockClient{ MockGet: test.NewMockGetFn(errBoom), }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return nil }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), logger: &fake.MockLog{}, }, args: args{ mg: &v1alpha1.User{ Spec: v1alpha1.UserSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "test", + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ + Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -1148,9 +1134,7 @@ func TestConnect(t *testing.T) { return nil }), }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { return nil }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -1159,9 +1143,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.User{ Spec: v1alpha1.UserSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "test", + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ + Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, diff --git a/internal/controller/vhost/vhost.go b/internal/controller/vhost/vhost.go index 704b347..63bd162 100644 --- a/internal/controller/vhost/vhost.go +++ b/internal/controller/vhost/vhost.go @@ -19,9 +19,9 @@ package vhost import ( "context" - "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" rabbithole "github.com/michaelklishin/rabbit-hole/v3" @@ -31,16 +31,16 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/crossplane/crossplane-runtime/pkg/connection" - "github.com/crossplane/crossplane-runtime/pkg/controller" - "github.com/crossplane/crossplane-runtime/pkg/event" - "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/controller" + "github.com/crossplane/crossplane-runtime/v2/pkg/event" + "github.com/crossplane/crossplane-runtime/v2/pkg/feature" + "github.com/crossplane/crossplane-runtime/v2/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - "github.com/pnowy/provider-rabbitmq/internal/features" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" ) @@ -52,23 +52,27 @@ const ( errDeleteFailed = "cannot delete RabbitMq vhost" errTrackPCUsage = "cannot track ProviderConfig usage" errGetPC = "cannot get ProviderConfig" + errGetCPC = "cannot get ClusterProviderConfig" errGetCreds = "cannot get credentials" errNewClient = "cannot create new Service" ) +// SetupGated adds a controller that reconciles MyType managed resources with safe-start support. +func SetupGated(mgr ctrl.Manager, o controller.Options) error { + o.Gate.Register(func() { + if err := Setup(mgr, o); err != nil { + panic(errors.Wrap(err, "cannot setup VHost controller")) + } + }, v1alpha1.VhostGroupVersionKind) + return nil +} + // Setup adds a controller that reconciles Vhost managed resources. func Setup(mgr ctrl.Manager, o controller.Options) error { name := managed.ControllerName(v1alpha1.VhostGroupKind) - - cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} - if o.Features.Enabled(features.EnableAlphaExternalSecretStores) { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), apisv1alpha1.StoreConfigGroupVersionKind)) - } - - r := managed.NewReconciler(mgr, - resource.ManagedKind(v1alpha1.VhostGroupVersionKind), - managed.WithExternalConnecter(&connector{ + opts := []managed.ReconcilerOption{ + managed.WithExternalConnector(&connector{ kube: mgr.GetClient(), usage: resource.NewProviderConfigUsageTracker(mgr.GetClient(), &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: rabbitmqclient.NewClient, @@ -76,7 +80,30 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithPollInterval(o.PollInterval), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithConnectionPublishers(cps...)) + } + + if o.Features.Enabled(feature.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + + if o.Features.Enabled(feature.EnableAlphaChangeLogs) { + opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) + } + + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.VhostList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.MyTypeList") + } + } + + r := managed.NewReconciler(mgr, resource.ManagedKind(v1alpha1.VhostGroupVersionKind), opts...) return ctrl.NewControllerManagedBy(mgr). Named(name). @@ -90,7 +117,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { // is called. type connector struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) logger logging.Logger } @@ -106,16 +133,33 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E return nil, errors.New(errNotVhost) } - if err := c.usage.Track(ctx, mg); err != nil { + if err := c.usage.Track(ctx, cr); err != nil { return nil, errors.Wrap(err, errTrackPCUsage) } - pc := &apisv1alpha1.ProviderConfig{} - if err := c.kube.Get(ctx, types.NamespacedName{Name: cr.GetProviderConfigReference().Name}, pc); err != nil { - return nil, errors.Wrap(err, errGetPC) + var cd apisv1alpha1.ProviderCredentials + + // Switch to ModernManaged resource to get ProviderConfigRef + m := mg.(resource.ModernManaged) + ref := m.GetProviderConfigReference() + + switch ref.Kind { + case "ProviderConfig": + pc := &apisv1alpha1.ProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name, Namespace: m.GetNamespace()}, pc); err != nil { + return nil, errors.Wrap(err, errGetPC) + } + cd = pc.Spec.Credentials + case "ClusterProviderConfig": + cpc := &apisv1alpha1.ClusterProviderConfig{} + if err := c.kube.Get(ctx, types.NamespacedName{Name: ref.Name}, cpc); err != nil { + return nil, errors.Wrap(err, errGetCPC) + } + cd = cpc.Spec.Credentials + default: + return nil, errors.Errorf("unsupported provider config kind: %s", ref.Kind) } - cd := pc.Spec.Credentials data, err := resource.CommonCredentialExtractor(ctx, cd.Source, c.kube, cd.CommonCredentialSelectors) if err != nil { return nil, errors.Wrap(err, errGetCreds) diff --git a/internal/controller/vhost/vhost_test.go b/internal/controller/vhost/vhost_test.go index d616bac..fcd78ef 100644 --- a/internal/controller/vhost/vhost_test.go +++ b/internal/controller/vhost/vhost_test.go @@ -21,31 +21,30 @@ import ( "net/http" "testing" - apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" - corev1 "k8s.io/api/core/v1" - - xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - "github.com/crossplane/crossplane-runtime/pkg/logging" - "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" - "github.com/crossplane/crossplane-runtime/pkg/resource" - "github.com/crossplane/crossplane-runtime/pkg/test" + "github.com/crossplane/crossplane-runtime/v2/apis/common" + xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" + xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" + "github.com/crossplane/crossplane-runtime/v2/pkg/logging" + "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/v2/pkg/resource" + "github.com/crossplane/crossplane-runtime/v2/pkg/test" "github.com/google/go-cmp/cmp" rabbithole "github.com/michaelklishin/rabbit-hole/v3" "github.com/pkg/errors" "github.com/pnowy/provider-rabbitmq/apis/core/v1alpha1" + apisv1alpha1 "github.com/pnowy/provider-rabbitmq/apis/v1alpha1" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqclient/fake" "github.com/pnowy/provider-rabbitmq/internal/rabbitmqmeta" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" ) func TestConnect(t *testing.T) { - // errBoom := errors.New("boom") - type fields struct { kube client.Client - usage resource.Tracker + usage *resource.ProviderConfigUsageTracker newServiceFn func(creds []byte) (*rabbitmqclient.RabbitMqService, error) } @@ -79,11 +78,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -91,9 +86,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Vhost{ Spec: v1alpha1.VhostSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -117,11 +113,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -129,9 +121,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Vhost{ Spec: v1alpha1.VhostSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -156,11 +149,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, nil }, @@ -168,9 +157,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Vhost{ Spec: v1alpha1.VhostSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -197,11 +187,7 @@ func TestConnect(t *testing.T) { return nil }, }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return nil - }, - }, + usage: resource.NewProviderConfigUsageTracker(&fake.MockApplicator{}, &apisv1alpha1.ProviderConfigUsage{}), newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { return &rabbitmqclient.RabbitMqService{}, errors.New("error in RabbitmqService NewClient") }, @@ -209,9 +195,10 @@ func TestConnect(t *testing.T) { args: args{ mg: &v1alpha1.Vhost{ Spec: v1alpha1.VhostSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ + ManagedResourceSpec: xpv2.ManagedResourceSpec{ + ProviderConfigReference: &common.ProviderConfigReference{ Name: "testing-provider-config", + Kind: "ProviderConfig", }, }, }, @@ -219,47 +206,6 @@ func TestConnect(t *testing.T) { }, want: errors.Wrap(errors.New("error in RabbitmqService NewClient"), "cannot create new Service"), }, - "Error in Track": { - reason: "Error should be returned.", - fields: fields{ - kube: &test.MockClient{ - MockGet: func(ctx context.Context, key client.ObjectKey, obj client.Object) error { - switch o := obj.(type) { - case *apisv1alpha1.ProviderConfig: - o.Spec.Credentials.Source = "Secret" - o.Spec.Credentials.SecretRef = &xpv1.SecretKeySelector{ - Key: "creds", - } - case *corev1.Secret: - o.Data = map[string][]byte{ - "creds": []byte("{\"APIKey\":\"foo\",\"Email\":\"foo@bar.com\"}"), - } - } - return nil - }, - }, - usage: &fake.MockTracker{ - MockTrack: func(ctx context.Context, mg resource.Managed) error { - return errors.New("error in Track") - }, - }, - newServiceFn: func(creds []byte) (*rabbitmqclient.RabbitMqService, error) { - return &rabbitmqclient.RabbitMqService{}, errors.New("error in RabbitmqService NewClient") - }, - }, - args: args{ - mg: &v1alpha1.Vhost{ - Spec: v1alpha1.VhostSpec{ - ResourceSpec: xpv1.ResourceSpec{ - ProviderConfigReference: &xpv1.Reference{ - Name: "testing-provider-config", - }, - }, - }, - }, - }, - want: errors.Wrap(errors.New("error in Track"), "cannot track ProviderConfig usage"), - }, } for name, tc := range cases { diff --git a/internal/features/features.go b/internal/features/features.go deleted file mode 100644 index 9e48846..0000000 --- a/internal/features/features.go +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright 2022 The Crossplane Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package features - -import "github.com/crossplane/crossplane-runtime/pkg/feature" - -// Feature flags. -const ( - // EnableAlphaExternalSecretStores enables alpha support for - // External Secret Stores. See the below design for more details. - // https://github.com/crossplane/crossplane/blob/390ddd/design/design-doc-external-secret-stores.md - EnableAlphaExternalSecretStores feature.Flag = "EnableAlphaExternalSecretStores" - - // EnableAlphaManagementPolicies enables alpha support for - // Management Policies. See the below design for more details. - // https://github.com/crossplane/crossplane/blob/master/design/design-doc-observe-only-resources.md - EnableAlphaManagementPolicies feature.Flag = "EnableAlphaManagementPolicies" -) diff --git a/internal/rabbitmqclient/fake/fake_log.go b/internal/rabbitmqclient/fake/fake_log.go index 77cc747..9e9f7df 100644 --- a/internal/rabbitmqclient/fake/fake_log.go +++ b/internal/rabbitmqclient/fake/fake_log.go @@ -1,7 +1,7 @@ package fake import ( - logging "github.com/crossplane/crossplane-runtime/pkg/logging" + logging "github.com/crossplane/crossplane-runtime/v2/pkg/logging" ) type MockLog struct { diff --git a/internal/rabbitmqclient/fake/fake_tracker.go b/internal/rabbitmqclient/fake/fake_tracker.go index db7b170..19d019a 100644 --- a/internal/rabbitmqclient/fake/fake_tracker.go +++ b/internal/rabbitmqclient/fake/fake_tracker.go @@ -3,13 +3,67 @@ package fake import ( "context" - "github.com/crossplane/crossplane-runtime/pkg/resource" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/client" ) -type MockTracker struct { - MockTrack func(ctx context.Context, mg resource.Managed) error +type MockApplicator struct { } -func (fn MockTracker) Track(ctx context.Context, mg resource.Managed) error { - return fn.MockTrack(ctx, mg) +func (m MockApplicator) Get(_ context.Context, _ client.ObjectKey, _ client.Object, _ ...client.GetOption) error { + return nil +} + +func (m MockApplicator) List(_ context.Context, _ client.ObjectList, _ ...client.ListOption) error { + return nil +} + +func (m MockApplicator) Apply(_ context.Context, _ runtime.ApplyConfiguration, _ ...client.ApplyOption) error { + return nil +} + +func (m MockApplicator) Create(_ context.Context, _ client.Object, _ ...client.CreateOption) error { + return nil +} + +func (m MockApplicator) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error { + return nil +} + +func (m MockApplicator) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error { + return nil +} + +func (m MockApplicator) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.PatchOption) error { + return nil +} + +func (m MockApplicator) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error { + return nil +} + +func (m MockApplicator) Status() client.SubResourceWriter { + return nil +} + +func (m MockApplicator) SubResource(_ string) client.SubResourceClient { + return nil +} + +func (m MockApplicator) Scheme() *runtime.Scheme { + return nil +} + +func (m MockApplicator) RESTMapper() meta.RESTMapper { + return nil +} + +func (m MockApplicator) GroupVersionKindFor(_ runtime.Object) (schema.GroupVersionKind, error) { + return schema.GroupVersionKind{}, nil +} + +func (m MockApplicator) IsObjectNamespaced(_ runtime.Object) (bool, error) { + return true, nil } diff --git a/internal/rabbitmqmeta/rabbitmq_meta.go b/internal/rabbitmqmeta/rabbitmq_meta.go index c7fb141..6867ccf 100644 --- a/internal/rabbitmqmeta/rabbitmq_meta.go +++ b/internal/rabbitmqmeta/rabbitmq_meta.go @@ -3,7 +3,7 @@ package rabbitmqmeta import ( "fmt" - "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/v2/pkg/meta" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/package/crds/core.rabbitmq.crossplane.io_bindings.yaml b/package/crds/core.rabbitmq.m.crossplane.io_bindings.yaml similarity index 58% rename from package/crds/core.rabbitmq.crossplane.io_bindings.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_bindings.yaml index 9076e81..e5b3b78 100644 --- a/package/crds/core.rabbitmq.crossplane.io_bindings.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_bindings.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: bindings.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: bindings.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: BindingList plural: bindings singular: binding - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A BindingSpec defines the desired state of a Binding. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: BindingParameters are the configurable fields of a Binding. properties: @@ -116,10 +102,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -137,118 +119,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -257,20 +142,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/core.rabbitmq.crossplane.io_exchanges.yaml b/package/crds/core.rabbitmq.m.crossplane.io_exchanges.yaml similarity index 57% rename from package/crds/core.rabbitmq.crossplane.io_exchanges.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_exchanges.yaml index 6f7c723..9f94f0e 100644 --- a/package/crds/core.rabbitmq.crossplane.io_exchanges.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_exchanges.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: exchanges.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: exchanges.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: ExchangeList plural: exchanges singular: exchange - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A ExchangeSpec defines the desired state of a Exchange. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: ExchangeParameters are the configurable fields of a Exchange. properties: @@ -116,10 +102,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -137,118 +119,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -257,20 +142,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/core.rabbitmq.crossplane.io_permissions.yaml b/package/crds/core.rabbitmq.m.crossplane.io_permissions.yaml similarity index 55% rename from package/crds/core.rabbitmq.crossplane.io_permissions.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_permissions.yaml index 49966a2..38cd1dd 100644 --- a/package/crds/core.rabbitmq.crossplane.io_permissions.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_permissions.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: permissions.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: permissions.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: PermissionsList plural: permissions singular: permissions - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A PermissionsSpec defines the desired state of a Permissions. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: PermissionsParameters are the configurable fields of a Permissions. @@ -109,10 +95,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -130,118 +112,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -250,20 +135,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/core.rabbitmq.crossplane.io_queues.yaml b/package/crds/core.rabbitmq.m.crossplane.io_queues.yaml similarity index 57% rename from package/crds/core.rabbitmq.crossplane.io_queues.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_queues.yaml index bef99a2..14d869d 100644 --- a/package/crds/core.rabbitmq.crossplane.io_queues.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_queues.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: queues.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: queues.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: QueueList plural: queues singular: queue - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A QueueSpec defines the desired state of a Queue. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: QueueParameters are the configurable fields of a Queue. properties: @@ -116,10 +102,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -137,118 +119,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -257,20 +142,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/core.rabbitmq.crossplane.io_users.yaml b/package/crds/core.rabbitmq.m.crossplane.io_users.yaml similarity index 56% rename from package/crds/core.rabbitmq.crossplane.io_users.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_users.yaml index 2132cb7..136715d 100644 --- a/package/crds/core.rabbitmq.crossplane.io_users.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_users.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: users.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: users.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: UserList plural: users singular: user - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A UserSpec defines the desired state of a User. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: UserParameters are the configurable fields of a User. properties: @@ -114,10 +100,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -135,118 +117,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -255,20 +140,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/core.rabbitmq.crossplane.io_vhosts.yaml b/package/crds/core.rabbitmq.m.crossplane.io_vhosts.yaml similarity index 56% rename from package/crds/core.rabbitmq.crossplane.io_vhosts.yaml rename to package/crds/core.rabbitmq.m.crossplane.io_vhosts.yaml index 7e4171f..c9aba5f 100644 --- a/package/crds/core.rabbitmq.crossplane.io_vhosts.yaml +++ b/package/crds/core.rabbitmq.m.crossplane.io_vhosts.yaml @@ -3,10 +3,10 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: vhosts.core.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: vhosts.core.rabbitmq.m.crossplane.io spec: - group: core.rabbitmq.crossplane.io + group: core.rabbitmq.m.crossplane.io names: categories: - crossplane @@ -16,7 +16,7 @@ spec: listKind: VhostList plural: vhosts singular: vhost - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status @@ -56,20 +56,6 @@ spec: spec: description: A VhostSpec defines the desired state of a Vhost. properties: - deletionPolicy: - default: Delete - description: |- - DeletionPolicy specifies what will happen to the underlying external - when this managed resource is deleted - either "Delete" or "Orphan" the - external resource. - This field is planned to be deprecated in favor of the ManagementPolicies - field in a future release. Currently, both could be set independently and - non-default values would be honored if the feature flag is enabled. - See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 - enum: - - Orphan - - Delete - type: string forProvider: description: VhostParameters are the configurable fields of a Vhost properties: @@ -105,10 +91,6 @@ spec: through a Crossplane feature flag. ManagementPolicies specify the array of actions Crossplane is allowed to take on the managed and external resources. - This field is planned to replace the DeletionPolicy field in a future - release. Currently, both could be set independently and non-default - values would be honored if the feature flag is enabled. If both are - custom, the DeletionPolicy field will be ignored. See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md items: @@ -126,118 +108,21 @@ spec: type: array providerConfigRef: default: + kind: ClusterProviderConfig name: default description: |- ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. properties: - name: - description: Name of the referenced object. + kind: + description: Kind of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - publishConnectionDetailsTo: - description: |- - PublishConnectionDetailsTo specifies the connection secret config which - contains a name, metadata and a reference to secret store config to - which any connection details for this managed resource should be written. - Connection details frequently include the endpoint, username, - and password required to connect to the managed resource. - properties: - configRef: - default: - name: default - description: |- - SecretStoreConfigRef specifies which secret store config should be used - for this ConnectionSecret. - properties: - name: - description: Name of the referenced object. - type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object - required: - - name - type: object - metadata: - description: Metadata is the metadata for connection secret. - properties: - annotations: - additionalProperties: - type: string - description: |- - Annotations are the annotations to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.annotations". - - It is up to Secret Store implementation for others store types. - type: object - labels: - additionalProperties: - type: string - description: |- - Labels are the labels/tags to be added to connection secret. - - For Kubernetes secrets, this will be used as "metadata.labels". - - It is up to Secret Store implementation for others store types. - type: object - type: - description: |- - Type is the SecretType for the connection secret. - - Only valid for Kubernetes Secret Stores. - type: string - type: object name: - description: Name is the name of the connection secret. + description: Name of the referenced object. type: string required: + - kind - name type: object writeConnectionSecretToRef: @@ -246,20 +131,12 @@ spec: Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. - This field is planned to be replaced in a future release in favor of - PublishConnectionDetailsTo. Currently, both could be set independently - and connection details would be published to both without affecting - each other. properties: name: description: Name of the secret. type: string - namespace: - description: Namespace of the secret. - type: string required: - name - - namespace type: object required: - forProvider diff --git a/package/crds/rabbitmq.crossplane.io_storeconfigs.yaml b/package/crds/rabbitmq.crossplane.io_storeconfigs.yaml deleted file mode 100644 index a1913ad..0000000 --- a/package/crds/rabbitmq.crossplane.io_storeconfigs.yaml +++ /dev/null @@ -1,223 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: storeconfigs.rabbitmq.crossplane.io -spec: - group: rabbitmq.crossplane.io - names: - categories: - - crossplane - - store - - gcp - kind: StoreConfig - listKind: StoreConfigList - plural: storeconfigs - singular: storeconfig - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .metadata.creationTimestamp - name: AGE - type: date - - jsonPath: .spec.type - name: TYPE - type: string - - jsonPath: .spec.defaultScope - name: DEFAULT-SCOPE - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: A StoreConfig configures how GCP controller should store connection - details. - 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: A StoreConfigSpec defines the desired state of a ProviderConfig. - properties: - defaultScope: - description: |- - DefaultScope used for scoping secrets for "cluster-scoped" resources. - If store type is "Kubernetes", this would mean the default namespace to - store connection secrets for cluster scoped resources. - In case of "Vault", this would be used as the default parent path. - Typically, should be set as Crossplane installation namespace. - type: string - kubernetes: - description: |- - Kubernetes configures a Kubernetes secret store. - If the "type" is "Kubernetes" but no config provided, in cluster config - will be used. - properties: - auth: - description: Credentials used to connect to the Kubernetes API. - properties: - env: - description: |- - Env is a reference to an environment variable that contains credentials - that must be used to connect to the provider. - properties: - name: - description: Name is the name of an environment variable. - type: string - required: - - name - type: object - fs: - description: |- - Fs is a reference to a filesystem location that contains credentials that - must be used to connect to the provider. - properties: - path: - description: Path is a filesystem path. - type: string - required: - - path - type: object - secretRef: - description: |- - A SecretRef is a reference to a secret key that contains the credentials - that must be used to connect to the provider. - properties: - key: - description: The key to select. - type: string - name: - description: Name of the secret. - type: string - namespace: - description: Namespace of the secret. - type: string - required: - - key - - name - - namespace - type: object - source: - description: Source of the credentials. - enum: - - None - - Secret - - Environment - - Filesystem - type: string - required: - - source - type: object - required: - - auth - type: object - plugin: - description: Plugin configures External secret store as a plugin. - properties: - configRef: - description: ConfigRef contains store config reference info. - properties: - apiVersion: - description: APIVersion of the referenced config. - type: string - kind: - description: Kind of the referenced config. - type: string - name: - description: Name of the referenced config. - type: string - required: - - apiVersion - - kind - - name - type: object - endpoint: - description: Endpoint is the endpoint of the gRPC server. - type: string - type: object - type: - default: Kubernetes - description: |- - Type configures which secret store to be used. Only the configuration - block for this store will be used and others will be ignored if provided. - Default is Kubernetes. - enum: - - Kubernetes - - Vault - - Plugin - type: string - required: - - defaultScope - type: object - status: - description: A StoreConfigStatus represents the status of a StoreConfig. - properties: - conditions: - description: Conditions of the resource. - items: - description: A Condition that may apply to a resource. - properties: - lastTransitionTime: - description: |- - LastTransitionTime is the last time this condition transitioned from one - status to another. - format: date-time - type: string - message: - description: |- - A Message containing details about this condition's last transition from - one status to another, if any. - type: string - observedGeneration: - description: |- - ObservedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - type: integer - reason: - description: A Reason for this condition's last transition from - one status to another. - type: string - status: - description: Status of this condition; is it currently True, - False, or Unknown? - type: string - type: - description: |- - Type of this condition. At most one of each condition type may apply to - a resource at any point in time. - type: string - required: - - lastTransitionTime - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} diff --git a/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigs.yaml b/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigs.yaml new file mode 100644 index 0000000..4d2cdef --- /dev/null +++ b/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigs.yaml @@ -0,0 +1,172 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: clusterproviderconfigs.rabbitmq.m.crossplane.io +spec: + group: rabbitmq.m.crossplane.io + names: + categories: + - crossplane + - provider + - template + kind: ClusterProviderConfig + listKind: ClusterProviderConfigList + plural: clusterproviderconfigs + singular: clusterproviderconfig + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + - jsonPath: .spec.credentials.secretRef.name + name: SECRET-NAME + priority: 1 + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: A ClusterProviderConfig configures a Template provider. + 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: + properties: + credentials: + description: Credentials required to authenticate to this provider. + properties: + env: + description: |- + Env is a reference to an environment variable that contains credentials + that must be used to connect to the provider. + properties: + name: + description: Name is the name of an environment variable. + type: string + required: + - name + type: object + fs: + description: |- + Fs is a reference to a filesystem location that contains credentials that + must be used to connect to the provider. + properties: + path: + description: Path is a filesystem path. + type: string + required: + - path + type: object + secretRef: + description: |- + A SecretRef is a reference to a secret key that contains the credentials + that must be used to connect to the provider. + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object + source: + description: Source of the provider credentials. + enum: + - None + - Secret + - InjectedIdentity + - Environment + - Filesystem + type: string + required: + - source + type: object + required: + - credentials + type: object + status: + description: A ProviderConfigStatus defines the status of a Provider. + properties: + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + users: + description: Users of this provider configuration. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigusages.yaml b/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigusages.yaml new file mode 100644 index 0000000..2da6c22 --- /dev/null +++ b/package/crds/rabbitmq.m.crossplane.io_clusterproviderconfigusages.yaml @@ -0,0 +1,97 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: clusterproviderconfigusages.rabbitmq.m.crossplane.io +spec: + group: rabbitmq.m.crossplane.io + names: + categories: + - crossplane + - provider + - template + kind: ClusterProviderConfigUsage + listKind: ClusterProviderConfigUsageList + plural: clusterproviderconfigusages + singular: clusterproviderconfigusage + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + - jsonPath: .providerConfigRef.name + name: CONFIG-NAME + type: string + - jsonPath: .resourceRef.kind + name: RESOURCE-KIND + type: string + - jsonPath: .resourceRef.name + name: RESOURCE-NAME + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: A ClusterProviderConfigUsage indicates that a resource is using + a ClusterProviderConfig. + 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 + providerConfigRef: + description: ProviderConfigReference to the provider config being used. + properties: + kind: + description: Kind of the referenced object. + type: string + name: + description: Name of the referenced object. + type: string + required: + - kind + - name + type: object + resourceRef: + description: ResourceReference to the managed resource using the provider + config. + properties: + apiVersion: + description: APIVersion of the referenced object. + type: string + kind: + description: Kind of the referenced object. + type: string + name: + description: Name of the referenced object. + type: string + uid: + description: UID of the referenced object. + type: string + required: + - apiVersion + - kind + - name + type: object + required: + - providerConfigRef + - resourceRef + type: object + served: true + storage: true + subresources: {} diff --git a/package/crds/rabbitmq.crossplane.io_providerconfigs.yaml b/package/crds/rabbitmq.m.crossplane.io_providerconfigs.yaml similarity index 93% rename from package/crds/rabbitmq.crossplane.io_providerconfigs.yaml rename to package/crds/rabbitmq.m.crossplane.io_providerconfigs.yaml index 87d3116..13c7ff0 100644 --- a/package/crds/rabbitmq.crossplane.io_providerconfigs.yaml +++ b/package/crds/rabbitmq.m.crossplane.io_providerconfigs.yaml @@ -3,16 +3,20 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: providerconfigs.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: providerconfigs.rabbitmq.m.crossplane.io spec: - group: rabbitmq.crossplane.io + group: rabbitmq.m.crossplane.io names: + categories: + - crossplane + - provider + - template kind: ProviderConfig listKind: ProviderConfigList plural: providerconfigs singular: providerconfig - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .metadata.creationTimestamp @@ -25,7 +29,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: A ProviderConfig configures a RabbitMq provider. + description: A ProviderConfig configures a Helm 'provider', i.e. a connection + to a particular properties: apiVersion: description: |- @@ -45,7 +50,6 @@ spec: metadata: type: object spec: - description: A ProviderConfigSpec defines the desired state of a ProviderConfig. properties: credentials: description: Credentials required to authenticate to this provider. @@ -107,7 +111,7 @@ spec: - credentials type: object status: - description: A ProviderConfigStatus reflects the observed state of a ProviderConfig. + description: A ProviderConfigStatus defines the status of a Provider. properties: conditions: description: Conditions of the resource. diff --git a/package/crds/rabbitmq.crossplane.io_providerconfigusages.yaml b/package/crds/rabbitmq.m.crossplane.io_providerconfigusages.yaml similarity index 67% rename from package/crds/rabbitmq.crossplane.io_providerconfigusages.yaml rename to package/crds/rabbitmq.m.crossplane.io_providerconfigusages.yaml index 50c3cc3..25bdfa1 100644 --- a/package/crds/rabbitmq.crossplane.io_providerconfigusages.yaml +++ b/package/crds/rabbitmq.m.crossplane.io_providerconfigusages.yaml @@ -3,20 +3,20 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.5 - name: providerconfigusages.rabbitmq.crossplane.io + controller-gen.kubebuilder.io/version: v0.19.0 + name: providerconfigusages.rabbitmq.m.crossplane.io spec: - group: rabbitmq.crossplane.io + group: rabbitmq.m.crossplane.io names: categories: - crossplane - provider - - rabbitmq + - template kind: ProviderConfigUsage listKind: ProviderConfigUsageList plural: providerconfigusages singular: providerconfigusage - scope: Cluster + scope: Namespaced versions: - additionalPrinterColumns: - jsonPath: .metadata.creationTimestamp @@ -56,35 +56,14 @@ spec: providerConfigRef: description: ProviderConfigReference to the provider config being used. properties: + kind: + description: Kind of the referenced object. + type: string name: description: Name of the referenced object. type: string - policy: - description: Policies for referencing. - properties: - resolution: - default: Required - description: |- - Resolution specifies whether resolution of this reference is required. - The default is 'Required', which means the reconcile will fail if the - reference cannot be resolved. 'Optional' means this reference will be - a no-op if it cannot be resolved. - enum: - - Required - - Optional - type: string - resolve: - description: |- - Resolve specifies when this reference should be resolved. The default - is 'IfNotPresent', which will attempt to resolve the reference only when - the corresponding field is not present. Use 'Always' to resolve the - reference on every reconcile. - enum: - - Always - - IfNotPresent - type: string - type: object required: + - kind - name type: object resourceRef: diff --git a/package/crossplane.yaml b/package/crossplane.yaml index 3baeef7..f39f4fd 100644 --- a/package/crossplane.yaml +++ b/package/crossplane.yaml @@ -8,3 +8,6 @@ metadata: meta.crossplane.io/license: Apache-2.0 meta.crossplane.io/description: | A Crossplane provider for RabbitMQ management. +spec: + capabilities: + - safe-start \ No newline at end of file