Skip to content

Commit

Permalink
Merge pull request #615 from linode/dev
Browse files Browse the repository at this point in the history
Release v0.32.0
  • Loading branch information
ykim-akamai authored Oct 29, 2024
2 parents eddec39 + 9aae586 commit aaceff8
Show file tree
Hide file tree
Showing 23 changed files with 188 additions and 54 deletions.
72 changes: 57 additions & 15 deletions .github/workflows/integration-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,10 @@ jobs:
- name: replace existing keys
run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- run: make deps && make TEST_ARGS="-v ${{ inputs.tests }}" test
if: ${{ steps.disallowed-char-check.outputs.match == '' }}
env:
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

- name: Apply Calico Rules to LKE
if: always()
run: |
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

- name: Get the hash value of the latest commit from the PR branch
uses: octokit/[email protected]
Expand Down Expand Up @@ -135,3 +120,60 @@ jobs:
conclusion: process.env.conclusion
});
return result;
apply-calico-rules:
runs-on: ubuntu-latest
needs: [integration-fork]
if: ${{ success() || failure() }}

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

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- name: Apply Calico Rules to LKE
run: |
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

add-fw-to-remaining-instances:
runs-on: ubuntu-latest
needs: [integration-fork]
if: ${{ success() || failure() }}

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Linode CLI
run: |
pip install linode-cli
- name: Create Firewall and Attach to Instances
run: |
FIREWALL_ID=$(linode-cli firewalls create --label "e2e-fw-$(date +%s)" --rules.inbound_policy "DROP" --rules.outbound_policy "ACCEPT" --text --format=id --no-headers)
echo "Created Firewall with ID: $FIREWALL_ID"
for instance_id in $(linode-cli linodes list --format "id" --text --no-header); do
echo "Attaching firewall to instance: $instance_id"
if linode-cli firewalls device-create "$FIREWALL_ID" --id "$instance_id" --type linode; then
echo "Firewall attached to instance $instance_id successfully."
else
echo "An error occurred while attaching firewall to instance $instance_id. Skipping..."
fi
done
env:
LINODE_CLI_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
76 changes: 59 additions & 17 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,13 @@ jobs:
- name: Replace Existing Keys
run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- name: Run Integration Tests
run: |
make testall
env:
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
ANSIBLE_CALLBACKS_ENABLED: "junit"

- name: Apply Calico Rules to LKE
if: always()
run: |
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

- name: Upload Test Report as Artifact
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -78,7 +63,7 @@ jobs:
process-upload-report:
runs-on: ubuntu-latest
needs: [integration-tests]
if: always() && github.repository == 'linode/ansible_linode'
if: ${{ (success() || failure()) && github.repository == 'linode/ansible_linode' }}

steps:
- name: Checkout code
Expand Down Expand Up @@ -128,10 +113,67 @@ jobs:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}

apply-calico-rules:
runs-on: ubuntu-latest
needs: [integration-tests]
if: ${{ success() || failure() }}

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

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- name: Apply Calico Rules to LKE
run: |
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

add-fw-to-remaining-instances:
runs-on: ubuntu-latest
needs: [integration-tests]
if: ${{ success() || failure() }}

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Linode CLI
run: |
pip install linode-cli
- name: Create Firewall and Attach to Instances
run: |
FIREWALL_ID=$(linode-cli firewalls create --label "e2e-fw-$(date +%s)" --rules.inbound_policy "DROP" --rules.outbound_policy "ACCEPT" --text --format=id --no-headers)
echo "Created Firewall with ID: $FIREWALL_ID"
for instance_id in $(linode-cli linodes list --format "id" --text --no-header); do
echo "Attaching firewall to instance: $instance_id"
if linode-cli firewalls device-create "$FIREWALL_ID" --id "$instance_id" --type linode; then
echo "Firewall attached to instance $instance_id successfully."
else
echo "An error occurred while attaching firewall to instance $instance_id. Skipping..."
fi
done
env:
LINODE_CLI_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

notify-slack:
runs-on: ubuntu-latest
needs: [integration-tests]
if: always() && github.repository == 'linode/ansible_linode' # Run even if integration tests fail and only on main repository
if: ${{ (success() || failure()) && github.repository == 'linode/ansible_linode' }} # Run even if integration tests fail and only on main repository

steps:
- name: Notify Slack
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release-notify-slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Notify Dev DX Channel on Release
on:
release:
types: [published]
workflow_dispatch: null

