Skip to content

feat: extend NodePool schema and CreateResourceGroup with optional fields#1196

Open
xinWeiWei24 wants to merge 2 commits into
v2from
xinwei/lib-node-pool-rg
Open

feat: extend NodePool schema and CreateResourceGroup with optional fields#1196
xinWeiWei24 wants to merge 2 commits into
v2from
xinwei/lib-node-pool-rg

Conversation

@xinWeiWei24
Copy link
Copy Markdown
Collaborator

Add vnetSubnetId and osSKU optional fields to NodePool schema, and tags optional parameter to CreateResourceGroup. Both default to empty/omitted for backwards compatibility with existing pipelines.

…ields

Add vnetSubnetId and osSKU optional fields to NodePool schema, and tags
optional parameter to CreateResourceGroup. Both default to empty/omitted
for backwards compatibility with existing pipelines.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Comment thread kcl/lib/steps/azure/create_node_pool.k Outdated
count: int
taintPrefix: str = ""
labels: str = ""
vnetSubnetId: str = ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it better use str? type which has a default value None

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

addressed

vnetSubnetId?: str
osSKU?: str

CreateNodePool = lambda serviceConnection: str, cluster: str, resourceGroup: str, subscription: str, pool: NodePool, noWait: bool = False -> steps.Step {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The list of parameters becomes longer and longer. I wonder if it makes sense to let users to write a az aks command directly instead? The wrapper is only meaningful if it simplify things. now it's just pass through everything.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel it is ok as long as we don't add more params to CreateNodePool signature. We need schema NodePool to represent CL2 pool / worker pool and pass around. Users will need to configure/enrich NodePool for their use cases. I learnt you can do something like below which does not feel complicated:

  planned = NodePool {
      sku = "Standard_D4"
      count = 3
  }

  configured = NodePool {**planned, vnetSubnetId = "my_subnet_id"}


CreateResourceGroup = lambda serviceConnection: str, name: str, location: str, subscription: str -> steps.Step {
CreateResourceGroup = lambda serviceConnection: str, name: str, location: str, subscription: str, tags: str = "" -> steps.Step {
tagsFlag = " \\\n --tags ${tags}" if tags else ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Normally it's called an argument.

$ az aks create -h
The behavior of this command has been altered by the following extension: aks-preview

Command
    az aks create : Create a new managed Kubernetes cluster.

Arguments
    --name -n                                               [Required] : Name of the managed

az group create \\
--name "${name}" \\
--location "${location}" \\
--subscription "${subscription}"${tagsFlag}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I feel it's more easier to read when you do

az group create \\
  --name "${name}" \\
  --location "${location}" \\
  --subscription "${subscription}" \\n
  ${"--tags " + tags if tags else ""}

Even though it will end up have a training \n

taintPrefix: str = ""
labels: str = ""
vnetSubnetId?: str
osSKU?: str
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

btw what is difference between sku and osSKU? I added sku param to represent the vm size for the node

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.

3 participants