Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eks_nodegroup - fixing remote access and added to integration tests #1773

Merged
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
2 changes: 2 additions & 0 deletions changelogs/fragments/1771-remote-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- eks_nodegroup - fix parameter options of ``remote_access`` (https://github.com/ansible-collections/community.aws/issues/1771).
6 changes: 5 additions & 1 deletion plugins/modules/eks_nodegroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,11 @@ def create_or_update_nodegroups(client, module):
if module.params['release_version'] is not None:
params['releaseVersion'] = module.params['release_version']
if module.params['remote_access'] is not None:
params['remoteAccess'] = module.params['remote_access']
params['remoteAccess'] = dict()
if module.params['remote_access']['ec2_ssh_key'] is not None:
params['remoteAccess']['ec2SshKey'] = module.params['remote_access']['ec2_ssh_key']
if module.params['remote_access']['source_sg'] is not None:
params['remoteAccess']['sourceSecurityGroups'] = module.params['remote_access']['source_sg']
if module.params['capacity_type'] is not None:
params['capacityType'] = module.params['capacity_type'].upper()
if module.params['labels'] is not None:
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
with_items: '{{ eks_security_groups|reverse|list + additional_eks_sg }}'
ignore_errors: 'yes'

- name: Delete securitygroup for node access
amazon.aws.ec2_security_group:
name: 'ansible-test-eks_nodegroup'
description: "SSH access"
vpc_id: '{{ setup_vpc.vpc.id }}'
rules: []
state: absent

- name: Delete Keypair for Access to Nodegroup nodes
amazon.aws.ec2_key:
name: "ansible-test-eks_nodegroup"
state: absent

- name: remove Route Tables
ec2_vpc_route_table:
state: absent
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/dependecies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,20 @@
default_version: 1
instance_type: t3.micro
register: lt

- name: Create securitygroup for node access
amazon.aws.ec2_security_group:
name: 'ansible-test-eks_nodegroup'
description: "SSH access"
vpc_id: '{{ setup_vpc.vpc.id }}'
rules:
- proto: tcp
ports:
- 22
cidr_ip: 0.0.0.0/0
register: securitygroup_eks_nodegroup

- name: Create Keypair for Access to Nodegroup nodes
amazon.aws.ec2_key:
name: "ansible-test-eks_nodegroup"
register: ec2_key_eks_nodegroup
Comment on lines +109 to +125
Copy link
Member

Choose a reason for hiding this comment

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

@romulus-ai can you also add both ressources to the cleanup.yml to take care, they are removed after testing is finished?
otherwise looks good to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

32 changes: 32 additions & 0 deletions tests/integration/targets/eks_nodegroup/tasks/full_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -114,6 +118,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down Expand Up @@ -147,6 +155,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -181,6 +193,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -255,6 +271,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -289,6 +309,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down Expand Up @@ -322,6 +346,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result
check_mode: True
Expand Down Expand Up @@ -356,6 +384,10 @@
capacity_type: 'SPOT'
tags:
'foo': 'bar'
remote_access:
ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}"
source_sg:
- "{{ securitygroup_eks_nodegroup.group_id }}"
wait: True
register: eks_nodegroup_result

Expand Down