Skip to content

Commit

Permalink
Merge pull request #56 from negz/runthetimes
Browse files Browse the repository at this point in the history
Bump crossplane-runtime to v0.12.0
  • Loading branch information
negz authored Dec 12, 2020
2 parents c3761e3 + 091537f commit cca235d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 88 deletions.
10 changes: 5 additions & 5 deletions apis/database/v1alpha1/rds_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
)

// SQL database engines.
Expand Down Expand Up @@ -58,14 +58,14 @@ type RDSInstance struct {

// An RDSInstanceSpec defines the desired state of an RDSInstance.
type RDSInstanceSpec struct {
runtimev1alpha1.ResourceSpec `json:",inline"`
ForProvider RDSInstanceParameters `json:"forProvider"`
xpv1.ResourceSpec `json:",inline"`
ForProvider RDSInstanceParameters `json:"forProvider"`
}

// An RDSInstanceStatus represents the observed state of an RDSInstance.
type RDSInstanceStatus struct {
runtimev1alpha1.ResourceStatus `json:",inline"`
AtProvider RDSInstanceObservation `json:"atProvider,omitempty"`
xpv1.ResourceStatus `json:",inline"`
AtProvider RDSInstanceObservation `json:"atProvider,omitempty"`
}

// RDSInstanceParameters define the desired state of an RDS instance.
Expand Down
22 changes: 11 additions & 11 deletions apis/database/v1alpha1/zz_generated.managed.go

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

10 changes: 5 additions & 5 deletions apis/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
)

// A ProviderSpec defines the desired state of a Provider.
type ProviderSpec struct {
runtimev1alpha1.ProviderSpec `json:",inline"`
xpv1.ProviderSpec `json:",inline"`

// Region for managed resources created using this Alibaba Cloud provider,
// e.g. "cn-hangzhou".
Expand Down Expand Up @@ -56,7 +56,7 @@ type ProviderList struct {

// A ProviderConfigSpec defines the desired state of a ProviderConfig.
type ProviderConfigSpec struct {
runtimev1alpha1.ProviderConfigSpec `json:",inline"`
xpv1.ProviderConfigSpec `json:",inline"`

// Region for managed resources created using this Alibaba Cloud provider,
// e.g. "cn-hangzhou".
Expand All @@ -65,7 +65,7 @@ type ProviderConfigSpec struct {

// A ProviderConfigStatus represents the status of a ProviderConfig.
type ProviderConfigStatus struct {
runtimev1alpha1.ProviderConfigStatus `json:",inline"`
xpv1.ProviderConfigStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -105,7 +105,7 @@ type ProviderConfigUsage struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

runtimev1alpha1.ProviderConfigUsage `json:",inline"`
xpv1.ProviderConfigUsage `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/zz_generated.pc.go

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

10 changes: 5 additions & 5 deletions apis/v1alpha1/zz_generated.pcu.go

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

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

require (
github.com/aliyun/alibaba-cloud-sdk-go v1.61.109
github.com/crossplane/crossplane-runtime v0.11.0
github.com/crossplane/crossplane-runtime v0.12.0
github.com/crossplane/crossplane-tools v0.0.0-20201007233256-88b291e145bb
github.com/go-logr/zapr v0.1.1 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/crossplane/crossplane-runtime v0.11.0 h1:hLDWsGYhU/CUVQ1sU7NHF5bnP6WT6wA6Nu2SaBSSe6w=
github.com/crossplane/crossplane-runtime v0.11.0/go.mod h1:cJl5ZZONisre4v6wTmbrC8Jh3AI+erq/lNaxZzv9tnU=
github.com/crossplane/crossplane-runtime v0.12.0 h1:GB1Pq5vVBNStPrfiEJNat56gHCQiuliidgr7pNs/FQA=
github.com/crossplane/crossplane-runtime v0.12.0/go.mod h1:cJl5ZZONisre4v6wTmbrC8Jh3AI+erq/lNaxZzv9tnU=
github.com/crossplane/crossplane-tools v0.0.0-20201007233256-88b291e145bb h1:j09j/Gk1qH64HUtf/fcTjMAxLxUdOuQXySWu46WTVTU=
github.com/crossplane/crossplane-tools v0.0.0-20201007233256-88b291e145bb/go.mod h1:C735A9X0x0lR8iGVOOxb49Mt70Ua4EM2b7PGaRPBLd4=
github.com/dave/jennifer v1.3.0 h1:p3tl41zjjCZTNBytMwrUuiAnherNUZktlhPTKoF/sEk=
Expand Down
26 changes: 13 additions & 13 deletions pkg/controller/database/rdsinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/event"
"github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/meta"
Expand Down Expand Up @@ -93,7 +93,7 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E
// TODO(negz): This connection logic should be generalised once this
// provider has more than one kind of managed resource.
var (
sel *runtimev1alpha1.SecretKeySelector
sel *xpv1.SecretKeySelector
region string
)
switch {
Expand All @@ -106,7 +106,7 @@ func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.E
if err := c.client.Get(ctx, types.NamespacedName{Name: cr.Spec.ProviderConfigReference.Name}, pc); err != nil {
return nil, errors.Wrap(err, errGetProviderConfig)
}
if s := pc.Spec.Credentials.Source; s != runtimev1alpha1.CredentialsSourceSecret {
if s := pc.Spec.Credentials.Source; s != xpv1.CredentialsSourceSecret {
return nil, errors.Errorf(errFmtUnsupportedCredSource, s)
}
sel = pc.Spec.Credentials.SecretRef
Expand Down Expand Up @@ -160,17 +160,17 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex
var pw string
switch cr.Status.AtProvider.DBInstanceStatus {
case v1alpha1.RDSInstanceStateRunning:
cr.Status.SetConditions(runtimev1alpha1.Available())
cr.Status.SetConditions(xpv1.Available())
pw, err = e.createAccountIfNeeded(cr)
if err != nil {
return managed.ExternalObservation{}, errors.Wrap(err, errCreateAccountFailed)
}
case v1alpha1.RDSInstanceStateCreating:
cr.Status.SetConditions(runtimev1alpha1.Creating())
cr.Status.SetConditions(xpv1.Creating())
case v1alpha1.RDSInstanceStateDeleting:
cr.Status.SetConditions(runtimev1alpha1.Deleting())
cr.Status.SetConditions(xpv1.Deleting())
default:
cr.Status.SetConditions(runtimev1alpha1.Unavailable())
cr.Status.SetConditions(xpv1.Unavailable())
}

return managed.ExternalObservation{
Expand Down Expand Up @@ -209,7 +209,7 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext
return managed.ExternalCreation{}, errors.New(errNotRDSInstance)
}

cr.SetConditions(runtimev1alpha1.Creating())
cr.SetConditions(xpv1.Creating())
if cr.Status.AtProvider.DBInstanceStatus == v1alpha1.RDSInstanceStateCreating {
return managed.ExternalCreation{}, nil
}
Expand All @@ -236,7 +236,7 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) error {
if !ok {
return errors.New(errNotRDSInstance)
}
cr.SetConditions(runtimev1alpha1.Deleting())
cr.SetConditions(xpv1.Deleting())
if cr.Status.AtProvider.DBInstanceStatus == v1alpha1.RDSInstanceStateDeleting {
return nil
}
Expand All @@ -247,16 +247,16 @@ func (e *external) Delete(ctx context.Context, mg resource.Managed) error {

func getConnectionDetails(password string, cr *v1alpha1.RDSInstance, instance *rds.DBInstance) managed.ConnectionDetails {
cd := managed.ConnectionDetails{
runtimev1alpha1.ResourceCredentialsSecretUserKey: []byte(cr.Spec.ForProvider.MasterUsername),
xpv1.ResourceCredentialsSecretUserKey: []byte(cr.Spec.ForProvider.MasterUsername),
}

if password != "" {
cd[runtimev1alpha1.ResourceCredentialsSecretPasswordKey] = []byte(password)
cd[xpv1.ResourceCredentialsSecretPasswordKey] = []byte(password)
}

if instance.Endpoint != nil {
cd[runtimev1alpha1.ResourceCredentialsSecretEndpointKey] = []byte(instance.Endpoint.Address)
cd[runtimev1alpha1.ResourceCredentialsSecretPortKey] = []byte(instance.Endpoint.Port)
cd[xpv1.ResourceCredentialsSecretEndpointKey] = []byte(instance.Endpoint.Address)
cd[xpv1.ResourceCredentialsSecretPortKey] = []byte(instance.Endpoint.Port)
}

return cd
Expand Down
Loading

0 comments on commit cca235d

Please # to comment.