Skip to content

Commit 87a01e6

Browse files
committed
Revert unwanted PRs and commits from v1.21.12 to v1.21.22
1 parent abc2427 commit 87a01e6

File tree

13 files changed

+319
-676
lines changed

13 files changed

+319
-676
lines changed

cmd/csi_driver/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
# Build driver go binary
17-
FROM --platform=$BUILDPLATFORM golang:1.24.11 AS driver-builder
17+
FROM --platform=$BUILDPLATFORM golang:1.24.9 AS driver-builder
1818

1919
ARG STAGINGVERSION
2020
ARG TARGETPLATFORM

cmd/metadata_prefetch/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Build metadata-prefetch go binary
16-
FROM --platform=$BUILDPLATFORM golang:1.24.11 AS metadata-prefetch-builder
16+
FROM --platform=$BUILDPLATFORM golang:1.24.9 AS metadata-prefetch-builder
1717

1818
ARG STAGINGVERSION
1919
ARG TARGETPLATFORM

cmd/sidecar_mounter/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
# Build sidecar-mounter go binary
17-
FROM --platform=$BUILDPLATFORM golang:1.24.11 AS sidecar-mounter-builder
17+
FROM --platform=$BUILDPLATFORM golang:1.24.9 AS sidecar-mounter-builder
1818

1919
ARG STAGINGVERSION
2020
ARG TARGETPLATFORM

cmd/sidecar_mounter/gcsfuse_binary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
gs://gke-release-staging/gcsfuse/v3.6.0-gke.0/gcsfuse_bin
1+
gs://gke-release-staging/gcsfuse/v3.5.6-gke.0/gcsfuse_bin

cmd/webhook/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
# Build webhook go binary
17-
FROM --platform=$BUILDPLATFORM golang:1.24.11 AS webhook-builder
17+
FROM --platform=$BUILDPLATFORM golang:1.24.9 AS webhook-builder
1818

1919
ARG STAGINGVERSION
2020
ARG TARGETPLATFORM

examples/gcsfuse-profiles/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ gcloud storage buckets add-iam-policy-binding gs://${BUCKET_NAME} \
4343
--member="principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/gcs-fuse-csi-driver/sa/gcs-fuse-csi-controller-sa" \
4444
--role="projects/${GCS_PROJECT}/roles/gke.gcsfuse.profileUser"
4545

46-
# 3. Grant access needed to determine zones for anywherecaches:
46+
# 3. Grant the Monitoring Viewer role to the GCSFuse CSI controller in the bucket project.
47+
# This grants read access to monitoring data, including GCS metrics.
48+
gcloud projects add-iam-policy-binding ${GCS_PROJECT} \
49+
--member="principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/gcs-fuse-csi-driver/sa/gcs-fuse-csi-controller-sa" \
50+
--role="roles/monitoring.viewer"
51+
52+
# 4. Grant access needed to determine zones for anywherecaches:
4753
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
4854
--member "principal://iam.googleapis.com/projects/${PROJECT_NUMBER}/locations/global/workloadIdentityPools/${PROJECT_ID}.svc.id.goog/subject/ns/gcs-fuse-csi-driver/sa/gcs-fuse-csi-controller-sa" \
4955
--role "roles/compute.viewer"

examples/gcsfuse-profiles/pv-pvc-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
volumeHandle: test-bucket
3535
# Any parameters set in the StorageClass are overridable with volumeAttributes.
3636
mountOptions:
37-
- only-dir=my-folder
37+
- only-dir=/my-folder/
3838
---
3939
apiVersion: v1
4040
kind: PersistentVolumeClaim

