Skip to content

Commit d68b533

Browse files
authored
Merge branch 'main' into nix-docs
2 parents e2e8f71 + 226acd4 commit d68b533

6 files changed

Lines changed: 104 additions & 5 deletions

File tree

args.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ const (
157157
ArgEnableAmdGpuDevicePlugin = "enable-amd-gpu-device-plugin"
158158
// ArgEnableAmdGpuDeviceMetricsExporterPlugin enables automatic amd gpu device metrics exporter plugin installation.
159159
ArgEnableAmdGpuDeviceMetricsExporterPlugin = "enable-amd-gpu-device-metrics-exporter-plugin"
160+
// ArgEnableNvidiaGpuDevicePlugin enables automatic NVIDIA gpu device plugin installation.
161+
ArgEnableNvidiaGpuDevicePlugin = "enable-nvidia-gpu-device-plugin"
162+
// ArgEnableRDMASharedDevicePlugin enables automatic NVIDIA gpu device plugin installation.
163+
ArgEnableRDMASharedDevicePlugin = "enable-rdma-shared-device-plugin"
160164
// ArgSurgeUpgrade is a cluster's surge-upgrade argument.
161165
ArgSurgeUpgrade = "surge-upgrade"
162166
// ArgCommandUpsert is an upsert for a resource to be created or updated argument.

commands/displayers/kubernetes.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func (clusters *KubernetesClusters) Cols() []string {
5454
"RoutingAgent",
5555
"AmdGpuDevicePlugin",
5656
"AmdGpuDeviceMetricsExporterPlugin",
57+
"NvidiaGpuDevicePlugin",
58+
"RDMASharedDevicePlugin",
5759
}
5860
}
5961

@@ -91,6 +93,8 @@ func (clusters *KubernetesClusters) ColMap() map[string]string {
9193
"RoutingAgent": "Routing Agent",
9294
"AmdGpuDevicePlugin": "AMD GPU Device Plugin",
9395
"AmdGpuDeviceMetricsExporterPlugin": "AMD GPU Device Metrics Exporter Plugin",
96+
"NvidiaGpuDevicePlugin": "NVIDIA GPU Device Plugin",
97+
"RDMASharedDevicePlugin": "RDMA Shared Device Plugin",
9498
}
9599
}
96100

@@ -129,6 +133,8 @@ func (clusters *KubernetesClusters) KV() []map[string]any {
129133
"RoutingAgent": cluster.RoutingAgent != nil && *cluster.RoutingAgent.Enabled,
130134
"AmdGpuDevicePlugin": cluster.AmdGpuDevicePlugin != nil && *cluster.AmdGpuDevicePlugin.Enabled,
131135
"AmdGpuDeviceMetricsExporterPlugin": cluster.AmdGpuDeviceMetricsExporterPlugin != nil && *cluster.AmdGpuDeviceMetricsExporterPlugin.Enabled,
136+
"NvidiaGpuDevicePlugin": cluster.NvidiaGpuDevicePlugin != nil && *cluster.NvidiaGpuDevicePlugin.Enabled,
137+
"RDMASharedDevicePlugin": cluster.RdmaSharedDevicePlugin != nil && *cluster.RdmaSharedDevicePlugin.Enabled,
132138
}
133139

