|
24 | 24 | ) |
25 | 25 |
|
26 | 26 | const ( |
27 | | - controlPlaneFirewallField = "control_plane_firewall" |
28 | | - routingAgentField = "routing_agent" |
| 27 | + controlPlaneFirewallField = "control_plane_firewall" |
| 28 | + routingAgentField = "routing_agent" |
| 29 | + amdGpuDevicePluginField = "amd_gpu_device_plugin" |
| 30 | + amdGpuDeviceMetricsExporterPlugin = "amd_gpu_device_metrics_exporter_plugin" |
29 | 31 | ) |
30 | 32 |
|
31 | 33 | func ResourceDigitalOceanKubernetesCluster() *schema.Resource { |
@@ -263,6 +265,35 @@ func ResourceDigitalOceanKubernetesCluster() *schema.Resource { |
263 | 265 | }, |
264 | 266 | }, |
265 | 267 | }, |
| 268 | + amdGpuDevicePluginField: { |
| 269 | + Type: schema.TypeList, |
| 270 | + Optional: true, |
| 271 | + Computed: true, |
| 272 | + MaxItems: 1, |
| 273 | + Elem: &schema.Resource{ |
| 274 | + Schema: map[string]*schema.Schema{ |
| 275 | + "enabled": { |
| 276 | + Type: schema.TypeBool, |
| 277 | + Required: true, |
| 278 | + }, |
| 279 | + }, |
| 280 | + }, |
| 281 | + }, |
| 282 | + |
| 283 | + amdGpuDeviceMetricsExporterPlugin: { |
| 284 | + Type: schema.TypeList, |
| 285 | + Optional: true, |
| 286 | + Computed: true, |
| 287 | + MaxItems: 1, |
| 288 | + Elem: &schema.Resource{ |
| 289 | + Schema: map[string]*schema.Schema{ |
| 290 | + "enabled": { |
| 291 | + Type: schema.TypeBool, |
| 292 | + Required: true, |
| 293 | + }, |
| 294 | + }, |
| 295 | + }, |
| 296 | + }, |
266 | 297 | }, |
267 | 298 |
|
268 | 299 | Timeouts: &schema.ResourceTimeout{ |
@@ -404,6 +435,14 @@ func resourceDigitalOceanKubernetesClusterCreate(ctx context.Context, d *schema. |
404 | 435 | opts.RoutingAgent = expandRoutingAgentOpts(routingAgent.([]interface{})) |
405 | 436 | } |
406 | 437 |
|
| 438 | + if amdGpuDevicePlugin, ok := d.GetOk(amdGpuDevicePluginField); ok { |
| 439 | + opts.AmdGpuDevicePlugin = expandAmdGpuDevicePluginOpts(amdGpuDevicePlugin.([]interface{})) |
| 440 | + } |
| 441 | + |
| 442 | + if amdGpuDeviceMetricsExporterPlugin, ok := d.GetOk(amdGpuDeviceMetricsExporterPlugin); ok { |
| 443 | + opts.AmdGpuDeviceMetricsExporterPlugin = expandAmdGpuDeviceMetricsExporterPluginOpts(amdGpuDeviceMetricsExporterPlugin.([]interface{})) |
| 444 | + } |
| 445 | + |
407 | 446 | cluster, _, err := client.Kubernetes.Create(context.Background(), opts) |
408 | 447 | if err != nil { |
409 | 448 | return diag.Errorf("Error creating Kubernetes cluster: %s", err) |
@@ -475,6 +514,14 @@ func digitaloceanKubernetesClusterRead( |
475 | 514 | return diag.Errorf("[DEBUG] Error setting %s - error: %#v", routingAgentField, err) |
476 | 515 | } |
477 | 516 |
|
| 517 | + if err := d.Set(amdGpuDevicePluginField, flattenAmdGpuDevicePluginOpts(cluster.AmdGpuDevicePlugin)); err != nil { |
| 518 | + return diag.Errorf("[DEBUG] Error setting %s - error: %#v", amdGpuDevicePluginField, err) |
| 519 | + } |
| 520 | + |
| 521 | + if err := d.Set(amdGpuDeviceMetricsExporterPlugin, flattenAmdGpuDeviceMetricsExporterPluginOpts(cluster.AmdGpuDeviceMetricsExporterPlugin)); err != nil { |
| 522 | + return diag.Errorf("[DEBUG] Error setting %s - error: %#v", amdGpuDeviceMetricsExporterPlugin, err) |
| 523 | + } |
| 524 | + |
478 | 525 | if err := d.Set("maintenance_policy", flattenMaintPolicyOpts(cluster.MaintenancePolicy)); err != nil { |
479 | 526 | return diag.Errorf("[DEBUG] Error setting maintenance_policy - error: %#v", err) |
480 | 527 | } |
@@ -537,17 +584,19 @@ func resourceDigitalOceanKubernetesClusterUpdate(ctx context.Context, d *schema. |
537 | 584 | client := meta.(*config.CombinedConfig).GodoClient() |
538 | 585 |
|
539 | 586 | // Figure out the changes and then call the appropriate API methods |
540 | | - if d.HasChanges("name", "tags", "auto_upgrade", "surge_upgrade", "maintenance_policy", "ha", controlPlaneFirewallField, "cluster_autoscaler_configuration", routingAgentField) { |
| 587 | + if d.HasChanges("name", "tags", "auto_upgrade", "surge_upgrade", "maintenance_policy", "ha", controlPlaneFirewallField, "cluster_autoscaler_configuration", routingAgentField, amdGpuDevicePluginField, amdGpuDeviceMetricsExporterPlugin) { |
541 | 588 |
|
542 | 589 | opts := &godo.KubernetesClusterUpdateRequest{ |
543 | | - Name: d.Get("name").(string), |
544 | | - Tags: tag.ExpandTags(d.Get("tags").(*schema.Set).List()), |
545 | | - AutoUpgrade: godo.PtrTo(d.Get("auto_upgrade").(bool)), |
546 | | - SurgeUpgrade: d.Get("surge_upgrade").(bool), |
547 | | - HA: godo.PtrTo(d.Get("ha").(bool)), |
548 | | - ControlPlaneFirewall: expandControlPlaneFirewallOpts(d.Get(controlPlaneFirewallField).([]interface{})), |
549 | | - RoutingAgent: expandRoutingAgentOpts(d.Get(routingAgentField).([]interface{})), |
550 | | - ClusterAutoscalerConfiguration: expandCAConfigOptsForUpdate(d.GetChange("cluster_autoscaler_configuration")), |
| 590 | + Name: d.Get("name").(string), |
| 591 | + Tags: tag.ExpandTags(d.Get("tags").(*schema.Set).List()), |
| 592 | + AutoUpgrade: godo.PtrTo(d.Get("auto_upgrade").(bool)), |
| 593 | + SurgeUpgrade: d.Get("surge_upgrade").(bool), |
| 594 | + HA: godo.PtrTo(d.Get("ha").(bool)), |
| 595 | + ControlPlaneFirewall: expandControlPlaneFirewallOpts(d.Get(controlPlaneFirewallField).([]interface{})), |
| 596 | + RoutingAgent: expandRoutingAgentOpts(d.Get(routingAgentField).([]interface{})), |
| 597 | + AmdGpuDevicePlugin: expandAmdGpuDevicePluginOpts(d.Get(amdGpuDevicePluginField).([]interface{})), |
| 598 | + AmdGpuDeviceMetricsExporterPlugin: expandAmdGpuDeviceMetricsExporterPluginOpts(d.Get(amdGpuDeviceMetricsExporterPlugin).([]interface{})), |
| 599 | + ClusterAutoscalerConfiguration: expandCAConfigOptsForUpdate(d.GetChange("cluster_autoscaler_configuration")), |
551 | 600 | } |
552 | 601 |
|
553 | 602 | if maint, ok := d.GetOk("maintenance_policy"); ok { |
|
0 commit comments