Skip to content

Commit 3230d7c

Browse files
Add support for Lustre CSI Driver on GKE (#14435) (#23729)
[upstream:5a4ec2a3bc64354f947734caaa50c9b638ebe6d1] Signed-off-by: Modular Magician <[email protected]>
1 parent 354e3b8 commit 3230d7c

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-1
lines changed

.changelog/14435.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: added `addons_config.lustre_csi_driver_config` field to `google_container_cluster` resource
3+
```

google/services/container/resource_container_cluster.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ var (
109109
"addons_config.0.stateful_ha_config",
110110
"addons_config.0.ray_operator_config",
111111
"addons_config.0.parallelstore_csi_driver_config",
112+
"addons_config.0.lustre_csi_driver_config",
112113
}
113114

114115
privateClusterConfigKeys = []string{
@@ -499,6 +500,29 @@ func ResourceContainerCluster() *schema.Resource {
499500
},
500501
},
501502
},
503+
"lustre_csi_driver_config": {
504+
Type: schema.TypeList,
505+
Optional: true,
506+
Computed: true,
507+
AtLeastOneOf: addonsConfigKeys,
508+
MaxItems: 1,
509+
Description: `Configuration for the Lustre CSI driver. Defaults to disabled; set enabled = true to enable.`,
510+
Elem: &schema.Resource{
511+
Schema: map[string]*schema.Schema{
512+
"enabled": {
513+
Type: schema.TypeBool,
514+
Required: true,
515+
Description: `Whether the Lustre CSI driver is enabled for this cluster.`,
516+
},
517+
"enable_legacy_lustre_port": {
518+
Type: schema.TypeBool,
519+
Optional: true,
520+
Description: `If set to true, the Lustre CSI driver will initialize LNet (the virtual network layer for Lustre kernel module) using port 6988.
521+
This flag is required to workaround a port conflict with the gke-metadata-server on GKE nodes.`,
522+
},
523+
},
524+
},
525+
},
502526
"config_connector_config": {
503527
Type: schema.TypeList,
504528
Optional: true,
@@ -4947,6 +4971,20 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
49474971
}
49484972
}
49494973

4974+
if v, ok := config["lustre_csi_driver_config"]; ok && len(v.([]interface{})) > 0 {
4975+
lustreConfig := v.([]interface{})[0].(map[string]interface{})
4976+
ac.LustreCsiDriverConfig = &container.LustreCsiDriverConfig{
4977+
Enabled: lustreConfig["enabled"].(bool),
4978+
ForceSendFields: []string{"Enabled"},
4979+
}
4980+
4981+
// Check for enable_legacy_lustre_port
4982+
if val, ok := lustreConfig["enable_legacy_lustre_port"]; ok {
4983+
ac.LustreCsiDriverConfig.EnableLegacyLustrePort = val.(bool)
4984+
ac.LustreCsiDriverConfig.ForceSendFields = append(ac.LustreCsiDriverConfig.ForceSendFields, "EnableLegacyLustrePort")
4985+
}
4986+
}
4987+
49504988
return ac
49514989
}
49524990

@@ -6228,6 +6266,15 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
62286266
},
62296267
}
62306268
}
6269+
if c.LustreCsiDriverConfig != nil {
6270+
lustreConfig := c.LustreCsiDriverConfig
6271+
result["lustre_csi_driver_config"] = []map[string]interface{}{
6272+
{
6273+
"enabled": lustreConfig.Enabled,
6274+
"enable_legacy_lustre_port": lustreConfig.EnableLegacyLustrePort,
6275+
},
6276+
}
6277+
}
62316278

62326279
return []map[string]interface{}{result}
62336280
}

google/services/container/resource_container_cluster_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6467,6 +6467,9 @@ resource "google_container_cluster" "primary" {
64676467
parallelstore_csi_driver_config {
64686468
enabled = false
64696469
}
6470+
lustre_csi_driver_config {
6471+
enabled = false
6472+
}
64706473
}
64716474
network = "%s"
64726475
subnetwork = "%s"
@@ -6533,8 +6536,12 @@ resource "google_container_cluster" "primary" {
65336536
enabled = true
65346537
}
65356538
}
6536-
parallelstore_csi_driver_config {
6539+
parallelstore_csi_driver_config {
6540+
enabled = true
6541+
}
6542+
lustre_csi_driver_config {
65376543
enabled = true
6544+
enable_legacy_lustre_port=true
65386545
}
65396546
}
65406547
network = "%s"

website/docs/r/container_cluster.html.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,15 @@ Fleet configuration for the cluster. Structure is [documented below](#nested_fle
527527
It is enabled by default for Autopilot clusters with version 1.29 or later; set `enabled = true` to enable it explicitly.
528528
See [Enable the Parallelstore CSI driver](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/parallelstore-csi-new-volume#enable) for more information.
529529

530+
* `lustre_csi_driver_config` - (Optional) The status of the Lustre CSI driver addon,
531+
which allows the usage of a Lustre instances as volumes.
532+
It is disabled by default for Standard clusters; set `enabled = true` to enable.
533+
It is disabled by default for Autopilot clusters; set `enabled = true` to enable.
534+
Lustre CSI Driver Config has optional subfield
535+
`enable_legacy_lustre_port` which allows the Lustre CSI driver to initialize LNet (the virtual networklayer for Lustre kernel module) using port 6988.
536+
This flag is required to workaround a port conflict with the gke-metadata-server on GKE nodes.
537+
See [Enable Lustre CSI driver](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/lustre-csi-driver-new-volume) for more information.
538+
530539
This example `addons_config` disables two addons:
531540

532541
```hcl

0 commit comments

Comments
 (0)