134140
if cfg := cluster.ClusterAutoscalerConfiguration; cfg != nil {

commands/kubernetes.go

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ After creating a cluster, a configuration context is added to kubectl and made a
303303
"Creates the cluster with amd gpu device plugin installed. Defaults to true for clusters with AMD GPUs and otherwise false. To always enable it, supply --enable-amd-gpu-device-plugin=true.")
304304
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, "", false,
305305
"Creates the cluster with amd gpu device metrics exporter plugin installed. Defaults to false. To enable it, supply --enable-amd-gpu-device-metrics-exporter-plugin=true.")
306+
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableNvidiaGpuDevicePlugin, "", false,
307+
"Creates the cluster with nvidia gpu device plugin installed. Defaults to true for clusters with NVIDIA GPUs and otherwise false. To always enable it, supply --enable-nvidia-gpu-device-plugin=true.")
308+
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgEnableRDMASharedDevicePlugin, "", false,
309+
"Creates the cluster with k8s-rdma-shared-dev-plugin device plugin installed. Defaults to true for clusters with GPU nodes connected to a dedicated high-speed networking fabric. To always enable it, supply --enable-rdma-shared-device-plugin=true.")
306310
AddStringSliceFlag(cmdKubeClusterCreate, doctl.ArgTag, "", nil,
307311
"A comma-separated list of `tags` to apply to the cluster, in addition to the default tags of `k8s` and `k8s:$K8S_CLUSTER_ID`.")
308312
AddStringFlag(cmdKubeClusterCreate, doctl.ArgSizeSlug, "",
@@ -357,6 +361,10 @@ Updates the configuration values for a Kubernetes cluster. The cluster must be r
357361
"Creates the cluster with amd gpu device plugin installed. Defaults to true for clusters with AMD GPUs and otherwise false. To always enable it, supply --enable-amd-gpu-device-plugin=true.")
358362
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, "", false,
359363
"Creates the cluster with amd gpu device metrics exporter plugin installed. Defaults to false. To enable it, supply --enable-amd-gpu-device-metrics-exporter-plugin=true.")
364+
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableNvidiaGpuDevicePlugin, "", false,
365+
"Creates the cluster with nvidia gpu device plugin installed. Defaults to true for clusters with NVIDIA GPUs and otherwise false. To always enable it, supply --enable-nvidia-gpu-device-plugin=true.")
366+
AddBoolFlag(cmdKubeClusterUpdate, doctl.ArgEnableRDMASharedDevicePlugin, "", false,
367+
"Creates the cluster with k8s-rdma-shared-dev-plugin device plugin installed. Defaults to true for clusters with GPU nodes connected to a dedicated high-speed networking fabric. To always enable it, supply --enable-rdma-shared-device-plugin=true.")
360368
AddStringFlag(cmdKubeClusterUpdate, doctl.ArgClusterAutoscalerScaleDownUtilizationThreshold, "", "",
361369
"The threshold value for the cluster autoscaler's scale-down-utilization-threshold. It is the maximum value between the sum of CPU requests and sum of memory requests of all pods running on the node divided by node's corresponding allocatable resource, below which a node can be considered for scale down. To set the scale-down-utilization-threshold to 50%, pass the floating point value 0.5.")
362370
AddStringFlag(cmdKubeClusterUpdate, doctl.ArgClusterAutoscalerScaleDownUnneededTime, "", "",
@@ -1726,7 +1734,6 @@ func buildClusterCreateRequestFromArgs(c *CmdConfig, r *godo.KubernetesClusterCr
17261734

17271735
// We need to differentiate here if the option is set or not, as it defaults to a different value on the server-side
17281736
// depending on whether there are AMD GPU nodes in the cluster or not.
1729-
//
17301737
// If we would always send "false", even if the flag isn't set, we would essentially disable the defaulting.
17311738
if c.Doit.IsSet(doctl.ArgEnableAmdGpuDevicePlugin) {
17321739
enableAmdGpuDevicePlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnableAmdGpuDevicePlugin)
@@ -1750,6 +1757,36 @@ func buildClusterCreateRequestFromArgs(c *CmdConfig, r *godo.KubernetesClusterCr
17501757
}
17511758
}
17521759

1760+
// We need to differentiate here if the option is set or not, as it defaults to a different value on the server-side
1761+
// depending on whether there are NVIDIA GPU nodes in the cluster or not.
1762+
// If we would always send "false", even if the flag isn't set, we would essentially disable the defaulting.
1763+
if c.Doit.IsSet(doctl.ArgEnableNvidiaGpuDevicePlugin) {
1764+
enableNvidiaGpuDevicePlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnableNvidiaGpuDevicePlugin)
1765+
if err != nil {
1766+
return err
1767+
}
1768+
if enableNvidiaGpuDevicePlugin != nil {
1769+
r.NvidiaGpuDevicePlugin = &godo.KubernetesNvidiaGpuDevicePlugin{
1770+
Enabled: enableNvidiaGpuDevicePlugin,
1771+
}
1772+
}
1773+
}
1774+
1775+
// We need to differentiate here if the option is set or not, as it defaults to a different value on the server-side
1776+
// depending on whether there are fabric connected GPU nodes in the cluster or not.
1777+
// If we would always send "false", even if the flag isn't set, we would essentially disable the defaulting.
1778+
if c.Doit.IsSet(doctl.ArgEnableRDMASharedDevicePlugin) {
1779+
enableRDMASharedDevicePlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnableRDMASharedDevicePlugin)
1780+
if err != nil {
1781+
return err
1782+
}
1783+
if enableRDMASharedDevicePlugin != nil {
1784+
r.RdmaSharedDevicePlugin = &godo.KubernetesRdmaSharedDevicePlugin{
1785+
Enabled: enableRDMASharedDevicePlugin,
1786+
}
1787+
}
1788+
}
1789+
17531790
var clusterAutoscalerConfiguration = &godo.KubernetesClusterAutoscalerConfiguration{}
17541791
thresholdStr, err := c.Doit.GetString(c.NS, doctl.ArgClusterAutoscalerScaleDownUtilizationThreshold)
17551792
if err != nil {
@@ -1933,6 +1970,36 @@ func buildClusterUpdateRequestFromArgs(c *CmdConfig, r *godo.KubernetesClusterUp
19331970
}
19341971
}
19351972