pkg/profiles/recommender.go

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ const (
4141
fuseMemoryAllocatableFactorKey = "fuseMemoryAllocatableFactor"
4242
fuseEphemeralStorageAllocatableFactorKey = "fuseEphemeralStorageAllocatableFactor"
4343

44-
// Default values for StorageClass param keys.
45-
fuseFileCacheMediumPriorityDefaultVal = "gpu:ram|lssd,tpu:ram,general_purpose:ram|lssd"
46-
fuseMemoryAllocatableFactorDefaultVal = "0.7"
47-
fuseEphemeralStorageAllocatableFactorDefaultVal = "0.85"
48-
4944
// Node allocatable resource keys.
5045
nvidiaGpuResourceName = corev1.ResourceName("nvidia.com/gpu")
5146
googleTpuResourceName = corev1.ResourceName("google.com/tpu")
@@ -90,7 +85,6 @@ type ProfileConfig struct {
9085
type pvDetails struct {
9186
numObjects int64 // The number of objects reported by the PV.
9287
totalSizeBytes int64 // The total size in bytes reported by the PV.
93-
locationType string // The location type of the bucket.
9488
name string // The name of the PersistentVolume.
9589
}
9690

@@ -293,14 +287,12 @@ type GCSFuseCSIRecommendationLog struct {
293287
InputSignals struct {
294288
BucketTotalObjects int64 `json:"bucketTotalObjects"`
295289
BucketTotalDataSizeBytes int64 `json:"bucketTotalDataSizeBytes"`
296-
BucketLocationType string `json:"bucketLocationType"`
297290
RequiredFileCacheBytes int64 `json:"requiredFileCacheBytes"`
298291
RequiredMetadataStatCacheBytes int64 `json:"requiredMetadataStatCacheBytes"`
299292
RequiredMetadataTypeCacheBytes int64 `json:"requiredMetadataTypeCacheBytes"`
300293
NodeType string `json:"nodeType"`
301294
NodeAllocatableMemoryBytes int64 `json:"nodeAllocatableMemoryBytes"`
302295
NodeAllocatableEphemeralStorageBytes int64 `json:"nodeAllocatableEphemeralStorageBytes"`
303-
NodeHasEphemeralStorageLSSD bool `json:"nodeHasEphemeralStorageLSSD"`
304296
SidecarLimitMemoryBytes int64 `json:"sidecarLimitMemoryBytes"`
305297
SidecarLimitEphemeralStorageBytes int64 `json:"sidecarLimitEphemeralStorageBytes"`
306298
FuseBudgetMemoryBytes int64 `json:"fuseBudgetMemoryBytes"`
@@ -357,13 +349,11 @@ func logRecommendation(config *ProfileConfig, recommendation *recommendation, re
357349
// Bucket signals
358350
logEntry.InputSignals.BucketTotalObjects = config.pvDetails.numObjects
359351
logEntry.InputSignals.BucketTotalDataSizeBytes = config.pvDetails.totalSizeBytes
360-
logEntry.InputSignals.BucketLocationType = config.pvDetails.locationType
361352

362353
// Node signals
363354
logEntry.InputSignals.NodeType = config.nodeDetails.nodeType
364355
logEntry.InputSignals.NodeAllocatableMemoryBytes = config.nodeDetails.nodeAllocatables.memoryBytes
365356
logEntry.InputSignals.NodeAllocatableEphemeralStorageBytes = config.nodeDetails.nodeAllocatables.ephemeralStorageBytes
366-
logEntry.InputSignals.NodeHasEphemeralStorageLSSD = config.nodeDetails.hasLocalSSDEphemeralStorageAnnotation
367357

368358
// Pod signals
369359
logEntry.InputSignals.SidecarLimitMemoryBytes = config.podDetails.sidecarLimits.memoryBytes
@@ -426,20 +416,21 @@ func (config *ProfileConfig) MergeRecommendedMountOptionsOnMissingKeys(userMount
426416

427417
cacheOptions := []string{}
428418

429-
// Map the recommended cache sizes and medium recommendations to mount options.
430-
// The mount options must be passed, even if they are set to zero, in order to override
431-
// GCSFuse's --profile flag.
432-
for moKey, bytes := range map[string]int64{
433-
metadataStatCacheMaxSizeMiBMountOptionKey: recommendation.metadataStatCacheBytes,
434-
metadataTypeCacheMaxSizeMiBMountOptionKey: recommendation.metadataTypeCacheBytes,
435-
fileCacheSizeMiBMountOptionKey: recommendation.fileCacheBytes,
436-
} {
437-
cacheOptions = append(cacheOptions, fmt.Sprintf("%s:%d", moKey, bytesToMiB(bytes)))
419+
// Map the recommended metadata stat cache size to equivalent mount option.
420+
if recommendation.metadataStatCacheBytes > 0 {
421+
cacheOptions = append(cacheOptions, fmt.Sprintf("%s:%d", metadataStatCacheMaxSizeMiBMountOptionKey, bytesToMiB(recommendation.metadataStatCacheBytes)))
422+
}
423+
424+
// Map the recommended metadata type cache size to equivalent mount option.
425+
if recommendation.metadataTypeCacheBytes > 0 {
426+
cacheOptions = append(cacheOptions, fmt.Sprintf("%s:%d", metadataTypeCacheMaxSizeMiBMountOptionKey, bytesToMiB(recommendation.metadataTypeCacheBytes)))
438427
}
439428

440-
// Only pass the file cache medium if file cache is enabled.
429+
// Map the recommended file cache size & medium to equivalent mount options.
441430
if recommendation.fileCacheBytes > 0 && recommendation.fileCacheMedium != "" {
431+
cacheOptions = append(cacheOptions, fmt.Sprintf("%s:%d", fileCacheSizeMiBMountOptionKey, bytesToMiB(recommendation.fileCacheBytes)))
442432
// Note: File cache medium *must* be delimeted with an "=" sign, since it's an internal CSI flag.
433+
// TODO(urielguzman): Add a sidecar version check in the driver before passing this flag down to the sidecar mounter.
443434
cacheOptions = append(cacheOptions, fmt.Sprintf("%s=%s", util.FileCacheMediumConst, recommendation.fileCacheMedium))
444435
}
445436

@@ -454,15 +445,10 @@ func (config *ProfileConfig) MergeRecommendedMountOptionsOnMissingKeys(userMount
454445
// buildCacheRequirements constructs a cacheRequirements struct based on the provided pvDetails.
455446
// It calculates the ideal sizes for metadata stat, metadata type, and file caches.
456447
func buildCacheRequirements(pvDetails *pvDetails) *cacheRequirements {
457-
requiredFileCacheBytes := pvDetails.totalSizeBytes
458-
if isZonalBucket(pvDetails.locationType) {
459-
klog.Infof("Bucket location type is %q, file cache not required. Disabling file cache.", pvDetails.locationType)
460-
requiredFileCacheBytes = 0
461-
}
462448
return &cacheRequirements{
463449
metadataStatCacheBytes: pvDetails.numObjects * metadataStatCacheBytesPerObject,
464450
metadataTypeCacheBytes: pvDetails.numObjects * metadataTypeCacheBytesPerObject,
465-
fileCacheBytes: requiredFileCacheBytes,
451+
fileCacheBytes: pvDetails.totalSizeBytes,
466452
}
467453
}
468454

@@ -610,11 +596,13 @@ func recommendMetadataCacheSize(config *ProfileConfig, required, memoryBudget in
610596
}
611597

612598
// parseFloatParameterNonNegative extracts a parameter by key from the params map,
613-
// parses it as a float64, and returns an error if the value
614-
// is not a valid float, or the value is negative. If the value is not found, it defaults
615-
// to an internal value.
616-
func parseFloatParameterNonNegative(pv *corev1.PersistentVolume, sc *storagev1.StorageClass, key, defaultVal string) (float64, error) {
617-
stringVal := profilesutil.AttributeWithSCFallback(pv, sc, key, defaultVal)
599+
// parses it as a float64, and returns an error if the key is missing, the value
600+
// is not a valid float, or the value is negative.
601+
func parseFloatParameterNonNegative(pv *corev1.PersistentVolume, sc *storagev1.StorageClass, key string) (float64, error) {
602+
stringVal, ok := profilesutil.AttributeWithSCFallback(pv, sc, key)
603+
if !ok {
604+
return 0, fmt.Errorf("missing %q", key)
605+
}
618606
floatVal, err := strconv.ParseFloat(stringVal, 64)
619607
if err != nil {
620608
return 0, fmt.Errorf("failed to parse %q: %w", key, err)
@@ -712,14 +700,10 @@ func buildPVDetails(
712700
return nil, fmt.Errorf("invalid annotation format on PV %q: %s", pv.Name, errorMsg)
713701
}
714702

715-
// Parse the location type.
716-
locationType := pvAnnotations[profilesutil.AnnotationLocationType]
717-
718703
return &pvDetails{
719704
name: pv.Name,
720705
numObjects: numObjects,
721706
totalSizeBytes: totalSizeBytes,
722-
locationType: locationType,
723707
}, nil
724708
}
725709

@@ -808,20 +792,23 @@ func buildSCDetails(pv *corev1.PersistentVolume, sc *v1.StorageClass, volumeAttr
808792
}
809793

810794
// Get the file cache medium priority from the StorageClass parameters (or PV override).
811-
fileCacheMediumPriorityStr := profilesutil.AttributeWithSCFallback(pv, sc, fuseFileCacheMediumPriorityKey, fuseFileCacheMediumPriorityDefaultVal)
795+
fileCacheMediumPriorityStr, ok := profilesutil.AttributeWithSCFallback(pv, sc, fuseFileCacheMediumPriorityKey)
796+
if !ok {
797+
return nil, fmt.Errorf("missing fuseFileCacheMediumPriority in StorageClass %q", sc.Name)
798+
}
812799
fileCacheMediumPriority, err := parseFileCacheMediumPriority(fileCacheMediumPriorityStr)
813800
if err != nil {
814801
return nil, fmt.Errorf("failed to parse fuseFileCacheMediumPriority in StorageClass %q: %v", sc.Name, err)
815802
}
816803

817804
// Get the fuse memory allocatable factor from the StorageClass parameters (or PV override).
818-
fuseMemoryAllocatableFactor, err := parseFloatParameterNonNegative(pv, sc, fuseMemoryAllocatableFactorKey, fuseMemoryAllocatableFactorDefaultVal)
805+
fuseMemoryAllocatableFactor, err := parseFloatParameterNonNegative(pv, sc, fuseMemoryAllocatableFactorKey)
819806
if err != nil {
820807
return nil, fmt.Errorf("failed to parse fuse memory allocatable factor param in StorageClass %q: %v", sc.Name, err)
821808
}
822809

823810
// Get the fuse ephemeral storage allocatable factor from the StorageClass parameters.
824-
fuseEphemeralStorageAllocatableFactor, err := parseFloatParameterNonNegative(pv, sc, fuseEphemeralStorageAllocatableFactorKey, fuseEphemeralStorageAllocatableFactorDefaultVal)
811+
fuseEphemeralStorageAllocatableFactor, err := parseFloatParameterNonNegative(pv, sc, fuseEphemeralStorageAllocatableFactorKey)
825812
if err != nil {
826813
return nil, fmt.Errorf("failed to parse fuse ephemeral storage allocatable factor param in StorageClass %q: %v", sc.Name, err)
827814
}

0 commit comments

Comments
 (0)