Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allowAutoIOPSPerGBIncrease to translated AWS EBS StorageClasses #101082

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions staging/src/k8s.io/csi-translation-lib/plugins/aws_ebs.go
Expand Up @@ -36,6 +36,14 @@ const (
AWSEBSInTreePluginName = "kubernetes.io/aws-ebs"
// AWSEBSTopologyKey is the zonal topology key for AWS EBS CSI driver
AWSEBSTopologyKey = "topology." + AWSEBSDriverName + "/zone"
// iopsPerGBKey is StorageClass parameter name that specifies IOPS
// Per GB.
iopsPerGBKey = "iopspergb"
// allowIncreaseIOPSKey is parameter name that allows the CSI driver
// to increase IOPS to the minimum value supported by AWS when IOPS
// Per GB is too low for a given volume size. This preserves current
// in-tree volume plugin behavior.
allowIncreaseIOPSKey = "allowautoiopspergbincrease"
)

var _ InTreePlugin = &awsElasticBlockStoreCSITranslator{}
Expand All @@ -62,6 +70,12 @@ func (t *awsElasticBlockStoreCSITranslator) TranslateInTreeStorageClassToCSI(sc
generatedTopologies = generateToplogySelectors(AWSEBSTopologyKey, []string{v})
case zonesKey:
generatedTopologies = generateToplogySelectors(AWSEBSTopologyKey, strings.Split(v, ","))
case iopsPerGBKey:
// Keep iopsPerGBKey
params[k] = v
// Preserve current in-tree volume plugin behavior and allow the CSI
// driver to bump volume IOPS when volume size * iopsPerGB is too low.
params[allowIncreaseIOPSKey] = "true"
default:
params[k] = v
}
Expand Down
Expand Up @@ -102,6 +102,11 @@ func TestTranslateEBSInTreeStorageClassToCSI(t *testing.T) {
sc: NewStorageClass(map[string]string{"fstype": "ext3"}, nil),
expSc: NewStorageClass(map[string]string{"csi.storage.k8s.io/fstype": "ext3"}, nil),
},
{
name: "translate with iops",
sc: NewStorageClass(map[string]string{"iopsPerGB": "100"}, nil),
expSc: NewStorageClass(map[string]string{"iopsPerGB": "100", "allowautoiopspergbincrease": "true"}, nil),
},
}

for _, tc := range cases {
Expand Down