1973+
// We need to differentiate here if the option is set or not, as it defaults to a different value on the server-side
1974+
// depending on whether there are NVIDIA GPU nodes in the cluster or not.
1975+
// If we would always send "false", even if the flag isn't set, we would essentially disable the defaulting.
1976+
if c.Doit.IsSet(doctl.ArgEnableNvidiaGpuDevicePlugin) {
1977+
enableNvidiaGpuDevicePlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnableNvidiaGpuDevicePlugin)
1978+
if err != nil {
1979+
return err
1980+
}
1981+
if enableNvidiaGpuDevicePlugin != nil {
1982+
r.NvidiaGpuDevicePlugin = &godo.KubernetesNvidiaGpuDevicePlugin{
1983+
Enabled: enableNvidiaGpuDevicePlugin,
1984+
}
1985+
}
1986+
}
1987+
1988+
// We need to differentiate here if the option is set or not, as it defaults to a different value on the server-side
1989+
// depending on whether there are fabric connected GPU nodes in the cluster or not.
1990+
// If we would always send "false", even if the flag isn't set, we would essentially disable the defaulting.
1991+
if c.Doit.IsSet(doctl.ArgEnableRDMASharedDevicePlugin) {
1992+
enableRDMASharedDevicePlugin, err := c.Doit.GetBoolPtr(c.NS, doctl.ArgEnableRDMASharedDevicePlugin)
1993+
if err != nil {
1994+
return err
1995+
}
1996+
if enableRDMASharedDevicePlugin != nil {
1997+
r.RdmaSharedDevicePlugin = &godo.KubernetesRdmaSharedDevicePlugin{
1998+
Enabled: enableRDMASharedDevicePlugin,
1999+
}
2000+
}
2001+
}
2002+
19362003
var clusterAutoscalerConfiguration = &godo.KubernetesClusterAutoscalerConfiguration{}
19372004
thresholdStr, err := c.Doit.GetString(c.NS, doctl.ArgClusterAutoscalerScaleDownUtilizationThreshold)
19382005
if err != nil {

commands/kubernetes_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ var (
5454
AmdGpuDeviceMetricsExporterPlugin: &godo.KubernetesAmdGpuDeviceMetricsExporterPlugin{
5555
Enabled: boolPtr(true),
5656
},
57+
NvidiaGpuDevicePlugin: &godo.KubernetesNvidiaGpuDevicePlugin{
58+
Enabled: boolPtr(true),
59+
},
60+
RdmaSharedDevicePlugin: &godo.KubernetesRdmaSharedDevicePlugin{
61+
Enabled: boolPtr(true),
62+
},
5763
},
5864
}
5965

