Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remove): remove deprecated providerRef #475

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions apis/common/v1/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ type ResourceSpec struct {
// +kubebuilder:default={"name": "default"}
ProviderConfigReference *Reference `json:"providerConfigRef,omitempty"`

// ProviderReference specifies the provider that will be used to create,
// observe, update, and delete this managed resource.
// Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`
ProviderReference *Reference `json:"providerRef,omitempty"`

// THIS IS AN ALPHA FIELD. Do not use it in production. It is not honored
// unless the relevant Crossplane feature flag is enabled, and may be
// changed or removed without notice.
Expand Down
5 changes: 0 additions & 5 deletions apis/common/v1/zz_generated.deepcopy.go

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

12 changes: 1 addition & 11 deletions pkg/resource/fake/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,8 @@ func (m *ManagedResourceReferencer) SetResourceReference(r *corev1.ObjectReferen
// GetResourceReference gets the ResourceReference.
func (m *ManagedResourceReferencer) GetResourceReference() *corev1.ObjectReference { return m.Ref }

// ProviderReferencer is a mock that implements ProviderReferencer interface.
type ProviderReferencer struct{ Ref *xpv1.Reference } //nolint:musttag // This is a fake implementation to be used in unit tests only.

// SetProviderReference sets the ProviderReference.
func (m *ProviderReferencer) SetProviderReference(p *xpv1.Reference) { m.Ref = p }

// GetProviderReference gets the ProviderReference.
func (m *ProviderReferencer) GetProviderReference() *xpv1.Reference { return m.Ref }

// ProviderConfigReferencer is a mock that implements ProviderConfigReferencer interface.
type ProviderConfigReferencer struct{ Ref *xpv1.Reference }
type ProviderConfigReferencer struct{ Ref *xpv1.Reference } //nolint:musttag // This is a fake implementation to be used in unit tests only.

// SetProviderConfigReference sets the ProviderConfigReference.
func (m *ProviderConfigReferencer) SetProviderConfigReference(p *xpv1.Reference) { m.Ref = p }
Expand Down Expand Up @@ -331,7 +322,6 @@ func (o *Object) DeepCopyObject() runtime.Object {
// Managed is a mock that implements Managed interface.
type Managed struct {
metav1.ObjectMeta
ProviderReferencer
ProviderConfigReferencer
ConnectionSecretWriterTo
ConnectionDetailsPublisherTo
Expand Down
7 changes: 0 additions & 7 deletions pkg/resource/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ type Orphanable interface {
GetDeletionPolicy() xpv1.DeletionPolicy
}

// A ProviderReferencer may reference a provider resource.
type ProviderReferencer interface {
GetProviderReference() *xpv1.Reference
SetProviderReference(p *xpv1.Reference)
}

// A ProviderConfigReferencer may reference a provider config resource.
type ProviderConfigReferencer interface {
GetProviderConfigReference() *xpv1.Reference
Expand Down Expand Up @@ -192,7 +186,6 @@ type Object interface {
type Managed interface {
Object

ProviderReferencer
ProviderConfigReferencer
ConnectionSecretWriterTo
ConnectionDetailsPublisherTo
Expand Down
7 changes: 1 addition & 6 deletions pkg/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,8 @@ func GetExternalTags(mg Managed) map[string]string {
ExternalResourceTagKeyName: mg.GetName(),
}

switch {
case mg.GetProviderConfigReference() != nil && mg.GetProviderConfigReference().Name != "":
if mg.GetProviderConfigReference() != nil && mg.GetProviderConfigReference().Name != "" {
tags[ExternalResourceTagKeyProvider] = mg.GetProviderConfigReference().Name
// TODO(muvaf): Remove the branch once Provider type has been removed from
// everywhere.
case mg.GetProviderReference() != nil && mg.GetProviderReference().Name != "":
tags[ExternalResourceTagKeyProvider] = mg.GetProviderReference().Name
}
return tags
}
12 changes: 0 additions & 12 deletions pkg/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,6 @@ func TestGetExternalTags(t *testing.T) {
o Managed
want map[string]string
}{
"Successful": {
o: &fake.Managed{ObjectMeta: metav1.ObjectMeta{
Name: name,
},
ProviderReferencer: fake.ProviderReferencer{Ref: &xpv1.Reference{Name: provName}},
},
want: map[string]string{
ExternalResourceTagKeyKind: strings.ToLower((&fake.Managed{}).GetObjectKind().GroupVersionKind().GroupKind().String()),
ExternalResourceTagKeyName: name,
ExternalResourceTagKeyProvider: provName,
},
},
"SuccessfulWithProviderConfig": {
o: &fake.Managed{ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand Down
Loading