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 IP module to allocate a new IP #628

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

yec-akamai
Copy link
Contributor

@yec-akamai yec-akamai commented Dec 5, 2024

📝 Description

Support a new linode.cloud.ip module to allocate a new IP to a Linode instance.

✔️ How to Test

Integration test:

make TEST_ARGS="ip_basic" test

Manual test:

  1. In a sandbox environment, i.e. dx-dvenv, run the following script to create a Linode instance and allocate a new IP to it.
    - name: Create a Linode Instance
      linode.cloud.instance:
        label: 'ansible-instance-test'
        region: us-southeast
        type: g6-standard-1
        image: linode/alpine3.19
        state: present
      register: create_instance

    - name: Allocate a new IP to the Linode
      linode.cloud.ip:
        linode_id: '{{ create_instance.instance.id }}'
        public: true
        type: ipv4
        state: present
      register: allocate_ip
  1. Observe the ip is allocated successfully.
  2. Clean up the resources created.

@yec-akamai yec-akamai requested a review from a team as a code owner December 5, 2024 19:27
@yec-akamai yec-akamai requested review from lgarber-akamai and ykim-akamai and removed request for a team December 5, 2024 19:27
@@ -91,7 +91,7 @@ delete-e2e-firewall: update-test-submodules
echo "$$OUTPUT"; \
exit 1; \
else \
echo "E2E Cloud firewall created successfully."; \
echo "E2E Cloud firewall deleted successfully."; \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nitpick

"The type of address you are requesting. "
"Only IPv4 addresses may be allocated through this operation."
],
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could a state attribute be added here to support creating/deleting IPs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find delete IP is not properly implemented in python sdk. We can't use the delete() function from Base because the endpoint is not correct. I'll create a python-sdk ticket to implement the right endpoint.

self.results["ip"] = ip._raw_json

def _handle_absent(self) -> None:
# TODO: Implement deleting IP once it's available in python-sdk
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we raise an error here until the issue in the Python SDK has been resolved?

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.

2 participants