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

Add node labels to kubernetes node pools #422

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

optik-aper
Copy link
Member

@optik-aper optik-aper commented Mar 8, 2024

Description

This PR will add flags and printer output to support node labels in a node pool on create and update via the --node-labels flag.

Test examples

Check the helptext

go run main.go kubenetes create --help

And

go run main.go kubenetes node-pool create --help

Create a cluster with node-labels in the node pool options

 go run main.go kubernetes create --label=cli-flags-test --region="ord" --version="v1.29.2+1" --node-pools="quantity:5,plan:vc2-2c-4gb,label:worker-pool,auto-scaler:true,min-nodes:5,max-nodes:10,node-labels:application=identity-service|worker-size=small"

You'll see some output in the new printer that should show the NODE LABELS like

ID                      8aa47e02-93ea-4caf-be17-28875d79aab0
LABEL                   cli-flags-test
DATE CREATED            2024-03-11T16:45:21+00:00
CLUSTER SUBNET          10.244.0.0/16
SERVICE SUBNET          10.96.0.0/12
IP                      0.0.0.0
ENDPOINT                8aa47e02-93ea-4caf-be17-28875d79aab0.vultr-k8s.com
HIGH AVAIL              false
FIREWALL GROUP ID
VERSION                 v1.29.2+1
REGION                  ord
STATUS                  pending

NODE POOLS
ID              a7604057-e77a-43c3-964b-8b1500ca47e5
DATE CREATED    2024-03-11T16:45:22+00:00
DATE UPDATED    2024-03-11T16:45:29+00:00
LABEL           worker-pool
TAG
PLAN            vc2-2c-4gb
STATUS          pending
NODE QUANTITY   5
AUTO SCALER     true
MIN NODES       5
MAX NODES       10

NODES
ID                                      DATE CREATED                    LABEL                           STATUS
e67a1c96-7053-459e-a223-d25b764539ca    2024-03-11T16:45:22+00:00       worker-pool-6e205ba343c1        pending
7c90c559-9355-44f9-a6c1-01fc9fb3a54d    2024-03-11T16:45:23+00:00       worker-pool-31beaf0b119a        pending
f802609d-a73e-41cd-a10b-00fc370abc1c    2024-03-11T16:45:25+00:00       worker-pool-2b2167de1209        pending
fcb6305f-70eb-4981-848e-12c2dee046cc    2024-03-11T16:45:26+00:00       worker-pool-288ba7da6f2a        pending
c90bbd98-22bc-4e29-b1f9-0a154fdcdadd    2024-03-11T16:45:28+00:00       worker-pool-9a7f98894a86        pending

NODE LABELS
worker-size=small
application=identity-service

Create a new node pool on an existing cluster with the --node-labels flag

go run main.go kubernetes node-pool create 8aa47e02-93ea-4caf-be17-28875d79aab0 --plan="vc2-1c-2gb" --quantity=3 --label="second-np" --auto-scaler=true --min-nodes=1 --max-nodes=3 --node-labels="application=relay-service,worker-size=tiny"

And you should see something like:

ID              47734a62-6146-7747-5337-436f2b554852
DATE CREATED    2024-03-11T17:04:06+00:00
DATE UPDATED    2024-03-11T17:04:10+00:00
LABEL           second-np
TAG
PLAN            vc2-1c-2gb
STATUS          pending
NODE QUANTITY   3
AUTO SCALER     true
MIN NODES       1
MAX NODES       3

NODES
ID                                      DATE CREATED                    LABEL                   STATUS
58824dbe-e9fe-483b-aeb1-1135c122a7ca    2024-03-11T17:04:06+00:00       second-np-1e0d1fceadf6  pending
b9a6583c-3f29-47ce-89ce-7a511f0c4689    2024-03-11T17:04:07+00:00       second-np-b33dd2038272  pending
ad8d7561-4e1e-49c6-96df-0fe312bef8d9    2024-03-11T17:04:09+00:00       second-np-057b068f2158  pending

NODE LABELS
application=relay-service
worker-size=tiny

Checklist:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you linted your code locally prior to submission?
  • Have you successfully ran tests with your changes locally?

@optik-aper optik-aper added the enhancement New feature or request label Mar 8, 2024
@optik-aper optik-aper self-assigned this Mar 8, 2024
Copy link

github-actions bot commented Mar 8, 2024

Unit Tests and Coverage

Show Output
?   	github.com/vultr/vultr-cli/v3	[no test files]

Pusher: @optik-aper, Action: pull_request_target

Copy link

Unit Tests and Coverage

Show Output
?   	github.com/vultr/vultr-cli/v3	[no test files]

Pusher: @optik-aper, Action: pull_request_target

Copy link

Unit Tests and Coverage

Show Output
?   	github.com/vultr/vultr-cli/v3	[no test files]

Pusher: @optik-aper, Action: pull_request_target

Copy link
Contributor

@christhemorse christhemorse left a comment

Choose a reason for hiding this comment

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

HYB

@optik-aper optik-aper merged commit f566d86 into vultr:master Mar 11, 2024
4 checks passed
@optik-aper optik-aper mentioned this pull request Mar 12, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants