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

Check LateInitialize management policy in SDKv2 external client #343

Conversation

mergenci
Copy link
Member

Description of your changes

Before calling LateInitialize(), make sure that spec.managementPolicies include LateInitialize policy.

I have:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

I tested the implementation manually using the following configuration:

apiVersion: autoscaling.aws.upbound.io/v1beta1
kind: AutoscalingGroup
metadata:
  annotations:
    meta.upbound.io/example-id: autoscaling/v1beta1/autoscalinggroup
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  managementPolicies: ["Create", "Observe", "Update", "Delete"]
  initProvider:
    desiredCapacity: 0
  forProvider:
    region: us-west-1
    availabilityZones:
      - us-west-1b
    maxSize: 2
    minSize: 0
    launchConfigurationSelector:
      matchLabels:
        testing.upbound.io/example-name: autoscalinggroup-example
    tag:
      - key: AmazonECSManaged
        propagateAtLaunch: true
        value: "true"

---
apiVersion: autoscaling.aws.upbound.io/v1beta1
kind: LaunchConfiguration
metadata:
  annotations:
    meta.upbound.io/example-id: autoscaling/v1beta1/autoscalinggroup
  labels:
    testing.upbound.io/example-name: autoscalinggroup-example
  name: autoscalinggroup-example
spec:
  forProvider:
    imageId: ami-0454207e5367abf01
    instanceType: t2.micro
    region: us-west-1

After the resource is created, desiredCapacity should appear in status.atProvider, but not in status.forProvider.

Updating desiredCapacity externally, from AWS Console, shouldn't cause any diffs to be detected by the provider, and therefore, shouldn't cause any updates.

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
Copy link
Collaborator

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mergenci, lgtm.

pkg/controller/external_tfpluginsdk.go Show resolved Hide resolved
@ulucinar ulucinar merged commit f6a1a0d into crossplane:main Feb 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants