Skip to content

[AKS] Fix addon's permission issue after updating to MSI cluster#2680

Merged
arrownj merged 6 commits intoAzure:masterfrom
norshtein:tosi/spn-to-msi-post-update-permission
Nov 24, 2020
Merged

[AKS] Fix addon's permission issue after updating to MSI cluster#2680
arrownj merged 6 commits intoAzure:masterfrom
norshtein:tosi/spn-to-msi-post-update-permission

Conversation

@norshtein
Copy link
Copy Markdown
Member


For clusters updating from SPN cluster to MSI cluster, if the cluster is using addons before updating, when updating finishes, each addon will get a dedicated user assigned identity. Some permission is needed on the user assigned identity to make the addon correctly running. However, currently the permission is not grant, so this PR adds extracts a function _put_managed_cluster_ensuring_permission from creating path and execute it in updating path to ensure permission.

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@azuresdkci
Copy link
Copy Markdown

If this PR is for a new extension or change to an existing extension, use the following to try out the changes in this PR:

docker run -it mcr.microsoft.com/azure-cli:latest
export EXT=<NAME>
pip install --upgrade --target ~/.azure/cliextensions/$EXT "git+https://github.com/norshtein/azure-cli-extensions.git@tosi/spn-to-msi-post-update-permission#subdirectory=src/$EXT&egg=$EXT"

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Nov 17, 2020

AKS

@arrownj arrownj self-assigned this Nov 19, 2020

def _is_msi_cluster(managed_cluster):
return (managed_cluster and managed_cluster.identity and
(managed_cluster.identity.type.casefold() == "systemassigned" or managed_cluster.identity.type.casefold() == "userassigned"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can managed_cluster.identity.type be None ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it can be 'None', when it is set to 'None', the cluster is not an MSI cluster so this function should return false.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code will raise exception if managed_cluster.identity.type is None, right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants