Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: setup python 3
uses: actions/setup-python@v5
Expand All @@ -33,7 +33,7 @@ jobs:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

# Check out merge commit
- name: Checkout PR
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.sha }}
fetch-depth: 0
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ jobs:
steps:
- name: Clone Repository with SHA
if: ${{ inputs.sha != '' }}
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
ref: ${{ inputs.sha }}

- name: Clone Repository without SHA
if: ${{ inputs.sha == '' }}
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down Expand Up @@ -178,13 +178,13 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'

- name: Download test report
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
name: test-report-file

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
-
name: Run Labeler
uses: crazy-max/ghaction-github-labeler@24d110aa46a59976b8a7f35518cb7f14f434c916
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: dev

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
environment: pypi-release
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup Python
uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-cross-repo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout linode_api4 repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
Expand All @@ -30,7 +30,7 @@ jobs:
python-version: '3.10'

- name: Checkout ansible repo
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: linode/ansible_linode
path: .ansible/collections/ansible_collections/linode/cloud
Expand Down
2 changes: 1 addition & 1 deletion linode_api4/groups/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def maintenance_policies(self):
Returns a collection of MaintenancePolicy objects representing
available maintenance policies that can be applied to Linodes

API Documentation: https://techdocs.akamai.com/linode-api/reference/get-policies
API Documentation: https://techdocs.akamai.com/linode-api/reference/get-maintenance-policies

:returns: A list of Maintenance Policies that can be applied to Linodes
:rtype: List of MaintenancePolicy objects as MappedObjects
Expand Down
12 changes: 5 additions & 7 deletions linode_api4/objects/lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class LKENodePool(DerivedBase):
properties = {
"id": Property(identifier=True),
"cluster_id": Property(identifier=True),
"label": Property(mutable=True),
"type": Property(slug_relationship=Type),
"disks": Property(),
"disk_encryption": Property(),
Expand Down Expand Up @@ -419,6 +420,7 @@ def node_pool_create(
Union[str, KubeVersion, TieredKubeVersion]
] = None,
update_strategy: Optional[str] = None,
label: str = None,
**kwargs,
):
"""
Expand All @@ -444,23 +446,19 @@ def node_pool_create(
for possible values.

:returns: The new Node Pool
:param label: The name of the node pool.
:type label: str
:rtype: LKENodePool
"""
params = {
"type": node_type,
"label": label,
"count": node_count,
"labels": labels,
"taints": taints,
"k8s_version": k8s_version,
"update_strategy": update_strategy,
}

if labels is not None:
params["labels"] = labels

if taints is not None:
params["taints"] = taints

params.update(kwargs)

result = self._client.post(
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/lke_clusters_18881_pools_456.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"foo": "bar",
"bar": "foo"
},
"label": "example-node-pool",
"type": "g6-standard-4",
"disk_encryption": "enabled"
}
1 change: 1 addition & 0 deletions test/fixtures/lke_clusters_18882_pools_789.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": 789,
"type": "g6-standard-2",
"label": "enterprise-node-pool",
"count": 3,
"nodes": [],
"disks": [],
Expand Down
4 changes: 1 addition & 3 deletions test/integration/filters/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def lke_cluster_instance(test_linode_client):
node_type = test_linode_client.linode.types()[1] # g6-standard-1
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

node_pools = test_linode_client.lke.node_pool(node_type, 3)
label = get_test_label() + "_cluster"
Expand Down
41 changes: 32 additions & 9 deletions test/integration/models/image/test_image.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
from io import BytesIO
from test.integration.conftest import get_region, get_regions
from test.integration.conftest import get_regions
from test.integration.helpers import get_test_label

import polling
import pytest

from linode_api4 import LinodeClient
from linode_api4.objects import Image

DISALLOWED_IMAGE_REGIONS = {
"gb-lon",
"au-mel",
"sg-sin-2",
"jp-tyo-3",
"no-osl-1",
}


def get_image_upload_regions(client: LinodeClient):
"""
This is necessary because the API does not currently expose
a capability for regions that allow custom image uploads.

In the future, we should remove this if the API exposes a custom images capability or
if all Object Storage regions support custom images.
"""

