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

Update nbc contract: identityconfig, vmtype, nodepoolprofile #4208

Merged
merged 17 commits into from
Mar 29, 2024

Conversation

lilypan26
Copy link
Contributor

What type of PR is this?

What this PR does / why we need it:
Updating node bootstrap contract as needed. Updated IdentityConfig and added vmType enum. Removed nodepoolprofile config.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none


// vm_size represents the size of this node pool
// Let's keep it for now but continue to review if this can be removed from contract as this can be retrieved from IMDS
string vm_size = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not seeing this used anywhere for populating cse_cmd, not sure why it was initially added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back as it can be used to compute many other contract variables which can then be removed.

@coveralls
Copy link

coveralls commented Mar 25, 2024

Pull Request Test Coverage Report for Build 8483202629

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 79.321%

Totals Coverage Status
Change from base Build 8478658043: 0.0%
Covered Lines: 2290
Relevant Lines: 2887

💛 - Coveralls

package nbcontract.v1;

enum VmType {
VM_TYPE_STANDARD = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if defaulting to standard is the best move here, but this is what AB currently does unless vmss is explicity specified.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. I think it should be good as long as AB is doing this too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

BTW, protobuff official doc suggests to set the first enum=0 as unspecified to handle evolution scenario.
You may want to consider unspecified = 0, standard = 1, etc. And in our go binary parser, if it's unspecified, we will still set it to standard. Does that sound make sense to you?
https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know where (and what for) this is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the only place I found is that is it is logged into the azure json file: https://github.com/Azure/AgentBaker/blob/master/parts/linux/cloud-init/artifacts/cse_config.sh#L192C5-L192C28

i'm not sure how this file is used however

Copy link
Contributor

@tallaxes tallaxes Mar 26, 2024

Choose a reason for hiding this comment

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

This file is used by cloud-provder-azure clients, the structure is documented here: https://cloud-provider-azure.sigs.k8s.io/install/configs/. But:

  • Cataloguing all of the uses of this on the node would be great. Currently it is likely used by kubelet (to authenticate to ACRs, via in-tree auth helpers which use cloud-provider-azure clients) and probably CSI drivers. There may be other uses I am not aware of.
  • I am not sure why any of these need vmType ... (kubelet ACR auth definitely should not need it?)
  • From the contract perspective, it may still be a good idea to collect everything that goes to azure.json in one place (unless we have a clear indication some settings are used elsewhere as well)

Copy link
Contributor Author

@lilypan26 lilypan26 Mar 26, 2024

Choose a reason for hiding this comment

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

Sure I can start noting down where azure.json is used and what variables in the contract are stored inside. Not sure how best to confirm what variables are need or not though.

@@ -2,16 +2,8 @@ syntax = "proto3";
package nbcontract.v1;

message IdentityConfig {
IdentityType identity_type = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing, since not seeing this used anywhere

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense to me too. If later on we have other identity type to support, we can add it back.

string service_principal_id = 1;
string service_principal_secret = 2;
string assigned_identity_id = 3; //could be user or system assigned, depending on the type
string use_managed_identity_extension = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be bool, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, should be a bool

Comment on lines 5 to 8
string service_principal_id = 1;
string service_principal_secret = 2;
string assigned_identity_id = 3; //could be user or system assigned, depending on the type
string use_managed_identity_extension = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if this is only used for generating azure config file? If yes - it might make sense to collect all the settings that affect it in one place ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Grouped all the auth config fields and cluster config fields used to generate azure config file as listed here: https://cloud-provider-azure.sigs.k8s.io/install/configs/ into AuthConfig and ClusterConfig.

@Devinwong
Copy link
Collaborator

One unit test failed. It should be because the contract is changed. In case you didn't know yet, you can run it locally for convenience with go test go list ./... | grep -v e2e -coverprofile coverage_raw.out -covermode count

Comment on lines +9 to +10
string service_principal_id = 4; // set to aadClientId
string service_principal_secret = 5; // set to aadClientSecret
Copy link
Contributor

Choose a reason for hiding this comment

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

At least these (and possibly others) can be unspecified. What pattern did we settle on for handling optional strings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we decided that unless we need to change the default value of just an empty string or need to handle the nil case specially, then there is no need to specify optional. In this case, not specifying it should have an empty string value so i excluded the optional.

@lilypan26 lilypan26 enabled auto-merge (squash) March 29, 2024 16:31
@lilypan26 lilypan26 merged commit d9ad8ea into master Mar 29, 2024
16 checks passed
@lilypan26 lilypan26 deleted the lily/update-contract-identity-config branch March 29, 2024 16:32
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