-
Notifications
You must be signed in to change notification settings - Fork 27
Make NodePool optional for LKE-E #741
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
58d89e6
Merge pull request #707 from linode/dev
yec-akamai f1c8618
Merge pull request #715 from linode/dev
lgarber-akamai dbf4982
Merge branch 'dev' of github.com:linode/ansible_linode into optional-…
rammanoj 8a023db
make nodepools optional in cluster_create
rammanoj bfee3a9
Update plugins/modules/lke_cluster.py
rammanoj a2607dc
Update plugins/modules/lke_cluster.py
rammanoj 916c975
use cluster.tier as it is immutable
rammanoj ca6ec6d
Merge branch 'optional-nodepools' of github.com:rammanoj/ansible_lino…
rammanoj 136d229
address feedback
rammanoj f59cf6b
address feedback
rammanoj 582cbb2
Update plugins/modules/lke_cluster.py
zliang-akamai 8a50c3c
Fix node pool check for standard LKE clusters
zliang-akamai ec011dd
Fix test
zliang-akamai 86bcce7
Merge branch 'dev' into optional-nodepools
zliang-akamai f44eccb
Apply suggestion from @Copilot
rammanoj 33f959a
Update tests/integration/targets/lke_cluster_enterprise_no_pools/task…
zliang-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
tests/integration/targets/lke_cluster_enterprise_no_pools/tasks/main.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| - name: lke_cluster_enterprise_no_pools | ||
| block: | ||
| - set_fact: | ||
| r: "{{ 1000000000 | random }}" | ||
|
|
||
| - name: Resolve an enterprise K8s version | ||
| linode.cloud.lke_version_list: | ||
| api_version: v4beta | ||
| tier: "enterprise" | ||
| register: get_lke_versions_enterprise | ||
|
|
||
| - set_fact: | ||
| lke_versions: '{{ get_lke_versions_enterprise.lke_versions|sort(attribute="id", reverse=True) }}' | ||
|
|
||
| - set_fact: | ||
| kube_version: '{{ lke_versions[0].id }}' | ||
|
|
||
| - name: List regions that support LKE Enterprise | ||
| linode.cloud.region_list: | ||
| register: all_regions | ||
|
|
||
| - set_fact: | ||
| lke_e_region: >- | ||
| {{ all_regions.regions | ||
| | selectattr("site_type", "equalto", "core") | ||
| | selectattr("capabilities", "search", "Kubernetes Enterprise") | ||
| | map(attribute="id") | ||
| | first }} | ||
|
|
||
| - name: Create a Linode LKE Enterprise cluster without node pools | ||
| linode.cloud.lke_cluster: | ||
| api_version: v4beta | ||
| tier: 'enterprise' | ||
| label: 'ansible-test-{{ r }}' | ||
| region: '{{ lke_e_region }}' | ||
| k8s_version: '{{ kube_version }}' | ||
| skip_polling: true | ||
| state: present | ||
| register: create_enterprise_cluster | ||
|
|
||
| - name: Assert LKE cluster is created | ||
| assert: | ||
| that: | ||
| - create_enterprise_cluster.cluster.k8s_version == kube_version | ||
| - create_enterprise_cluster.cluster.region == lke_e_region | ||
| - create_enterprise_cluster.cluster.tier == 'enterprise' | ||
|
|
||
| always: | ||
| - ignore_errors: yes | ||
| block: | ||
| - name: Delete the LKE cluster | ||
| linode.cloud.lke_cluster: | ||
| label: '{{ create_enterprise_cluster.cluster.label }}' | ||
| state: absent | ||
|
|
||
| environment: | ||
| LINODE_UA_PREFIX: '{{ ua_prefix }}' | ||
| LINODE_API_TOKEN: '{{ api_token }}' | ||
| LINODE_API_URL: '{{ api_url }}' | ||
| LINODE_API_VERSION: '{{ api_version }}' | ||
| LINODE_CA: '{{ ca_file or "" }}' |
40 changes: 40 additions & 0 deletions
40
tests/integration/targets/lke_cluster_standard_no_pools/tasks/main.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| - name: lke_cluster_standard_no_pools | ||
| block: | ||
| - set_fact: | ||
| r: "{{ 1000000000 | random }}" | ||
|
|
||
| - name: Resolve the latest K8s version | ||
| linode.cloud.lke_version_list: {} | ||
| register: get_lke_versions | ||
|
|
||
| - set_fact: | ||
| lke_versions: '{{ get_lke_versions.lke_versions|sort(attribute="id", reverse=True) }}' | ||
|
|
||
| - set_fact: | ||
| kube_version: '{{ lke_versions[0].id }}' | ||
|
|
||
| - name: Create a Linode LKE cluster without node_pools (should fail) | ||
| linode.cloud.lke_cluster: | ||
| label: 'ansible-test-{{ r }}' | ||
| region: us-southeast | ||
| k8s_version: '{{ kube_version }}' | ||
| skip_polling: true | ||
| state: present | ||
| register: create_cluster | ||
| ignore_errors: yes | ||
|
|
||
| - name: Verify that cluster creation failed as expected | ||
| assert: | ||
| that: | ||
| - create_cluster.changed == false | ||
| - "'At least one node pool must be specified when creating a standard LKE cluster.' in create_cluster.msg" | ||
| fail_msg: "Expected cluster creation to fail without node_pools, but got: {{ create_cluster }}" | ||
| success_msg: "Test passed: Cluster creation properly failed without node_pools" | ||
|
|
||
| environment: | ||
| LINODE_UA_PREFIX: '{{ ua_prefix }}' | ||
| LINODE_API_TOKEN: '{{ api_token }}' | ||
| LINODE_API_URL: '{{ api_url }}' | ||
| LINODE_API_VERSION: '{{ api_version }}' | ||
| LINODE_CA: '{{ ca_file or "" }}' | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.