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

snap/system_usernames,tests: Azure IoT Edge system usernames #12141

Merged
merged 3 commits into from
Oct 23, 2022

Conversation

alexclewontin
Copy link
Member

Genericize system-usernames-microk8s test to test arbitrary usernames scoped to a specific snap ID. Then add Azure IoT Edge scoped system usernames.

@alexclewontin alexclewontin changed the title Azure IoT Edge system usernames snap/system_usernames,tests: Azure IoT Edge system usernames Sep 13, 2022
@alexclewontin
Copy link
Member Author

Checks failed because I messed up the PR name, should be good now

@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from b817262 to f1237a3 Compare September 14, 2022 15:47
@mardy
Copy link
Contributor

mardy commented Sep 15, 2022

Thanks Alex! I like the changes on the spread test!

I'm not sure about adding all those usernames for a single snap, it seems a bit too much, but if you already agreed this with @pedronis then it's fine for me as well. In any case, I don't think that we need to add unit tests for all of them; I actually wouldn't add any unit test, given that the functionality is already tested by the existing usernames, and you have a good test in the spread.

@mardy mardy added the Needs Samuele review Needs a review from Samuele before it can land label Sep 15, 2022
@mardy mardy requested a review from pedronis September 15, 2022 14:52
@alexclewontin
Copy link
Member Author

@mardy thanks for the review!

I'll nix the unit tests.

Just as context: I also don't love adding all the usernames but unfortunately it is necessary to support the Azure IoT Edge application architecture, which relies on all of these services running under different UIDs corresponding to known usernames (which we are meeting Microsoft halfway with by adding the snap_ prefix).

@alexclewontin alexclewontin marked this pull request as draft September 16, 2022 17:26
@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from f1237a3 to 0073ec7 Compare September 19, 2022 16:43
@alexclewontin alexclewontin marked this pull request as ready for review September 19, 2022 17:18
@alexclewontin
Copy link
Member Author

Split the usernames across two snap IDs (one is an Azure ID service which can be used by more than just the Azure IoT Edge runtime, the other is the Azure IoT Edge runtime).

Removed unnecessary unit tests as per @mardy's review.

Looks like the failing check is not related to this PR?

pedronis
pedronis previously approved these changes Sep 22, 2022
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

this looks reasonable, including the parameterized spread tests, thanks. If the use cases grow further we need to make this policy controlled from the store though

@pedronis pedronis dismissed their stale review September 22, 2022 17:44

noticed one more thing

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

actually a question about the first username

@alexclewontin
Copy link
Member Author

alexclewontin commented Sep 23, 2022

this looks reasonable, including the parameterized spread tests, thanks. If the use cases grow further we need to make this policy controlled from the store though

@pedronis unfortunately I already know of one more request that is going to come through the pipe (the Azure Device Update service, a different Microsoft service which also uses the azure-iot-identity snap as an authentication backend) although it's really part of the same usecase.

If that would be too many we can look at reverting to store-side declaration method, although I'd like to understand what the timeline is and if there is anything I could do in that case to drive that work, as we have some commercial commitments based on the idea we'd do it this way. My understanding is that most of that work would actually be in snapd (extending the definition of the snap-decl assertion, consulting snap-decl assertion when deciding whether a system-username declared in snap.yaml is valid or not), is that correct?

@alexclewontin
Copy link
Member Author

Added the usernames for the above-mentioned Azure Device Update service. Check failure appears unrelated.

Copy link
Contributor

@mardy mardy left a comment

Choose a reason for hiding this comment

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

I'll let Samuele answer your question, but code-wise this LGTM, thanks!

@mvo5 mvo5 added this to the 2.58 milestone Sep 30, 2022
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thanks!

@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from c576f60 to c42fa62 Compare September 30, 2022 15:25
@pedronis pedronis self-requested a review October 1, 2022 12:45
Comment on lines 173 to 162
"snap_do": {Id: 584795, AllowedSnapIds: []string{
"KzF67Mv8CeQBdUdrGaKU2sZVEiICWBg1", // deviceupdate-agent
}},
"snap_adu": {Id: 584796, AllowedSnapIds: []string{
"KzF67Mv8CeQBdUdrGaKU2sZVEiICWBg1", // deviceupdate-agent
Copy link
Collaborator

Choose a reason for hiding this comment

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

these two are really not very purpose-unique names

@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from c42fa62 to a4f0c40 Compare October 13, 2022 17:59
Extend the system-usernames-microk8s test to allow creating variants
to test arbitrary system usernames scoped to particular snaps. Rename
the test to reflect this.

Signed-off-by: Alex Lewontin <alex.lewontin@canonical.com>
@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from a4f0c40 to 3badb4a Compare October 13, 2022 18:23
@pedronis pedronis self-requested a review October 18, 2022 08:34
Signed-off-by: Alex Lewontin <alex.lewontin@canonical.com>
Signed-off-by: Alex Lewontin <alex.lewontin@canonical.com>
@alexclewontin alexclewontin force-pushed the system-usernames-aziotedge branch from 3badb4a to abe724a Compare October 18, 2022 17:25
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Samuele review Needs a review from Samuele before it can land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants