Skip to content

Conversation

@lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Jan 15, 2025

📝 Description

This pull request adds support for fields related to LKE APL, including two new property methods under LKECluster to ease accessing the APL console.

✔️ How to Test

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

Unit Testing

make testunit

Integration Testing

make TEST_COMMAND=models/lke/test_lke.py::test_lke_cluster_with_apl testint

Manual Testing

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

from linode_api4 import LinodeClient, LKEClusterControlPlaneOptions


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

    cluster = client.lke.cluster_create(
        region="us-mia",
        label="apl-test",
        kube_version="1.31",
        node_pools=[
            client.lke.node_pool("g6-dedicated-4", 3)
        ],
        control_plane=LKEClusterControlPlaneOptions(
            high_availability=True,
        ),
        apl_enabled=True
    )

    print("Cluster:", cluster)
    print("APL Enabled:", cluster.apl_enabled)
    print("APL Console URL:", cluster.apl_console_url)
    print("APL Health Check URL:", cluster.apl_health_check_url)


if __name__ == "__main__":
    main()
  1. Ensure the output looks similar to the following:
Cluster: LKECluster: 316845
APL Enabled: True
APL Console URL: https://console.lke316845.akamai-apl.net
APL Health Check URL: https://auth.lke316845.akamai-apl.net/ready

@lgarber-akamai lgarber-akamai added the new-feature for new features in the changelog. label Jan 15, 2025
@lgarber-akamai lgarber-akamai marked this pull request as ready for review January 16, 2025 17:08
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner January 16, 2025 17:08
@lgarber-akamai lgarber-akamai requested review from ykim-akamai and zliang-akamai and removed request for a team January 16, 2025 17:08
Comment on lines +357 to +385
@property
def apl_console_url(self) -> Optional[str]:
"""
Returns the URL of this cluster's APL installation if this cluster
is APL-enabled, else None.
:returns: The URL of the APL console for this cluster.
:rtype: str or None
"""

if not self.apl_enabled:
return None

return f"https://console.lke{self.id}.akamai-apl.net"

@property
def apl_health_check_url(self) -> Optional[str]:
"""
Returns the URL of this cluster's APL health check endpoint if this cluster
is APL-enabled, else None.
:returns: The URL of the APL console for this cluster.
:rtype: str or None
"""

if not self.apl_enabled:
return None

return f"https://auth.lke{self.id}.akamai-apl.net/ready"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM, tests passing locally.

Side note: In order to test APL changes, beta program enrollment is required at the moment in CM

image

Copy link
Contributor

@yec-akamai yec-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 works well on my end, nice work!

@lgarber-akamai lgarber-akamai merged commit 7c0aa01 into linode:dev Jan 30, 2025
12 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