Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ const (
ArgClusterAutoscalerExpanders = "expanders"
// ArgEnableRoutingAgent enables the routing-agent cluster plugin.
ArgEnableRoutingAgent = "enable-routing-agent"
// ArgEnablePeerToPeerOciRegistryPlugin enables the Peer-to-peer OCI registry cluster plugin.
ArgEnablePeerToPeerOciRegistryPlugin = "enable-peer-to-peer-oci-registry-plugin"
// ArgEnableCorednsAutoscaler enables the CoreDNS Autoscaler cluster plugin.
ArgEnableCorednsAutoscaler = "enable-coredns-autoscaler"
// ArgEnableAmdGpuDevicePlugin enables automatic amd gpu device plugin installation.
Expand Down
6 changes: 5 additions & 1 deletion commands/displayers/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"io"
"strings"

"github.com/digitalocean/doctl/do"
"github.com/digitalocean/godo"

"github.com/digitalocean/doctl/do"
)

type KubernetesClusters struct {
Expand Down Expand Up @@ -52,6 +53,7 @@ func (clusters *KubernetesClusters) Cols() []string {
"Autoscaler.UnneededTime",
"Autoscaler.Expanders",
"RoutingAgent",
"PeerToPeerOciRegistryPlugin",
"CorednsAutoscaler",
"AmdGpuDevicePlugin",
"AmdGpuDeviceMetricsExporterPlugin",
Expand Down Expand Up @@ -92,6 +94,7 @@ func (clusters *KubernetesClusters) ColMap() map[string]string {
"Autoscaler.UnneededTime": "Autoscaler Scale Down Unneeded Time",
"Autoscaler.Expanders": "Autoscaler Custom Expanders",
"RoutingAgent": "Routing Agent",
"PeerToPeerOciRegistryPlugin": "Peer-to-peer OCI registry Plugin",
"CorednsAutoscaler": "CoreDNS Autoscaler",
"AmdGpuDevicePlugin": "AMD GPU Device Plugin",
"AmdGpuDeviceMetricsExporterPlugin": "AMD GPU Device Metrics Exporter Plugin",
Expand Down Expand Up @@ -133,6 +136,7 @@ func (clusters *KubernetesClusters) KV() []map[string]any {
"Autoscaler.UnneededTime": "",
"Autoscaler.Expanders": "",
"RoutingAgent": cluster.RoutingAgent != nil && *cluster.RoutingAgent.Enabled,
"PeerToPeerOciRegistryPlugin": cluster.P2pOciRegistryPlugin != nil && *cluster.P2pOciRegistryPlugin.Enabled,
"CorednsAutoscaler": cluster.CorednsAutoscaler != nil && *cluster.CorednsAutoscaler.Enabled,
"AmdGpuDevicePlugin": cluster.AmdGpuDevicePlugin != nil && *cluster.AmdGpuDevicePlugin.Enabled,
"AmdGpuDeviceMetricsExporterPlugin": cluster.AmdGpuDeviceMetricsExporterPlugin != nil && *cluster.AmdGpuDeviceMetricsExporterPlugin.Enabled,
Expand Down
24 changes: 24 additions & 0 deletions commands/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ After creating a cluster, a configuration context is added to kubectl and made a
"Customizes expanders used by cluster-autoscaler. The autoscaler will apply each expander from the provided comma-separated list to narrow down the selection of node types created to scale up, until either a single node type is left, or the list of expanders is exhausted. Available expanders: random, least-waste, priority. If this flag is empty, autoscaler will use its default expanders.")
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableRoutingAgent, "", false,
"Creates the cluster with routing-agent enabled. Defaults to false. To enable routing-agent, supply --enable-routing-agent=true.")
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnablePeerToPeerOciRegistryPlugin, "", false,
"Creates the cluster with Peer-to-peer OCI registry plugin enabled. Defaults to false. To enable it, supply --enable-peer-to-peer-oci-registry-plugin=true.")
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableCorednsAutoscaler, "", false,
"Creates the cluster with the CoreDNS Autoscaler enabled, which scales CoreDNS replicas in proportion to the cluster's size. When omitted, API applies version-specific default (true for 1.36.0+; false for older). Use --enable-coredns-autoscaler=false to disable.")
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableAmdGpuDevicePlugin, "", false,
Expand Down Expand Up @@ -391,6 +393,8 @@ Updates the configuration values for a Kubernetes cluster. The cluster must be r
"Creates the cluster with control plane firewall enabled. Defaults to false. To enable the control plane firewall, supply --enable-control-plane-firewall=true.")
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableRoutingAgent, "", false,
"Creates the cluster with routing-agent enabled. Defaults to false. To enable routing-agent, supply --routing-agent=true.")
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnablePeerToPeerOciRegistryPlugin, "", false,
"Creates the cluster with Peer-to-peer OCI registry plugin enabled. Defaults to false. To enable it, supply --enable-peer-to-peer-oci-registry-plugin=true.")
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableCorednsAutoscaler, "", false,
"Creates the cluster with the CoreDNS Autoscaler enabled, which scales CoreDNS replicas in proportion to the cluster's size. When omitted, API applies version-specific default (true for 1.36.0+; false for older). To always enable it, supply --enable-coredns-autoscaler=true.")
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableAmdGpuDevicePlugin, "", false,
Expand Down Expand Up @@ -1855,6 +1859,16 @@ func buildClusterCreateRequestFromArgs(c *CmdConfig, r *godo.KubernetesClusterCr
}
}

