Skip to content

Pass --machine-type and --disable-autoconfig flags from driver to gcsfuse#553

Merged
hungnguyen243 merged 1 commit intoGoogleCloudPlatform:mainfrom
hungnguyen243:passMachineTypeToGCSFuse
May 5, 2025
Merged

Pass --machine-type and --disable-autoconfig flags from driver to gcsfuse#553
hungnguyen243 merged 1 commit intoGoogleCloudPlatform:mainfrom
hungnguyen243:passMachineTypeToGCSFuse

Conversation

@hungnguyen243
Copy link
Copy Markdown
Contributor

@hungnguyen243 hungnguyen243 commented Apr 8, 2025

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

What this PR does / why we need it:

This PR bumped gcsfuse binary to v2.12.0-gke-0, where the the new two mountOptions start to be supported. Note that gcsfuse receives these flags but will not turn on the default values until v3.

Summary of changes:

As part of GCSFuse's intelligent defaults, new mountOption flags are supported: --machine-type and --disable-autoconfig.
We want to pass these two flags over from the driver to GCSFuse in the following mechanism:

  1. --machine-type: The driver has existing mechanism to get Node objects from K8s server starting from v1.14.0. We're fetching the node object inside NodePublishVolume, get the instance-type label,
  2. --disable-autoconfig: This will be a new driver flag, defaulted to 'false', and added to driver's config, which is accessible from inside NodePublishVolume. This flag denotes whether gcsfuse will apply the machine-type based intelligent defaults.

Both flags are then written as a line-separated map to a temporary file under targetPath, which will be read by the sidecar container upon startup. The sidecar parses the file, reconstructs the map, and merges this map into the config file map. This approach is extensible, allowing us to add any new flag that we want to pass from the GCSFuse Driver container to the sidecar container and ultimately to the GCSFuse process.

Note that the PR also wraps the flag-writing logic on the driver behind a sidecar version filter, which checks that the sidecar container is a managed sidecar and on a compatible version (linked to a gcsfuse binary where the new flags are supported). This is to ensure that the file won't be unnecessarily written by the driver if not ultimately consumable by the sidecar (in the case of old/private sidecars). This minimum version is currently using a placeholder of v1.99.0-gke.0 in this PR, and we'll update this with the exact value after we completed the first round of release and get the corresponding sidecar image's version.

Testing:

Flag-passing functionality testing:

The PR has been tested both manually and with two new E2E tests by checking the GCSFuse config logged by the sidecar container:

  1. Test that --machine-type and --disable-autoconfig=false (using driver's default value) are passed correctly to GCSFuse
  2. Test that --machine-type and --disable-autoconfig=true (overwritten by the user pod's mountOptions) are passed correctly to GCSFuse

I ran these E2E tests with driver code built without the sidecar version filter, and made sure they're WAI: https://paste.googleplex.com/4777435008335872

Sidecar version filter testing:

  1. Added unit tests for sidecar version check for all possible scenarios (compatible managed sidecar, old managed sidecar, private sidecar)
  2. Tested that existing E2E tests for custom sidecars with an older gcsfuse tag are passing, and the flag file is not written by the driver (by checking driver's logs).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Pass --machine-type and --disable-autoconfig flags to gcsfuse to enable intelligent defaults on GCSFuse for high-performance machine types.

@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch 5 times, most recently from f545fec to ad03a5f Compare April 16, 2025 23:50
@hungnguyen243 hungnguyen243 changed the title Pass machine type to gcs fuse Pass --machine-type and --disable-autoconfig flags from driver to gcsfuse Apr 17, 2025
@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from e4f4e17 to bbbfc2a Compare April 18, 2025 21:07
@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from ca1f7eb to 48e275d Compare April 25, 2025 23:37
Comment thread cmd/sidecar_mounter/main.go Outdated
Comment thread cmd/sidecar_mounter/main.go Outdated
Comment thread pkg/csi_driver/utils.go Outdated
Comment thread pkg/csi_driver/utils.go
Comment thread test/e2e/specs/specs.go Outdated
Comment thread test/e2e/testsuites/mount.go
@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from 8746fc4 to 856e115 Compare May 1, 2025 21:27
@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from e8dc17d to f87b315 Compare May 5, 2025 20:35
Comment thread pkg/csi_driver/node.go Outdated
} else {
klog.Warningf("Unable to fetch target node %v's machine type", node.Name)
}
// }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommented. This was left commented out during testing.

@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from f87b315 to 0c700d8 Compare May 5, 2025 22:40
Comment thread cmd/sidecar_mounter/gcsfuse_binary
…gcsfuse to enable

intelligent defaults for high-performance machine types
@hungnguyen243 hungnguyen243 force-pushed the passMachineTypeToGCSFuse branch from 0c700d8 to c649418 Compare May 5, 2025 22:48
@hungnguyen243 hungnguyen243 merged commit 50231e9 into GoogleCloudPlatform:main May 5, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants