Skip to content

Commit

Permalink
Support for Kubernetes nodepool tags (#164)
Browse files Browse the repository at this point in the history
* add tag support for nodepools

* omitempty for node quantity
  • Loading branch information
ddymko committed Oct 18, 2021
1 parent e56e8f0 commit 2842d7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kubernetes.go
Expand Up @@ -62,6 +62,7 @@ type NodePool struct {
Plan string `json:"plan"`
Status string `json:"status"`
NodeQuantity int `json:"node_quantity"`
Tag string `json:"tag"`
Nodes []Node `json:"nodes"`
}

Expand Down Expand Up @@ -96,11 +97,13 @@ type NodePoolReq struct {
NodeQuantity int `json:"node_quantity"`
Label string `json:"label"`
Plan string `json:"plan"`
Tag string `json:"tag"`
}

// NodePoolReqUpdate struct used to update a node pool
type NodePoolReqUpdate struct {
NodeQuantity int `json:"node_quantity"`
NodeQuantity int `json:"node_quantity,omitempty"`
Tag string `json:"tag,omitempty"`
}

type vkeClustersBase struct {
Expand Down
11 changes: 11 additions & 0 deletions kubernetes_test.go
Expand Up @@ -215,6 +215,7 @@ func TestKubernetesHandler_ListClusters(t *testing.T) {
"label": "my-label-48957292",
"plan": "vc2-1c-2gb",
"status": "pending",
"tag": "mytag",
"node_quantity": 1,
"nodes": [
{
Expand Down Expand Up @@ -263,6 +264,7 @@ func TestKubernetesHandler_ListClusters(t *testing.T) {
Label: "my-label-48957292",
Plan: "vc2-1c-2gb",
Status: "pending",
Tag: "mytag",
NodeQuantity: 1,
Nodes: []Node{
{
Expand Down Expand Up @@ -355,6 +357,7 @@ func TestKubernetesHandler_CreateNodePool(t *testing.T) {
"plan": "vc2-1c-2gb",
"status": "pending",
"node_quantity": 1,
"tag": "mytag",
"nodes": [
{
"id": "3e1ca1e0-25be-4977-907a-3dee42b9bb15",
Expand All @@ -372,6 +375,7 @@ func TestKubernetesHandler_CreateNodePool(t *testing.T) {
NodeQuantity: 1,
Label: "nodepool-48959140",
Plan: "vc2-1c-2gb",
Tag: "mytag",
}
np, err := client.Kubernetes.CreateNodePool(ctx, "1", createReq)
if err != nil {
Expand All @@ -385,6 +389,7 @@ func TestKubernetesHandler_CreateNodePool(t *testing.T) {
Plan: "vc2-1c-2gb",
Status: "pending",
NodeQuantity: 1,
Tag: "mytag",
Nodes: []Node{
{
ID: "3e1ca1e0-25be-4977-907a-3dee42b9bb15",
Expand Down Expand Up @@ -420,6 +425,7 @@ func TestKubernetesHandler_GetNodePool(t *testing.T) {
"plan": "vc2-1c-2gb",
"status": "pending",
"node_quantity": 1,
"tag": "mytag",
"nodes": [
{
"id": "3e1ca1e0-25be-4977-907a-3dee42b9bb15",
Expand All @@ -444,6 +450,7 @@ func TestKubernetesHandler_GetNodePool(t *testing.T) {
Label: "nodepool-48959140",
Plan: "vc2-1c-2gb",
Status: "pending",
Tag: "mytag",
NodeQuantity: 1,
Nodes: []Node{
{
Expand Down Expand Up @@ -480,6 +487,7 @@ func TestKubernetesHandler_ListNodePools(t *testing.T) {
"plan": "vc2-1c-2gb",
"status": "pending",
"node_quantity": 1,
"tag": "mytag",
"nodes": [
{
"id": "3e1ca1e0-25be-4977-907a-3dee42b9bb15",
Expand Down Expand Up @@ -512,6 +520,7 @@ func TestKubernetesHandler_ListNodePools(t *testing.T) {
Label: "nodepool-48959140",
Plan: "vc2-1c-2gb",
Status: "pending",
Tag: "mytag",
NodeQuantity: 1,
Nodes: []Node{
{
Expand Down Expand Up @@ -562,6 +571,7 @@ func TestKubernetesHandler_UpdateNodePool(t *testing.T) {
"plan": "vc2-1c-2gb",
"status": "active",
"node_quantity": 1,
"tag": "mytag",
"nodes": [
{
"id": "f2e11430-76e5-4dc6-a1c9-ef5682c21ddf",
Expand All @@ -588,6 +598,7 @@ func TestKubernetesHandler_UpdateNodePool(t *testing.T) {
Plan: "vc2-1c-2gb",
Status: "active",
NodeQuantity: 1,
Tag: "mytag",
Nodes: []Node{
{
ID: "f2e11430-76e5-4dc6-a1c9-ef5682c21ddf",
Expand Down

0 comments on commit 2842d7d

Please sign in to comment.