enableP2pOciRegistryPlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnablePeerToPeerOciRegistryPlugin)
if err != nil {
return err
}
if enableP2pOciRegistryPlugin != nil {
r.P2pOciRegistryPlugin = &godo.KubernetesP2pOciRegistry{
Enabled: enableP2pOciRegistryPlugin,
}
}

// Only forward the CoreDNS Autoscaler flag when the user explicitly sets it so the
// server-side defaulting (version-based) isn't suppressed by sending an unset "false".
if c.Doit.IsSet(doctl.ArgEnableCorednsAutoscaler) {
Expand Down Expand Up @@ -2086,6 +2100,16 @@ func buildClusterUpdateRequestFromArgs(c *CmdConfig, r *godo.KubernetesClusterUp
}
}

enableP2pOciRegistryPlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnablePeerToPeerOciRegistryPlugin)
if err != nil {
return err
}
if enableP2pOciRegistryPlugin != nil {
r.P2pOciRegistryPlugin = &godo.KubernetesP2pOciRegistry{
Enabled: enableP2pOciRegistryPlugin,
}
}

// Only forward the CoreDNS Autoscaler flag when the user explicitly sets it so we don't
// disable existing state on a no-op update by sending an unset "false".
if c.Doit.IsSet(doctl.ArgEnableCorednsAutoscaler) {
Expand Down
15 changes: 15 additions & 0 deletions commands/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ var (
RoutingAgent: &godo.KubernetesRoutingAgent{
Enabled: boolPtr(true),
},
P2pOciRegistryPlugin: &godo.KubernetesP2pOciRegistry{
Enabled: boolPtr(true),
},
AmdGpuDevicePlugin: &godo.KubernetesAmdGpuDevicePlugin{
Enabled: boolPtr(true),
},
Expand Down Expand Up @@ -726,6 +729,9 @@ func TestKubernetesCreate(t *testing.T) {
RoutingAgent: &godo.KubernetesRoutingAgent{
Enabled: boolPtr(true),
},
P2pOciRegistryPlugin: &godo.KubernetesP2pOciRegistry{
Enabled: boolPtr(true),
},
AmdGpuDevicePlugin: &godo.KubernetesAmdGpuDevicePlugin{
Enabled: boolPtr(true),
},
Expand Down Expand Up @@ -772,6 +778,7 @@ func TestKubernetesCreate(t *testing.T) {
config.Doit.Set(config.NS, doctl.ArgClusterAutoscalerScaleDownUnneededTime, testCluster.ClusterAutoscalerConfiguration.ScaleDownUnneededTime)

config.Doit.Set(config.NS, doctl.ArgEnableRoutingAgent, testCluster.RoutingAgent.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnablePeerToPeerOciRegistryPlugin, testCluster.P2pOciRegistryPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDevicePlugin, testCluster.AmdGpuDevicePlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, testCluster.AmdGpuDeviceMetricsExporterPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableNvidiaGpuDevicePlugin, testCluster.NvidiaGpuDevicePlugin.Enabled)
Expand Down Expand Up @@ -889,6 +896,9 @@ func TestKubernetesUpdate(t *testing.T) {
RoutingAgent: &godo.KubernetesRoutingAgent{
Enabled: boolPtr(true),
},
P2pOciRegistryPlugin: &godo.KubernetesP2pOciRegistry{
Enabled: boolPtr(true),
},
AmdGpuDevicePlugin: &godo.KubernetesAmdGpuDevicePlugin{
Enabled: boolPtr(true),
},
Expand Down Expand Up @@ -923,6 +933,7 @@ func TestKubernetesUpdate(t *testing.T) {
config.Doit.Set(config.NS, doctl.ArgClusterAutoscalerScaleDownUtilizationThreshold, testCluster.ClusterAutoscalerConfiguration.ScaleDownUtilizationThreshold)
config.Doit.Set(config.NS, doctl.ArgClusterAutoscalerScaleDownUnneededTime, testCluster.ClusterAutoscalerConfiguration.ScaleDownUnneededTime)
config.Doit.Set(config.NS, doctl.ArgEnableRoutingAgent, testCluster.RoutingAgent.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnablePeerToPeerOciRegistryPlugin, testCluster.P2pOciRegistryPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDevicePlugin, testCluster.AmdGpuDevicePlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, testCluster.AmdGpuDeviceMetricsExporterPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableNvidiaGpuDevicePlugin, testCluster.NvidiaGpuDevicePlugin.Enabled)
Expand Down Expand Up @@ -961,6 +972,9 @@ func TestKubernetesUpdate(t *testing.T) {
RoutingAgent: &godo.KubernetesRoutingAgent{
Enabled: boolPtr(true),
},
P2pOciRegistryPlugin: &godo.KubernetesP2pOciRegistry{
Enabled: boolPtr(true),
},
AmdGpuDevicePlugin: &godo.KubernetesAmdGpuDevicePlugin{
Enabled: boolPtr(true),
},
Expand Down Expand Up @@ -996,6 +1010,7 @@ func TestKubernetesUpdate(t *testing.T) {
config.Doit.Set(config.NS, doctl.ArgClusterAutoscalerScaleDownUtilizationThreshold, testCluster.ClusterAutoscalerConfiguration.ScaleDownUtilizationThreshold)
config.Doit.Set(config.NS, doctl.ArgClusterAutoscalerScaleDownUnneededTime, testCluster.ClusterAutoscalerConfiguration.ScaleDownUnneededTime)
config.Doit.Set(config.NS, doctl.ArgEnableRoutingAgent, testCluster.RoutingAgent.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnablePeerToPeerOciRegistryPlugin, testCluster.P2pOciRegistryPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDevicePlugin, testCluster.AmdGpuDevicePlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, testCluster.AmdGpuDeviceMetricsExporterPlugin.Enabled)
config.Doit.Set(config.NS, doctl.ArgEnableNvidiaGpuDevicePlugin, testCluster.NvidiaGpuDevicePlugin.Enabled)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.25.0
require (
github.com/blang/semver v3.5.1+incompatible
github.com/creack/pty v1.1.21
github.com/digitalocean/godo v1.198.0
github.com/digitalocean/godo v1.199.0
github.com/docker/cli v24.0.5+incompatible
github.com/docker/docker v25.0.6+incompatible
github.com/docker/docker-credential-helpers v0.7.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/digitalocean/godo v1.198.0 h1:jylPVf1efxpOZnTOSc3K4a+Qse9pTl/AHu+GExthMNw=
github.com/digitalocean/godo v1.198.0/go.mod h1:xQsWpVCCbkDrWisHA72hPzPlnC+4W5w/McZY5ij9uvU=
github.com/digitalocean/godo v1.199.0 h1:brSUWakhtutyzNTvRGSvn+lXC7MTg8VA9DGoA6miWXA=
github.com/digitalocean/godo v1.199.0/go.mod h1:xQsWpVCCbkDrWisHA72hPzPlnC+4W5w/McZY5ij9uvU=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v24.0.5+incompatible h1:WeBimjvS0eKdH4Ygx+ihVq1Q++xg36M/rMi4aXAvodc=
Expand Down
4 changes: 2 additions & 2 deletions integration/kubernetes_clusters_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var (
`

k8sGetOutput = `
ID Name Region Version Auto Upgrade HA Control Plane Status Endpoint IPv4 Cluster Subnet Service Subnet Tags Created At Updated At Node Pools Autoscaler Scale Down Utilization Autoscaler Scale Down Unneeded Time Autoscaler Custom Expanders Routing Agent CoreDNS Autoscaler AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
some-cluster-id some-cluster-id nyc3 some-kube-version true false running production 2018-11-15 16:00:11 +0000 UTC 2018-11-15 16:00:11 +0000 UTC frontend-pool 50% 1m30s priority, random false false false false false false
ID Name Region Version Auto Upgrade HA Control Plane Status Endpoint IPv4 Cluster Subnet Service Subnet Tags Created At Updated At Node Pools Autoscaler Scale Down Utilization Autoscaler Scale Down Unneeded Time Autoscaler Custom Expanders Routing Agent Peer-to-peer OCI registry Plugin CoreDNS Autoscaler AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
some-cluster-id some-cluster-id nyc3 some-kube-version true false running production 2018-11-15 16:00:11 +0000 UTC 2018-11-15 16:00:11 +0000 UTC frontend-pool 50% 1m30s priority, random false false false false false false false
`
)
4 changes: 2 additions & 2 deletions integration/projects_resources_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ ID Name Size Region Filesyste
}
`
projectsResourcesGetKubernetesOutput = `
ID Name Region Version Auto Upgrade HA Control Plane Status Endpoint IPv4 Cluster Subnet Service Subnet Tags Created At Updated At Node Pools Autoscaler Scale Down Utilization Autoscaler Scale Down Unneeded Time Autoscaler Custom Expanders Routing Agent CoreDNS Autoscaler AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
1111 false false provisioning k8s 2021-01-29 16:02:02 +0000 UTC 0001-01-01 00:00:00 +0000 UTC pool-test false false false false false false
ID Name Region Version Auto Upgrade HA Control Plane Status Endpoint IPv4 Cluster Subnet Service Subnet Tags Created At Updated At Node Pools Autoscaler Scale Down Utilization Autoscaler Scale Down Unneeded Time Autoscaler Custom Expanders Routing Agent Peer-to-peer OCI registry Plugin CoreDNS Autoscaler AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
1111 false false provisioning k8s 2021-01-29 16:02:02 +0000 UTC 0001-01-01 00:00:00 +0000 UTC pool-test false false false false false false false
`

projectsResourcesListKubernetesOutput = `
Expand Down
4 changes: 4 additions & 0 deletions vendor/github.com/digitalocean/godo/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/digitalocean/godo/godo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/digitalocean/godo/kubernetes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ github.com/creack/pty
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
## explicit
github.com/davecgh/go-spew/spew
# github.com/digitalocean/godo v1.198.0
# github.com/digitalocean/godo v1.199.0
## explicit; go 1.23.0
github.com/digitalocean/godo
github.com/digitalocean/godo/metrics
Expand Down
Loading