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

CON-11810 Implement GetNodePoolTemplate endpoint for DOKS godo client #781

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

dylanrhysscott
Copy link
Contributor

@dylanrhysscott dylanrhysscott commented Feb 7, 2025

Extends the godo public client with new method GetNodePoolTemplate which will be used in assisting CA to scale back up from zero. Created a test project with the following code to verify response is returned as expected

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"github.com/digitalocean/godo"
	"log"
	"os"
)

func main() {
	t := os.Getenv("DIGITALOCEAN_ACCESS_TOKEN")
	if t == "" {
		log.Fatal("no DO token set")
	}
	client := godo.NewFromToken(t)
	tmpl, _, err := client.Kubernetes.GetNodePoolTemplate(context.TODO(), "<some-cluster-uuid>", "<some-node-pool-name>")
	if err != nil {
		log.Fatalf("failed to get template %s", err)
	}
	j, err := json.MarshalIndent(tmpl, "", "   ")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(j))
}

Running the code results in the following response

{
   "cluster_uuid": "<some-cluster-uuid>",
   "name": "<some-node-pool-name>",
   "slug": "s-2vcpu-4gb",
   "template": {
      "capacity": {
         "cpu": 2,
         "memory": "4096Mi",
         "pods": 110
      },
      "allocatable": {
         "cpu": 1390,
         "memory": "2560Mi",
         "pods": 110
      }
   }
}

@dylanrhysscott dylanrhysscott marked this pull request as draft February 7, 2025 16:16
@dylanrhysscott dylanrhysscott marked this pull request as ready for review February 11, 2025 10:52
Copy link
Contributor

@m3co-code m3co-code left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍 LGTM

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