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

version: bump ec2/vpccidrblock package to manualv1alpha1 #751

Merged
merged 1 commit into from
Jul 13, 2021
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
4 changes: 2 additions & 2 deletions apis/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
cloudfrontv1alpha1 "github.com/crossplane/provider-aws/apis/cloudfront/v1alpha1"
databasev1beta1 "github.com/crossplane/provider-aws/apis/database/v1beta1"
dynamodbv1alpha1 "github.com/crossplane/provider-aws/apis/dynamodb/v1alpha1"
ec2v1alpha1 "github.com/crossplane/provider-aws/apis/ec2/v1alpha1"
ec2manualv1alpha1 "github.com/crossplane/provider-aws/apis/ec2/manualv1alpha1"
ec2v1beta1 "github.com/crossplane/provider-aws/apis/ec2/v1beta1"
ecrv1alpha1 "github.com/crossplane/provider-aws/apis/ecr/v1alpha1"
efsv1alpha1 "github.com/crossplane/provider-aws/apis/efs/v1alpha1"
Expand Down Expand Up @@ -86,7 +86,7 @@ func init() {
kmsv1alpha1.SchemeBuilder.AddToScheme,
efsv1alpha1.SchemeBuilder.AddToScheme,
rdsv1alpha1.SchemeBuilder.AddToScheme,
ec2v1alpha1.SchemeBuilder.AddToScheme,
ec2manualv1alpha1.SchemeBuilder.AddToScheme,
lambdav1alpha1.SchemeBuilder.AddToScheme,
cloudfrontv1alpha1.SchemeBuilder.AddToScheme,
route53resolveralpha1.SchemeBuilder.AddToScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package manualv1alpha1

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
// +groupName=ec2.aws.crossplane.io
// +versionName=v1alpha1

package v1alpha1
package manualv1alpha1

import (
"reflect"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package manualv1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down

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

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

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

14 changes: 7 additions & 7 deletions pkg/clients/ec2/vpccidrblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/aws/aws-sdk-go-v2/aws/awserr"
"github.com/aws/aws-sdk-go-v2/service/ec2"

"github.com/crossplane/provider-aws/apis/ec2/v1alpha1"
"github.com/crossplane/provider-aws/apis/ec2/manualv1alpha1"
awsclient "github.com/crossplane/provider-aws/pkg/clients"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func IsCIDRNotFound(err error) bool {

// IsVpcCidrBlockUpToDate returns true if there is no update-able difference between desired
// and observed state of the resource.
func IsVpcCidrBlockUpToDate(associationID string, spec v1alpha1.VPCCIDRBlockParameters, vpc ec2.Vpc) (bool, error) {
func IsVpcCidrBlockUpToDate(associationID string, spec manualv1alpha1.VPCCIDRBlockParameters, vpc ec2.Vpc) (bool, error) {
IPv4, IPv6 := FindCIDRAssociation(associationID, vpc)

if IPv4 != nil {
Expand All @@ -65,7 +65,7 @@ func IsVpcCidrBlockUpToDate(associationID string, spec v1alpha1.VPCCIDRBlockPara
}

// IsVpcCidrDeleting returns true if the CIDR Block is already disassociated or disassociating
func IsVpcCidrDeleting(observation v1alpha1.VPCCIDRBlockObservation) bool {
func IsVpcCidrDeleting(observation manualv1alpha1.VPCCIDRBlockObservation) bool {
switch {
case observation.CIDRBlockState == nil && observation.IPv6CIDRBlockState == nil:
return true
Expand All @@ -80,14 +80,14 @@ func IsVpcCidrDeleting(observation v1alpha1.VPCCIDRBlockObservation) bool {

// GenerateVpcCIDRBlockObservation is used to produce v1alpha1.VPCObservation from
// ec2.Vpc.
func GenerateVpcCIDRBlockObservation(associationID string, vpc ec2.Vpc) v1alpha1.VPCCIDRBlockObservation {
o := v1alpha1.VPCCIDRBlockObservation{}
func GenerateVpcCIDRBlockObservation(associationID string, vpc ec2.Vpc) manualv1alpha1.VPCCIDRBlockObservation {
o := manualv1alpha1.VPCCIDRBlockObservation{}

IPv4, IPv6 := FindCIDRAssociation(associationID, vpc)

if IPv4 != nil {
o.AssociationID = IPv4.AssociationId
o.CIDRBlockState = &v1alpha1.VPCCIDRBlockState{
o.CIDRBlockState = &manualv1alpha1.VPCCIDRBlockState{
State: awsclient.String(string(IPv4.CidrBlockState.State)),
StatusMessage: IPv4.CidrBlockState.StatusMessage,
}
Expand All @@ -97,7 +97,7 @@ func GenerateVpcCIDRBlockObservation(associationID string, vpc ec2.Vpc) v1alpha1

if IPv6 != nil {
o.AssociationID = IPv6.AssociationId
o.IPv6CIDRBlockState = &v1alpha1.VPCCIDRBlockState{
o.IPv6CIDRBlockState = &manualv1alpha1.VPCCIDRBlockState{
State: awsclient.String(string(IPv6.Ipv6CidrBlockState.State)),
StatusMessage: IPv6.Ipv6CidrBlockState.StatusMessage,
}
Expand Down
22 changes: 11 additions & 11 deletions pkg/clients/ec2/vpccidrblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/google/go-cmp/cmp"

"github.com/crossplane/provider-aws/apis/ec2/v1alpha1"
"github.com/crossplane/provider-aws/apis/ec2/manualv1alpha1"
)

var (
Expand All @@ -23,7 +23,7 @@ func TestGenerateVPCCIDRBlockObservation(t *testing.T) {
cases := map[string]struct {
associationID string
in ec2.Vpc
out v1alpha1.VPCCIDRBlockObservation
out manualv1alpha1.VPCCIDRBlockObservation
}{
"IPv4": {
associationID: matchAssociationID,
Expand All @@ -43,10 +43,10 @@ func TestGenerateVPCCIDRBlockObservation(t *testing.T) {
},
},
},
out: v1alpha1.VPCCIDRBlockObservation{
out: manualv1alpha1.VPCCIDRBlockObservation{
AssociationID: &matchAssociationID,
CIDRBlock: &testCidrBlock,
CIDRBlockState: &v1alpha1.VPCCIDRBlockState{
CIDRBlockState: &manualv1alpha1.VPCCIDRBlockState{
State: &testStateString,
StatusMessage: &testStatus,
},
Expand Down Expand Up @@ -74,10 +74,10 @@ func TestGenerateVPCCIDRBlockObservation(t *testing.T) {
},
},
},
out: v1alpha1.VPCCIDRBlockObservation{
out: manualv1alpha1.VPCCIDRBlockObservation{
AssociationID: &matchAssociationID,
IPv6CIDRBlock: &testCidrBlock,
IPv6CIDRBlockState: &v1alpha1.VPCCIDRBlockState{
IPv6CIDRBlockState: &manualv1alpha1.VPCCIDRBlockState{
State: &testStateString,
StatusMessage: &testStatus,
},
Expand Down Expand Up @@ -163,24 +163,24 @@ func TestFindVPCCIDRBlockStatus(t *testing.T) {

func TestIsVpcCidrDeleting(t *testing.T) {
cases := map[string]struct {
in v1alpha1.VPCCIDRBlockObservation
in manualv1alpha1.VPCCIDRBlockObservation
out bool
}{
"IPv4": {
in: v1alpha1.VPCCIDRBlockObservation{
in: manualv1alpha1.VPCCIDRBlockObservation{
CIDRBlock: &testCidrBlock,
CIDRBlockState: &v1alpha1.VPCCIDRBlockState{
CIDRBlockState: &manualv1alpha1.VPCCIDRBlockState{
State: &testStateString,
StatusMessage: &testStatus,
},
},
out: false,
},
"IPv6": {
in: v1alpha1.VPCCIDRBlockObservation{
in: manualv1alpha1.VPCCIDRBlockObservation{
AssociationID: &matchAssociationID,
IPv6CIDRBlock: &testCidrBlock,
IPv6CIDRBlockState: &v1alpha1.VPCCIDRBlockState{
IPv6CIDRBlockState: &manualv1alpha1.VPCCIDRBlockState{
State: &testStateString,
StatusMessage: &testStatus,
},
Expand Down
16 changes: 8 additions & 8 deletions pkg/controller/ec2/vpccidrblock/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplane/crossplane-runtime/pkg/resource"

"github.com/crossplane/provider-aws/apis/ec2/v1alpha1"
"github.com/crossplane/provider-aws/apis/ec2/manualv1alpha1"
awsclient "github.com/crossplane/provider-aws/pkg/clients"
"github.com/crossplane/provider-aws/pkg/clients/ec2"
)
Expand All @@ -51,15 +51,15 @@ const (

// SetupVPCCIDRBlock adds a controller that reconciles VPCCIDRBlocks.
func SetupVPCCIDRBlock(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error {
name := managed.ControllerName(v1alpha1.VPCCIDRBlockGroupKind)
name := managed.ControllerName(manualv1alpha1.VPCCIDRBlockGroupKind)
return ctrl.NewControllerManagedBy(mgr).
Named(name).
WithOptions(controller.Options{
RateLimiter: ratelimiter.NewDefaultManagedRateLimiter(rl),
}).
For(&v1alpha1.VPCCIDRBlock{}).
For(&manualv1alpha1.VPCCIDRBlock{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(v1alpha1.VPCCIDRBlockGroupVersionKind),
resource.ManagedKind(manualv1alpha1.VPCCIDRBlockGroupVersionKind),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), newClientFn: ec2.NewVPCCIDRBlockClient}),
managed.WithReferenceResolver(managed.NewAPISimpleReferenceResolver(mgr.GetClient())),
managed.WithConnectionPublishers(),
Expand All @@ -75,7 +75,7 @@ type connector struct {
}

func (c *connector) Connect(ctx context.Context, mg resource.Managed) (managed.ExternalClient, error) {
cr, ok := mg.(*v1alpha1.VPCCIDRBlock)
cr, ok := mg.(*manualv1alpha1.VPCCIDRBlock)
if !ok {
return nil, errors.New(errUnexpectedObject)
}
Expand All @@ -92,7 +92,7 @@ type external struct {
}

func (e *external) Observe(ctx context.Context, mgd resource.Managed) (managed.ExternalObservation, error) { // nolint:gocyclo
cr, ok := mgd.(*v1alpha1.VPCCIDRBlock)
cr, ok := mgd.(*manualv1alpha1.VPCCIDRBlock)
if !ok {
return managed.ExternalObservation{}, errors.New(errUnexpectedObject)
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (e *external) Observe(ctx context.Context, mgd resource.Managed) (managed.E
}

func (e *external) Create(ctx context.Context, mgd resource.Managed) (managed.ExternalCreation, error) {
cr, ok := mgd.(*v1alpha1.VPCCIDRBlock)
cr, ok := mgd.(*manualv1alpha1.VPCCIDRBlock)
if !ok {
return managed.ExternalCreation{}, errors.New(errUnexpectedObject)
}
Expand Down Expand Up @@ -181,7 +181,7 @@ func (e *external) Update(_ context.Context, _ resource.Managed) (managed.Extern
}

func (e *external) Delete(ctx context.Context, mgd resource.Managed) error {
cr, ok := mgd.(*v1alpha1.VPCCIDRBlock)
cr, ok := mgd.(*manualv1alpha1.VPCCIDRBlock)
if !ok {
return errors.New(errUnexpectedObject)
}
Expand Down
Loading