@@ -541,6 +547,12 @@ func TestKubernetesCreate(t *testing.T) {
541547
AmdGpuDeviceMetricsExporterPlugin: &godo.KubernetesAmdGpuDeviceMetricsExporterPlugin{
542548
Enabled: boolPtr(true),
543549
},
550+
NvidiaGpuDevicePlugin: &godo.KubernetesNvidiaGpuDevicePlugin{
551+
Enabled: boolPtr(true),
552+
},
553+
RdmaSharedDevicePlugin: &godo.KubernetesRdmaSharedDevicePlugin{
554+
Enabled: boolPtr(true),
555+
},
544556
}
545557
tm.kubernetes.EXPECT().Create(&r).Return(&testCluster, nil)
546558

@@ -570,6 +582,8 @@ func TestKubernetesCreate(t *testing.T) {
570582
config.Doit.Set(config.NS, doctl.ArgEnableRoutingAgent, testCluster.RoutingAgent.Enabled)
571583
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDevicePlugin, testCluster.AmdGpuDevicePlugin.Enabled)
572584
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, testCluster.AmdGpuDeviceMetricsExporterPlugin.Enabled)
585+
config.Doit.Set(config.NS, doctl.ArgEnableNvidiaGpuDevicePlugin, testCluster.NvidiaGpuDevicePlugin.Enabled)
586+
config.Doit.Set(config.NS, doctl.ArgEnableRDMASharedDevicePlugin, testCluster.RdmaSharedDevicePlugin.Enabled)
573587

574588
// Test with no vpc-uuid specified
575589
err := testK8sCmdService().RunKubernetesClusterCreate("c-8", 3)(config)
@@ -637,6 +651,12 @@ func TestKubernetesUpdate(t *testing.T) {
637651
AmdGpuDeviceMetricsExporterPlugin: &godo.KubernetesAmdGpuDeviceMetricsExporterPlugin{
638652
Enabled: boolPtr(true),
639653
},
654+
NvidiaGpuDevicePlugin: &godo.KubernetesNvidiaGpuDevicePlugin{
655+
Enabled: boolPtr(true),
656+
},
657+
RdmaSharedDevicePlugin: &godo.KubernetesRdmaSharedDevicePlugin{
658+
Enabled: boolPtr(true),
659+
},
640660
}
641661
tm.kubernetes.EXPECT().Update(testCluster.ID, &r).Return(&testCluster, nil)
642662

@@ -653,6 +673,8 @@ func TestKubernetesUpdate(t *testing.T) {
653673
config.Doit.Set(config.NS, doctl.ArgEnableRoutingAgent, testCluster.RoutingAgent.Enabled)
654674
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDevicePlugin, testCluster.AmdGpuDevicePlugin.Enabled)
655675
config.Doit.Set(config.NS, doctl.ArgEnableAmdGpuDeviceMetricsExporterPlugin, testCluster.AmdGpuDeviceMetricsExporterPlugin.Enabled)
676+
config.Doit.Set(config.NS, doctl.ArgEnableNvidiaGpuDevicePlugin, testCluster.NvidiaGpuDevicePlugin.Enabled)
677+
config.Doit.Set(config.NS, doctl.ArgEnableRDMASharedDevicePlugin, testCluster.RdmaSharedDevicePlugin.Enabled)
656678

657679
err := testK8sCmdService().RunKubernetesClusterUpdate(config)
658680
assert.NoError(t, err)

integration/kubernetes_clusters_get_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ var (
117117
`
118118

119119
k8sGetOutput = `
120-
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 AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin
121-
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
120+
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 AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
121+
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
122122
`
123123
)

integration/projects_resources_get_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ ID Name Size Region Filesyste
343343
}
344344
`
345345
projectsResourcesGetKubernetesOutput = `
346-
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 AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin
347-
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
346+
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 AMD GPU Device Plugin AMD GPU Device Metrics Exporter Plugin NVIDIA GPU Device Plugin RDMA Shared Device Plugin
347+
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
348348
`
349349

350350
projectsResourcesListKubernetesOutput = `

0 commit comments

Comments
 (0)