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

ref: PG affinity_type, is_strict -> placement_group_type, placement_group_policy #540

Merged
merged 6 commits into from
Jul 24, 2024

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Jul 11, 2024

📝 Description

This pull request implements the following upcoming breaking changes for the VM Placement GA:

  • affinity_type -> placement_group_type
  • is_strict -> placement_group_policy

NOTE: We will need communication around this breaking change in the release notes.

✔️ How to Test

The following test steps assume you have pulled down this PR locally and have pointed your local environment at an API instance where PGs are available:

export TEST_API_URL=https://.../
export TEST_API_CA=$PWD/cacert.pem
export LINODE_TOKEN=...

# Exports for dx-devenv sandbox
export LINODE_API_URL=$TEST_API_URL
export LINODE_CA=$TEST_API_CA
export LINODE_API_TOKEN=$LINODE_TOKEN

Integration Testing

make TEST_ARGS="-v placement_group_assign placement_group_basic placement_group_info placement_group_list" test

# NOTE: This test is expected to fail in certain environments due to an unrelated issue, see TPT-3060 for more info.
make TEST_ARGS="-v instance_basic" test

Manual Testing

  1. In an ansible_linode sandbox environment (e.g. dx-devenv), run the following:
- name: ansible_linode Sandbox Playbook
  hosts: localhost
  tasks:
    - name: Create a Linode placement group
      linode.cloud.placement_group:
        label: my-ansible-test-pg
        region: us-east
        placement_group_type: anti_affinity:local
        placement_group_policy: flexible
        state: present
      register: pg_created

    - name: Get a Linode placement group info
      linode.cloud.placement_group_info:
        id: '{{ pg_created.placement_group.id }}'
      register: pg

    - name: Update a Linode placement group label
      linode.cloud.placement_group:
        id: '{{ pg.placement_group.id }}'
        label: '{{ pg.placement_group.label }}-updated'
        placement_group_type: anti_affinity:local
        placement_group_policy: flexible
        state: present
      register: pg_updated

    - name: List Linode placement groups for the current account
      linode.cloud.placement_group_list:
        filters:
          - name: label
            values: ['{{ pg_updated.placement_group.label }}']
      register: pg_list
  1. Observe no error is raised.

  2. Create an instance under the placement group

    - name: Create a Linode instance under a placement group
      linode.cloud.instance:
        label: 'ansible-test-pg-{{ r }}'
        type: g6-nanode-1
        region: us-east
        placement_group:
          id: '{{ pg_updated.placement_group.id }}'
          compliant_only: false
        state: present
      register: instance_pg
  1. Observe that the instance is created successfully.

  2. Clean up the resources created.

    - name: Delete a Linode instance
      linode.cloud.instance:
        label: '{{ instance_pg.instance.label }}'
        state: absent
      register: delete_instance_pg

    - name: Delete a placement group
      linode.cloud.placement_group:
        label: '{{ pg_updated.placement_group.label }}'
        state: absent
      register: pg_deleted

@lgarber-akamai lgarber-akamai added do-not-merge PRs that should not be merged until the commented issue is resolved improvement for improvements in existing functionality in the changelog. breaking-change for breaking changes in the changelog. labels Jul 11, 2024
@lgarber-akamai lgarber-akamai marked this pull request as ready for review July 16, 2024 16:22
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner July 16, 2024 16:22
@lgarber-akamai lgarber-akamai requested review from jriddle-linode and zliang-akamai and removed request for a team July 16, 2024 16:22
Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

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

Tested and it works well, nice job!

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

LGTM!

@lgarber-akamai lgarber-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label Jul 24, 2024
@lgarber-akamai lgarber-akamai merged commit 022ff7b into linode:dev Jul 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change for breaking changes in the changelog. improvement for improvements in existing functionality in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants