Skip to content

Commit

Permalink
Merge pull request #530 from linode/dev
Browse files Browse the repository at this point in the history
Release v0.27.0
  • Loading branch information
yec-akamai committed Jun 26, 2024
2 parents 372851c + bdb90f8 commit 4c296d2
Show file tree
Hide file tree
Showing 69 changed files with 1,576 additions and 27 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/integration-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
with:
ref: ${{ inputs.sha }}
path: .ansible/collections/ansible_collections/linode/cloud
fetch-depth: 0
submodules: 'recursive'

# Install deps
- name: update packages
Expand All @@ -61,10 +63,25 @@ 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
21 changes: 18 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,28 @@ 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 Down Expand Up @@ -94,12 +109,12 @@ jobs:
- name: Merge all test xmls in output directory
run: |
ls -R tests/output/junit
python tod_scripts/merge_ansible_results.py
python e2e_scripts/tod_scripts/xml_to_obj_storage/ansible_tests/merge_ansible_results.py
- name: Add additional information to XML report
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
python tod_scripts/add_to_xml_test_report.py \
python e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/add_gha_info_to_xml.py \
--branch_name "${GITHUB_REF#refs/*/}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
Expand All @@ -108,7 +123,7 @@ jobs:
- name: Upload test results to the bucket
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
python3 tod_scripts/test_report_upload_script.py "${filename}"
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/xml_to_obj.py "${filename}"
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tod_scripts"]
path = tod_scripts
url = https://github.com/linode/TOD-test-report-uploader.git
[submodule "e2e_scripts"]
path = e2e_scripts
url = https://github.com/linode/dx-e2e-test-scripts
31 changes: 26 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,43 @@ gendocs:

# if want to add all the test add the tag --tags never at the end
# ansible-test integration $(TEST_ARGS) --tags never
integration-test: create-integration-config
integration-test: create-integration-config create-e2e-firewall
@echo "Running Integration Test(s)..."
ansible-test integration $(TEST_ARGS)

test: integration-test
create-e2e-firewall:
@echo "Running create e2e firewall playbook..."
@if ansible-playbook e2e_scripts/cloud_security_scripts/cloud_e2e_firewall/ansible_linode/create_e2e_cloud_firewall.yaml > /dev/null; then \
echo "Successfully created e2e firewall"; \
else \
echo "Failed to create e2e firewall. Please update the cloud firewall scripts using `git submodule update --init` if yaml file doesn't exist"; \
exit 1; \
fi

delete-e2e-firewall:
@echo "Running delete e2e firewall playbook..."
@if ansible-playbook e2e_scripts/cloud_security_scripts/cloud_e2e_firewall/ansible_linode/delete_e2e_cloud_firewall.yaml > /dev/null; then \
echo "Successfully deleted e2e firewall"; \
else \
echo "Failed to delete e2e firewall"; \
fi

testall: create-integration-config
test: integration-test delete-e2e-firewall

testall:
./scripts/test_all.sh

unittest:
ansible-test units --target-python default


create-integration-config:
ifneq ("${LINODE_TOKEN}", "")
@echo "api_token: ${LINODE_TOKEN}" > $(INTEGRATION_CONFIG);
@echo -n > $(INTEGRATION_CONFIG)
@echo "api_token: ${LINODE_TOKEN}" >> $(INTEGRATION_CONFIG);
else ifneq ("${LINODE_API_TOKEN}", "")
@echo "api_token: ${LINODE_API_TOKEN}" > $(INTEGRATION_CONFIG);
@echo -n > $(INTEGRATION_CONFIG)
@echo "api_token: ${LINODE_API_TOKEN}" >> $(INTEGRATION_CONFIG);
else
echo "LINODE_API_TOKEN must be set"; \
exit 1;
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Name | Description |
[linode.cloud.nodebalancer_node](./docs/modules/nodebalancer_node.md)|Manage Linode NodeBalancer Nodes.|
[linode.cloud.nodebalancer_stats](./docs/modules/nodebalancer_stats.md)|View a Linode NodeBalancers Stats.|
[linode.cloud.object_keys](./docs/modules/object_keys.md)|Manage Linode Object Storage Keys.|
[linode.cloud.placement_group](./docs/modules/placement_group.md)|Manage a Linode Placement Group.|
[linode.cloud.placement_group_assign](./docs/modules/placement_group_assign.md)|Manages a single assignment between a Linode and a Placement Group.|
[linode.cloud.ssh_key](./docs/modules/ssh_key.md)|Manage a Linode SSH key.|
[linode.cloud.stackscript](./docs/modules/stackscript.md)|Manage a Linode StackScript.|
[linode.cloud.token](./docs/modules/token.md)|Manage a Linode Token.|
Expand Down Expand Up @@ -69,6 +71,7 @@ Name | Description |
[linode.cloud.lke_cluster_info](./docs/modules/lke_cluster_info.md)|Get info about a Linode LKE cluster.|
[linode.cloud.nodebalancer_info](./docs/modules/nodebalancer_info.md)|Get info about a Linode NodeBalancer.|
[linode.cloud.object_cluster_info](./docs/modules/object_cluster_info.md)|Get info about a Linode Object Storage Cluster.|
[linode.cloud.placement_group_info](./docs/modules/placement_group_info.md)|Get info about a Linode Placement Group.|
[linode.cloud.profile_info](./docs/modules/profile_info.md)|Get info about a Linode Profile.|
[linode.cloud.ssh_key_info](./docs/modules/ssh_key_info.md)|Get info about the Linode SSH public key.|
[linode.cloud.stackscript_info](./docs/modules/stackscript_info.md)|Get info about a Linode StackScript.|
Expand Down Expand Up @@ -100,6 +103,7 @@ Name | Description |
[linode.cloud.lke_version_list](./docs/modules/lke_version_list.md)|List Kubernetes versions available for deployment to a Kubernetes cluster.|
[linode.cloud.nodebalancer_list](./docs/modules/nodebalancer_list.md)|List and filter on Nodebalancers.|
[linode.cloud.object_cluster_list](./docs/modules/object_cluster_list.md)|List and filter on Object Storage Clusters.|
[linode.cloud.placement_group_list](./docs/modules/placement_group_list.md)|List and filter on Placement Groups.|
[linode.cloud.region_list](./docs/modules/region_list.md)|List and filter on Linode Regions.|
[linode.cloud.ssh_key_list](./docs/modules/ssh_key_list.md)|List and filter on SSH keys in the Linode profile.|
[linode.cloud.stackscript_list](./docs/modules/stackscript_list.md)|List and filter on Linode stackscripts.|
Expand Down
30 changes: 28 additions & 2 deletions docs/modules/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,19 @@ Manage Linode Instances, Configs, and Disks.
image: linode/ubuntu22.04
root_pass: verysecurepassword!!!
metadata:
user_data: myuserdata
user_data: myuserdata
state: present
```
```yaml
- name: Create a new Linode instance under a placement group.
linode.cloud.instance:
label: my-linode
type: g6-nanode-1
region: us-east
placement_group:
id: 123
compliant_only: false
state: present
```
Expand Down Expand Up @@ -136,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)** |
| [`placement_group` (sub-options)](#placement_group) | <center>`dict`</center> | <center>Optional</center> | A Placement Group to create this Linode under. |

### configs

Expand Down Expand Up @@ -278,6 +291,13 @@ Manage Linode Instances, Configs, and Disks.
|-----------|------|----------|------------------------------------------------------------------------------|
| `public` | <center>`bool`</center> | <center>**Required**</center> | Whether the allocated IPv4 address should be public or private. |

### placement_group

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `id` | <center>`int`</center> | <center>**Required**</center> | The id of the placement group. |
| `compliant_only` | <center>`bool`</center> | <center>Optional</center> | Whether the newly added/migrated/resized linode must be compliant for flexible placement groups. **(Default: `False`)** |

## Return Values

- `instance` - The instance description in JSON serialized form.
Expand Down Expand Up @@ -326,7 +346,13 @@ Manage Linode Instances, Configs, and Disks.
],
"type": "g6-standard-1",
"updated": "2018-01-01T00:01:01",
"watchdog_enabled": true
"watchdog_enabled": true,
"placement_group": {
"id": 123,
"label": "test",
"affinity_type": "anti_affinity:local",
"is_strict": true
}
}
```
- See the [Linode API response documentation](https://www.linode.com/docs/api/linode-instances/#linode-view__responses) for a list of returned fields
Expand Down
8 changes: 7 additions & 1 deletion docs/modules/instance_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ Get info about a Linode Instance.
],
"type": "g6-standard-1",
"updated": "2018-01-01T00:01:01",
"watchdog_enabled": true
"watchdog_enabled": true,
"placement_group": {
"id": 123,
"label": "test",
"affinity_type": "anti_affinity:local",
"is_strict": true
}
}
```
- See the [Linode API response documentation](https://www.linode.com/docs/api/linode-instances/#linode-view__responses) for a list of returned fields
Expand Down
22 changes: 22 additions & 0 deletions docs/modules/lke_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,25 @@ Manage Linode LKE clusters.
| `region` | <center>`str`</center> | <center>Optional</center> | This Kubernetes cluster’s location. |
| `tags` | <center>`list`</center> | <center>Optional</center> | An array of tags applied to the Kubernetes cluster. |
| `high_availability` | <center>`bool`</center> | <center>Optional</center> | Defines whether High Availability is enabled for the Control Plane Components of the cluster. **(Default: `False`; Updatable)** |
| [`acl` (sub-options)](#acl) | <center>`dict`</center> | <center>Optional</center> | The ACL configuration for this cluster's control plane. NOTE: Control Plane ACLs may not currently be available to all users. **(Updatable)** |
| [`node_pools` (sub-options)](#node_pools) | <center>`list`</center> | <center>Optional</center> | A list of node pools to configure the cluster with **(Updatable)** |
| `skip_polling` | <center>`bool`</center> | <center>Optional</center> | If true, the module will not wait for all nodes in the cluster to be ready. **(Default: `False`)** |
| `wait_timeout` | <center>`int`</center> | <center>Optional</center> | The period to wait for the cluster to be ready in seconds. **(Default: `600`)** |

### acl

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `enabled` | <center>`bool`</center> | <center>Optional</center> | Whether control plane ACLs are enabled for this cluster. **(Updatable)** |
| [`addresses` (sub-options)](#addresses) | <center>`dict`</center> | <center>Optional</center> | The addresses allowed to access this cluster's control plane. **(Updatable)** |

### addresses

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `ipv4` | <center>`list`</center> | <center>Optional</center> | A list of IPv4 addresses to grant access to this cluster's control plane. |
| `ipv6` | <center>`list`</center> | <center>Optional</center> | A list of IPv6 addresses to grant access to this cluster's control plane. |

### node_pools

| Field | Type | Required | Description |
Expand All @@ -89,6 +104,13 @@ Manage Linode LKE clusters.
```json
{
"control_plane": {
"acl": {
"addresses": {
"ipv4": ["0.0.0.0/0"],
"ipv6": ["2001:db8:1234:abcd::/64"]
},
"enabled": true
},
"high_availability": true
},
"created": "2019-09-12T21:25:30Z",
Expand Down
7 changes: 7 additions & 0 deletions docs/modules/lke_cluster_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ Get info about a Linode LKE cluster.
```json
{
"control_plane": {
"acl": {
"addresses": {
"ipv4": ["0.0.0.0/0"],
"ipv6": ["2001:db8:1234:abcd::/64"]
},
"enabled": true
},
"high_availability": true
},
"created": "2019-09-12T21:25:30Z",
Expand Down
87 changes: 87 additions & 0 deletions docs/modules/placement_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# placement_group

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)
- [Return Values](#return-values)

## Minimum Required Fields
| Field | Type | Required | Description |
|-------------|-------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `api_token` | `str` | **Required** | The Linode account personal access token. It is necessary to run the module. <br/>It can be exposed by the environment variable `LINODE_API_TOKEN` instead. <br/>See details in [Usage](https://github.com/linode/ansible_linode?tab=readme-ov-file#usage). |

## Examples

```yaml
- name: Create a placement group
linode.cloud.placement_group:
label: my-pg
region: us-east
affinity_type: anti_affinity:local
is_strict: True
state: present
```
```yaml
- name: Update a Linode placement group label
linode.cloud.placement_group:
# id is required to update the label
id: 123
label: my-pg-updated
state: present
```
```yaml
- name: Delete a placement group by label
linode.cloud.placement_group:
label: my-pg
state: absent
```
```yaml
- name: Delete a placement group by id
linode.cloud.placement_group:
id: 123
state: absent

```


## Parameters

| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `id` | <center>`int`</center> | <center>Optional</center> | The unique ID of the placement group. |
| `label` | <center>`str`</center> | <center>Optional</center> | The label of the Placement Group. This field can only contain ASCII letters, digits and dashes. |
| `region` | <center>`str`</center> | <center>Optional</center> | The region that the placement group is in. |
| `affinity_type` | <center>`str`</center> | <center>Optional</center> | The affinity policy for Linodes in a placement group. |
| `is_strict` | <center>`bool`</center> | <center>Optional</center> | Whether Linodes must be able to become compliant during assignment. **(Default: `False`)** |

## Return Values

- `placement_group` - The Placement Group in JSON serialized form.

- Sample Response:
```json
{
"id": 123,
"label": "my-pg",
"region": "eu-west",
"affinity_type": "anti_affinity:local",
"is_strict": true,
"is_compliant": true,
"members": [
{
"linode_id": 123,
"is_compliant": true
}
]
}
```
- See the [Linode API response documentation](TBD) for a list of returned fields


Loading

0 comments on commit 4c296d2

Please sign in to comment.