return [
region
for region in get_regions(
client,
capabilities={"Linodes", "Object Storage"},
site_type="core",
)
if region.id not in DISALLOWED_IMAGE_REGIONS
]


@pytest.fixture(scope="session")
def image_upload_url(test_linode_client):
label = get_test_label() + "_image"

region = get_region(
test_linode_client,
capabilities={"Linodes", "Object Storage"},
site_type="core",
)
region = get_image_upload_regions(test_linode_client)[0]

test_linode_client.image_create_upload(
label, region.id, "integration test image upload"
Expand All @@ -38,9 +63,7 @@ def test_uploaded_image(test_linode_client):

label = get_test_label() + "_image"

regions = get_regions(
test_linode_client, capabilities={"Object Storage"}, site_type="core"
)
regions = get_image_upload_regions(test_linode_client)

image = test_linode_client.image_upload(
label,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def create_linode_for_long_running_tests(test_linode_client, e2e_test_firewall):
def linode_with_disk_encryption(test_linode_client, request):
client = test_linode_client

target_region = get_region(client, {"LA Disk Encryption"})
target_region = get_region(client, {"Disk Encryption"})
label = get_test_label(length=8)

disk_encryption = request.param
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
def test_linode_rebuild(test_linode_client):
client = test_linode_client

region = get_region(client, {"LA Disk Encryption"})
region = get_region(client, {"Disk Encryption"})

label = get_test_label() + "_rebuild"

Expand Down
10 changes: 3 additions & 7 deletions test/integration/models/lke/test_lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def lke_cluster(test_linode_client):
node_type = test_linode_client.linode.types()[1] # g6-standard-1
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

node_pools = test_linode_client.lke.node_pool(node_type, 3)
label = get_test_label() + "_cluster"
Expand Down Expand Up @@ -117,9 +115,7 @@ def lke_cluster_with_labels_and_taints(test_linode_client):
def lke_cluster_with_apl(test_linode_client):
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

# NOTE: g6-dedicated-4 is the minimum APL-compatible Linode type
node_pools = test_linode_client.lke.node_pool("g6-dedicated-4", 3)
Expand Down Expand Up @@ -149,7 +145,7 @@ def lke_cluster_enterprise(test_linode_client):
)[0]

region = get_region(
test_linode_client, {"Kubernetes Enterprise", "LA Disk Encryption"}
test_linode_client, {"Kubernetes Enterprise", "Disk Encryption"}
)

node_pools = test_linode_client.lke.node_pool(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/models/networking/test_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_create_and_delete_vlan(test_linode_client, linode_for_vlan_tests):
config.interfaces = []
config.save()

vlan_label = "testvlan"
vlan_label = f"{get_test_label(8)}-testvlan"
interface = config.interface_create_vlan(
label=vlan_label, ipam_address="10.0.0.2/32"
)
Expand Down
13 changes: 9 additions & 4 deletions test/integration/models/nodebalancer/test_nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def test_update_nb(test_linode_client, create_nb):
create_nb.id,
)

nb.label = "ThisNewLabel"
new_label = f"{nb.label}-ThisNewLabel"

nb.label = new_label
nb.client_udp_sess_throttle = 5
nb.save()

Expand All @@ -176,7 +178,7 @@ def test_update_nb(test_linode_client, create_nb):
create_nb.id,
)

assert "ThisNewLabel" == nb_updated.label
assert new_label == nb_updated.label
assert 5 == nb_updated.client_udp_sess_throttle


Expand Down Expand Up @@ -215,7 +217,10 @@ def test_update_nb_node(test_linode_client, create_nb_config):
create_nb_config.nodebalancer_id,
)
node = config.nodes[0]
node.label = "ThisNewLabel"

new_label = f"{node.label}-ThisNewLabel"

node.label = new_label
node.weight = 50
node.mode = "accept"
node.save()
Expand All @@ -226,7 +231,7 @@ def test_update_nb_node(test_linode_client, create_nb_config):
(create_nb_config.id, create_nb_config.nodebalancer_id),
)

assert "ThisNewLabel" == node_updated.label
assert new_label == node_updated.label
assert 50 == node_updated.weight
assert "accept" == node_updated.mode

Expand Down
Loading
Loading