Skip to content

Conversation

@lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Feb 25, 2025

📝 Description

This pull request updates the LKE cluster create and control plane ACL update methods to drop the addresses field if its value is null. This is necessary because an explicit null value is rejected by the API.

✔️ How to Test

The following test steps assume you have pulled down this PR locally.

Unit Testing

make test-unit

Integration Testing

make test-int

Manual Testing

  1. In a linode_api4-python sandbox environment (e.g. dx-devenv), run the following:
import os

from linode_api4 import LinodeClient


def main():
    client = LinodeClient(os.getenv("LINODE_TOKEN"))

    cluster = client.lke.cluster_create(
        region="us-mia",
        label="apl-test",
        kube_version="1.32",
        node_pools=[client.lke.node_pool("g6-standard-1", 3)],
        control_plane={
            "acl": {
                "enabled": True,
                "addresses": None,
            }
        },
    )

    print("Cluster:", cluster)


if __name__ == "__main__":
    main()
  1. Ensure the cluster is created successfully.

@lgarber-akamai lgarber-akamai added the bugfix for any bug fixes in the changelog. label Feb 25, 2025
result = self.client.post(
"/lke/clusters",
data=_flatten_request_body_recursive(drop_null_keys(params)),
data=drop_null_keys(_flatten_request_body_recursive(params)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

drop_null_keys(...) needed to be moved outside of the _flatten_request_body_recursive(...) call because it doesn't have handling for JSONObjects.

@lgarber-akamai lgarber-akamai marked this pull request as ready for review February 25, 2025 17:29
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner February 25, 2025 17:29
@lgarber-akamai lgarber-akamai requested review from ezilber-akamai and jriddle-linode and removed request for a team February 25, 2025 17:29
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.

Working locally LGTM

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.

I'm consistently getting some test failures. Could be related to the ACL API change that got released yesterday, but I'm not sure.

FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_acl - AssertionError: assert [] == ['10.0.0.2/32']
FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_update_acl_null_addresses - AssertionError: assert [] == ['10.0.0.1/32']
FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_disable_acl - assert False

@lgarber-akamai lgarber-akamai marked this pull request as draft February 26, 2025 18:10
@lgarber-akamai lgarber-akamai marked this pull request as ready for review February 27, 2025 16:54
@lgarber-akamai
Copy link
Contributor Author

I'm consistently getting some test failures. Could be related to the ACL API change that got released yesterday, but I'm not sure.

FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_acl - AssertionError: assert [] == ['10.0.0.2/32']
FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_update_acl_null_addresses - AssertionError: assert [] == ['10.0.0.1/32']
FAILED test/integration/models/lke/test_lke.py::test_lke_cluster_disable_acl - assert False

Looks like it was indeed related to the API Change, thanks for the heads up!

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.

Passing locally!

@lgarber-akamai lgarber-akamai merged commit baee4dc into linode:dev Feb 28, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants