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

new: Support for Multicluster OBJ in object_keys module #531

Merged

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Jun 25, 2024

📝 Description

This pull request implements all of the changes to the object_keys module for Multicluster OBJ, including:

  • New regions field
  • New bucket_access.*.region field
  • New update & change validation logic
  • New object_keys_basic integration test

✔️ How to Test

The following test steps assume you have pulled down this PR locally and run make install.

Integration Testing

make TEST_ARGS="-v object_keys_basic object_basic" test

Manual Testing

  1. In an Ansible collection sandbox environment (e.g. dx-devenv), run the following playbook:
---
- name: ansible_linode Sandbox Playbook
  hosts: localhost
  tasks:
  - set_fact:
      r: "{{ 1000000000 | random }}"

  - name: Create an OBJ key
    linode.cloud.object_keys:
      label: "ansible-test-{{ r }}"
      regions:
        - us-mia
        - us-iad
      state: present
    register: create

  - name: Create an S3 bucket using the key
    amazon.aws.s3_bucket:
      s3_url: "https://{{ create.key.regions[0].s3_endpoint }}/"
      aws_access_key: "{{ create.key.access_key }}"
      aws_secret_key: "{{ create.key.secret_key }}"
      name: "ansible-test-{{ r }}"
      state: present
    register: create_bucket

  - name: Create an OBJ key scoped to the new bucket
    linode.cloud.object_keys:
      label: "ansible-test-scoped-{{ r }}"
      regions:
        - us-ord
      access:
        - region: "{{ create.key.regions[0].id }}"
          bucket_name: "{{ create_bucket.name }}"
          permissions: read_write
      state: present

  - name: Update the regions of the new key
    linode.cloud.object_keys:
      label: "ansible-test-scoped-{{ r }}"
      regions:
        - us-ord
        - us-sea
      access:
        - region: "{{ create.key.regions[0].id }}"
          bucket_name: "{{ create_bucket.name }}"
          permissions: read_write
      state: present
  1. Ensure the playbook runs successfully.
  2. Ensure all output JSON matches the expected changes/behavior.

@lgarber-akamai lgarber-akamai changed the base branch from dev to proj/multicluster-obj June 26, 2024 18:12
@lgarber-akamai lgarber-akamai added the new-feature for new features in the changelog. label Jun 27, 2024
@lgarber-akamai lgarber-akamai marked this pull request as ready for review June 27, 2024 19:00
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner June 27, 2024 19:00
@lgarber-akamai lgarber-akamai requested review from yec-akamai, ezilber-akamai and zliang-akamai and removed request for a team June 27, 2024 19:00
)
except Exception as exception:
return self.fail(
msg="failed to create object storage key: {0}".format(exception)
)

@staticmethod
def _access_changed(key: ObjectStorageKeys, params: Dict[str, Any]) -> bool:
Copy link
Contributor Author

@lgarber-akamai lgarber-akamai Jun 27, 2024

Choose a reason for hiding this comment

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

This method contains a lot of logic just to raise an error, but I really wanted to make sure users would be informed if they attempted to update the bucket access configuration of a key

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.

Works well, thanks for adding these new features!

@zliang-akamai zliang-akamai requested review from a team, jriddle-linode and ykim-akamai and removed request for a team July 3, 2024 04:57
Co-authored-by: Zhiwei Liang <[email protected]>
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Nice work!

@lgarber-akamai lgarber-akamai merged commit 026208f into linode:proj/multicluster-obj Jul 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants