Merge pull request #101082 from jsafrane/translate-aws-allowAutoIOPSPerGBIncrease

Add allowAutoIOPSPerGBIncrease to translated AWS EBS StorageClasses
This commit is contained in:
Kubernetes Prow Robot 2021-06-03 21:59:25 -07:00 committed by GitHub
commit 3a2092345e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -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{}
@ -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
}

View File

@ -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 {