-
Notifications
You must be signed in to change notification settings - Fork 332
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
azure_rm_aks: support system-assigned (managed) identity, #514
azure_rm_aks: support system-assigned (managed) identity, #514
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geekq Thank for your contribution! Would you add test case for the request? Thank you very much!
plugins/modules/azure_rm_aks.py
Outdated
suboptions: | ||
client_id: | ||
description: | ||
- The ID for the Service Principal. | ||
required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The required is not match with argument_spec. The argument_spec is required!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unsure, if I should remove required: true
for the suboptions too. Current state of PR seems to work as expected. I understand it so: linux_profile
is optional, but if linux_profile:
is given, then suboptions admin_username
and ssh_key
must be provided. This is why I kept required: true
for admin_username
and ssh_key
. Or do you mean something else with "The argument_spec is required"?
Would love to provide tests! From CONTRIBUTING.md or README.md I did not understand, what tests are needed, how they are supposed to be run: do I have to run the whole suit against a real Azure account? Maybe you can provide some guidance on this, thanks! Otherwise I'll try to dive in into the code and may be extend https://github.com/ansible-collections/azure/blob/dev/tests/integration/targets/azure_rm_aks/tasks/main.yml - or can I (preferably) create a smaller, isolated test in the same folder? P.S. Can I see the test results in the CI? Looks like it requires additional authorization? |
I've added an integration test for this minimal-parameters-cluster-definition. Or maybe @Fred-sun you can see the test results in the CI (I seem to have no access to the linked pipelines above) |
@geekq You can follow the link below to perform the Sanity test. Thank you very much!
|
2281f46
to
8dfc8ed
Compare
…ort system-assigned (managed) identity
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
5ce06f4
to
d7a0144
Compare
@geekq Why don't you place the test(minimal-cluster.yml) in main.yml so that the automated test can cover the feature! Thank you very much! |
@geekq In addition, please help to share the results of the test cases you added, which will help to advance the PR merge. Thank you very much! |
azure_rm_aks: | ||
name: "minimal{{ rpfx }}" | ||
location: eastus | ||
resource_group: "{{ resource_group }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add "kubernetes_version" parameter when create kubernets service! Thank you very much!
resource_group: "{{ resource_group }}" | |
resource_group: "{{ resource_group }}" | |
kubernetes_version: ** |
My motivation for putting it to a separate file was to depict, that those tasks are self-contained and do not depend on the other steps in main.yml
Maybe this automated test could run multiple files. It would be also great to be able to see it's output published somewhere.
What about maintenance? azure constantly changes the list of kubernetes versions available. You will need to adjust this file continuously. But I do not mind! :-) Please adjust as you see fit. It is maybe less work for you to adjust this PR to your taste, than make me change each line ;-) And thank you for maintaining this library! |
@geekq Thank you for your reply. First, kubernetes_version is a required parameter when creating aks, and we can get the version of kubernetes_version from azure_rm_aksversion_info and pass it in. Second, the main.yml is an automated playbook. Test /// Tasks /*.yml will be executed on a weekly basis to ensure that the latest repo is working properly. In the end, we combined the two PlayBooks. It doesn't have to be interdependent, it can be a separate test module, with different functions for the test. |
@geekq Could you please help to authorize me to update this PR? Thank you very much! |
@geekq Please make the final changes. Thank you very much!
|
add new change add new change add new change add new update Update last changed Update test case Enable azure_rm_privateendpoint test azure_rm_aks: support system-assigned (managed) identity, (ansible-collections#514) * azure_rm_aks: make linux_profile and service_principal optional, support system-assigned (managed) identity * azure_rm_aks: adjust docs formatting Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> * azure_rm_aks: add a test for the minimal parameters cluster definition * azure_rm_aks: fix sanity-checks / pep8 requirements * Add instructions for tests / sanity checks Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Upddate test case (ansible-collections#585) Add new feature storage_profile (ansible-collections#563) * Add new feature storage_profile * remove ignore * remove ignore 02 Bump version to v1.8.0 (ansible-collections#586) * Bump version to v1.8.0 * Update CHANGELOG.md update release date Co-authored-by: xuzhang3 <57888764+xuzhang3@users.noreply.github.com> add runtime.yml (ansible-collections#587) fix sanity error fix santiy error 02 fix sanity error 04 fix sanity error 03 fix sanity error 05 fix sanity error 06 fix sanity error 07 Add resource tags (ansible-collections#592) * add resource tags * add resource tags
* add new paramter node_labels for agent_pool * remove space Add return value for azure_rm_containerregistry idempotent test (ansible-collections#578) * Add return value for azure_rm_containerregistry idempotent test * fix sanity error: * remove require set azure_rm_roleassignment bugfix (ansible-collections#464) * pushing fixes. * whitespace * whitespace * Update aliases * add assignee filter to triplet lookup Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> azure_rm_aks: support system-assigned (managed) identity, (ansible-collections#514) * azure_rm_aks: make linux_profile and service_principal optional, support system-assigned (managed) identity * azure_rm_aks: adjust docs formatting Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> * azure_rm_aks: add a test for the minimal parameters cluster definition * azure_rm_aks: fix sanity-checks / pep8 requirements * Add instructions for tests / sanity checks Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Upddate test case (ansible-collections#585)
* add new module azure_rm_privateendpoint_info.py * add azu_rm_privateendpoint.py * update new add new change add new change add new change add new update Update last changed Update test case Enable azure_rm_privateendpoint test azure_rm_aks: support system-assigned (managed) identity, (#514) * azure_rm_aks: make linux_profile and service_principal optional, support system-assigned (managed) identity * azure_rm_aks: adjust docs formatting Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> * azure_rm_aks: add a test for the minimal parameters cluster definition * azure_rm_aks: fix sanity-checks / pep8 requirements * Add instructions for tests / sanity checks Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Upddate test case (#585) Add new feature storage_profile (#563) * Add new feature storage_profile * remove ignore * remove ignore 02 Bump version to v1.8.0 (#586) * Bump version to v1.8.0 * Update CHANGELOG.md update release date Co-authored-by: xuzhang3 <57888764+xuzhang3@users.noreply.github.com> add runtime.yml (#587) fix sanity error fix santiy error 02 fix sanity error 04 fix sanity error 03 fix sanity error 05 fix sanity error 06 fix sanity error 07 Add resource tags (#592) * add resource tags * add resource tags * Update Copyright * add supports check mode for azure_rm_privateendpoint
... make linux_profile and service_principal optional
SUMMARY
Motivation:
while current azure documentation tells
the current azcollection only supports former, not latter
azure/plugins/modules/azure_rm_aks.py
Line 121 in 9e20c6e
service_principal
as required and allows no system-assigned managed identity.An explicit linux_profile, service_principal require additional work at the beginning, but especially later, for rotation credentials for the service principal. The usual (and also Microsoft-recommended) approach nowadays is to use system-assigned managed identity. Also added an example for creating a cluster using minimal number of parameters.
ISSUE TYPE
COMPONENT NAME
azure_rm_aks
ADDITIONAL INFORMATION
If you just start with trying to automate the Azure k8s cluster creation with ansible,
it was surprising to see many parameters required by this ansible module.
While az cli only requires name, group name and node count
az aks create -g myGroup -n myCluster --node-count 3 -l westeurope
- you just need an existing resource group,I saw no way to create a cluster with a single
azure_rm_aks
ansible module call.This pull request aims to change that, enabling an easy start, making following example work