jobs:
notify:
if: github.repository == 'linode/ansible_linode'
runs-on: ubuntu-latest
steps:
- name: Notify Slack - Main Message
id: main_message
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.DEV_DX_SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*New Release Published: _ansible_linode_ - ${{ github.event.release.tag_name }} is now live!* :tada:"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Notify Slack - Threaded Release Notes
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.DEV_DX_SLACK_CHANNEL_ID }}
payload: |
{
"thread_ts": "${{ steps.main_message.outputs.ts }}",
"text": "*<${{ github.event.release.html_url }}| ${{ github.event.release.tag_name }} Release notes>*"
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ deps:
pip install -r requirements.txt -r requirements-dev.txt --upgrade

lint:
pylint --disable=too-many-positional-arguments plugins
pylint plugins

mypy plugins/modules
mypy plugins/inventory
Expand Down
1 change: 1 addition & 0 deletions docs/modules/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Manage Linode Instances, Configs, and Disks.
| `migration_type` | <center>`str`</center> | <center>Optional</center> | The type of migration to use for Region and Type migrations. **(Choices: `cold`, `warm`; Default: `cold`)** |
| `auto_disk_resize` | <center>`bool`</center> | <center>Optional</center> | Whether implicitly created disks should be resized during a type change operation. **(Default: `False`)** |
| `tags` | <center>`list`</center> | <center>Optional</center> | An array of tags applied to this object. Tags are for organizational purposes only. **(Updatable)** |
| `capabilities` | <center>`list`</center> | <center>Optional</center> | Read-only. A list of capabilities this compute instance supports. |
| [`placement_group` (sub-options)](#placement_group) | <center>`dict`</center> | <center>Optional</center> | A Placement Group to create this Linode under. |
| `disk_encryption` | <center>`str`</center> | <center>Optional</center> | The disk encryption status of this Linode. NOTE: Disk encryption may not currently be available to all users. **(Choices: `enabled`, `disabled`)** |
| `swap_size` | <center>`int`</center> | <center>Optional</center> | When deploying from an Image, this field is optional, otherwise it is ignored. This is used to set the swap disk size for the newly-created Linode. |
Expand Down
2 changes: 0 additions & 2 deletions docs/modules/placement_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Manage a Linode Placement Group.

NOTE: Placement Groups may not currently be available to all users.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
2 changes: 0 additions & 2 deletions docs/modules/placement_group_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Manages a single assignment between a Linode and a Placement Group.

NOTE: Placement Groups may not currently be available to all users.

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
2 changes: 0 additions & 2 deletions docs/modules/placement_group_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Get info about a Linode Placement Group.

WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
2 changes: 0 additions & 2 deletions docs/modules/placement_group_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

List and filter on Placement Groups.

WARNING! This module makes use of beta endpoints and requires the C(api_version) field be explicitly set to C(v4beta).

- [Minimum Required Fields](#minimum-required-fields)
- [Examples](#examples)
- [Parameters](#parameters)
Expand Down
1 change: 1 addition & 0 deletions docs/modules/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Manage a Linode Volume.
| `region` | <center>`str`</center> | <center>Optional</center> | The location to deploy the volume in. See https://api.linode.com/v4/regions |
| `size` | <center>`int`</center> | <center>Optional</center> | The size of this volume, in GB. Be aware that volumes may only be resized up after creation. **(Updatable)** |
| `attached` | <center>`bool`</center> | <center>Optional</center> | If true, the volume will be attached to a Linode. Otherwise, the volume will be detached. **(Default: `True`; Updatable)** |
| `encryption` | <center>`str`</center> | <center>Optional</center> | Enables encryption on the volume. Full disk encryption ensures the data stored on a block storage volume drive is secure. **(Choices: `disabled`, `enabled`)** |
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The amount of time, in seconds, to wait for a volume to have the active status. **(Default: `240`)** |
| `source_volume_id` | <center>`int`</center> | <center>Optional</center> | The volume id of the desired volume to clone. |
| `tags` | <center>`list`</center> | <center>Optional</center> | The tags to be attached to the volume. |
Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,13 @@
],
editable=True,
),
"capabilities": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
"Read-only. A list of capabilities this compute instance supports.",
],
),
"placement_group": SpecField(
type=FieldType.dict,
suboptions=linode_instance_placement_group_spec,
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/placement_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
SPECDOC_META = SpecDocMeta(
description=[
"Manage a Linode Placement Group.",
"NOTE: Placement Groups may not currently be available to all users.",
],
requirements=global_requirements,
author=global_authors,
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/placement_group_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
SPECDOC_META = SpecDocMeta(
description=[
"Manages a single assignment between a Linode and a Placement Group.",
"NOTE: Placement Groups may not currently be available to all users.",
],
requirements=global_requirements,
author=global_authors,
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/placement_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
)._raw_json,
),
],
requires_beta=True,
)

SPECDOC_META = module.spec
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/placement_group_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
result_docs_url="https://techdocs.akamai.com/linode-api/reference/get-placement-groups",
result_samples=docs.result_placement_groups_samples,
examples=docs.specdoc_examples,
requires_beta=True,
)

SPECDOC_META = module.spec
Expand Down
8 changes: 8 additions & 0 deletions plugins/modules/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
"Otherwise, the volume will be detached."
],
),
"encryption": SpecField(
type=FieldType.string,
description=[
"Enables encryption on the volume. Full disk encryption ensures "
"the data stored on a block storage volume drive is secure."
],
choices=["disabled", "enabled"],
),
"wait_timeout": SpecField(
type=FieldType.integer,
default=240,
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ disable = [
"missing-timeout",
"use-sequence-for-iteration",
"broad-exception-raised",
"fixme"
"fixme",
]
max-positional-arguments = 12
py-version = "3.8"
extension-pkg-whitelist = "math"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
linode-api4>=5.22.0
polling>=0.3.2
types-requests==2.32.0.20240914
types-requests==2.32.0.20241016
ansible-specdoc>=0.0.15
1 change: 1 addition & 0 deletions tests/integration/targets/instance_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
- info_id.instance.region == pg_region
- info_id.configs|length == 1
- info_id.networking.ipv4.public[0].address != None
- info_id.instance.capabilities == create.instance.capabilities

- name: Get info about the instance by label
linode.cloud.instance_info:
Expand Down
Loading

0 comments on commit aaceff8

Please sign in to comment.