Skip to content

Commit 331466d

Browse files
Add support for Lustre CSI Driver on GKE (#14435) (#10413)
[upstream:5a4ec2a3bc64354f947734caaa50c9b638ebe6d1] Signed-off-by: Modular Magician <[email protected]>
1 parent c9f6862 commit 331466d

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-beta/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
"addons_config.0.istio_config",
113114
"addons_config.0.kalm_config",
114115
}
@@ -501,6 +502,29 @@ func ResourceContainerCluster() *schema.Resource {
501502
},
502503
},
503504
},
505+
"lustre_csi_driver_config": {
506+
Type: schema.TypeList,
507+
Optional: true,
508+
Computed: true,
509+
AtLeastOneOf: addonsConfigKeys,
510+
MaxItems: 1,
511+
Description: `Configuration for the Lustre CSI driver. Defaults to disabled; set enabled = true to enable.`,
512+
Elem: &schema.Resource{
513+
Schema: map[string]*schema.Schema{
514+
"enabled": {
515+
Type: schema.TypeBool,
516+
Required: true,
517+
Description: `Whether the Lustre CSI driver is enabled for this cluster.`,
518+
},
519+
"enable_legacy_lustre_port": {
520+
Type: schema.TypeBool,
521+
Optional: true,
522+
Description: `If set to true, the Lustre CSI driver will initialize LNet (the virtual network layer for Lustre kernel module) using port 6988.
523+
This flag is required to workaround a port conflict with the gke-metadata-server on GKE nodes.`,
524+
},
525+
},
526+
},
527+
},
504528
"istio_config": {
505529
Type: schema.TypeList,
506530
Optional: true,
@@ -5251,6 +5275,20 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
52515275
}
52525276
}
52535277

5278+
if v, ok := config["lustre_csi_driver_config"]; ok && len(v.([]interface{})) > 0 {
5279+
lustreConfig := v.([]interface{})[0].(map[string]interface{})
5280+
ac.LustreCsiDriverConfig = &container.LustreCsiDriverConfig{
5281+
Enabled: lustreConfig["enabled"].(bool),
5282+
ForceSendFields: []string{"Enabled"},
5283+
}
5284+
5285+
// Check for enable_legacy_lustre_port
5286+
if val, ok := lustreConfig["enable_legacy_lustre_port"]; ok {
5287+
ac.LustreCsiDriverConfig.EnableLegacyLustrePort = val.(bool)
5288+
ac.LustreCsiDriverConfig.ForceSendFields = append(ac.LustreCsiDriverConfig.ForceSendFields, "EnableLegacyLustrePort")
5289+
}
5290+
}
5291+
52545292
if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
52555293
addon := v.([]interface{})[0].(map[string]interface{})
52565294
ac.IstioConfig = &container.IstioConfig{
@@ -6665,6 +6703,15 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
66656703
},
66666704
}
66676705
}
6706+
if c.LustreCsiDriverConfig != nil {
6707+
lustreConfig := c.LustreCsiDriverConfig
6708+
result["lustre_csi_driver_config"] = []map[string]interface{}{
6709+
{
6710+
"enabled": lustreConfig.Enabled,
6711+
"enable_legacy_lustre_port": lustreConfig.EnableLegacyLustrePort,
6712+
},
6713+
}
6714+
}
66686715

66696716
if c.IstioConfig != nil {
66706717
result["istio_config"] = []map[string]interface{}{

google-beta/services/container/resource_container_cluster_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6882,6 +6882,9 @@ resource "google_container_cluster" "primary" {
68826882
parallelstore_csi_driver_config {
68836883
enabled = false
68846884
}
6885+
lustre_csi_driver_config {
6886+
enabled = false
6887+
}
68856888
istio_config {
68866889
disabled = true
68876890
auth = "AUTH_MUTUAL_TLS"
@@ -6955,8 +6958,12 @@ resource "google_container_cluster" "primary" {
69556958
enabled = true
69566959
}
69576960
}
6958-
parallelstore_csi_driver_config {
6961+
parallelstore_csi_driver_config {
6962+
enabled = true
6963+
}
6964+
lustre_csi_driver_config {
69596965
enabled = true
6966+
enable_legacy_lustre_port=true
69606967
}
69616968
istio_config {
69626969
disabled = false

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)