Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ Enabling the vol-metrics-opt-in parameter activates the gathering of inode and d


### Container Arguments for deployment(controller)
| Parameters | Values | Default | Optional | Description |
|-----------------------------|--------|---------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| delete-access-point-root-dir| | false | true | Opt in to delete access point root directory by DeleteVolume. By default, DeleteVolume will delete the access point behind Persistent Volume and deleting access point will not delete the access point root directory or its contents. |
| adaptive-retry-mode | | true | true | Opt out to use standard sdk retry mode for EFS API calls. By default, Driver will use adaptive mode for the sdk retry configuration which heavily rate limits EFS API requests to reduce throttling if throttling is observed. |
| tags | | | true | Space separated key:value pairs which will be added as tags for Amazon EFS resources. For example, '--tags=name:efs-tag-test date:Jan24' |
| Parameters | Values | Default | Optional | Description |
|-----------------------------|--------|---------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| delete-access-point-root-dir| | false | true | Opt in to delete access point root directory by DeleteVolume. By default, DeleteVolume will delete the access point behind Persistent Volume and deleting access point will not delete the access point root directory or its contents. |
| adaptive-retry-mode | | true | true | Opt out to use standard sdk retry mode for EFS API calls. By default, Driver will use adaptive mode for the sdk retry configuration which heavily rate limits EFS API requests to reduce throttling if throttling is observed. |
| tags | | | true | Space separated key:value pairs which will be added as tags for Amazon EFS resources. For example, '--tags=name:efs-tag-test date:Jan24'. To include a ':' in the tag name or value, use \ as an escape character, for example '--tags="tag\:name:tag\:value" |
### Upgrading the Amazon EFS CSI Driver


Expand Down
6 changes: 5 additions & 1 deletion pkg/driver/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,11 @@ func TestCreateVolume(t *testing.T) {
cloud: mockCloud,
gidAllocator: NewGidAllocator(),
lockManager: NewLockManagerMap(),
tags: parseTagsFromStr("cluster:efs"),
tags: parseTagsFromStr("cluster:efs tag2\\:name2:tag2\\:val2"),
}

if driver.tags["cluster"] != "efs" || driver.tags["tag2:name2"] != "tag2:val2" {
t.Fatalf("Incorrect tags")
}

req := &csi.CreateVolumeRequest{
Expand Down
33 changes: 27 additions & 6 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ import (
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc"
"k8s.io/klog/v2"

"github.com/kubernetes-sigs/aws-efs-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-efs-csi-driver/pkg/util"
"google.golang.org/grpc"
"k8s.io/klog/v2"
)

const (
Expand Down Expand Up @@ -155,9 +154,31 @@ func parseTagsFromStr(tagStr string) map[string]string {
return m
}
tagsSplit := strings.Split(tagStr, " ")
for _, pair := range tagsSplit {
p := strings.Split(pair, ":")
m[p[0]] = p[1]
for _, currTag := range tagsSplit {
var nameBuilder strings.Builder
var valBuilder strings.Builder
var currBuilder *strings.Builder = &nameBuilder

for i := 0; i < len(currTag); i++ {
if currTag[i] == ':' {
if currBuilder == &valBuilder {
break
} else {
currBuilder = &valBuilder
continue
}
}

// Handle escape character
if currTag[i] == byte('\\') && currTag[i+1] == byte(':') {
currBuilder.WriteRune(':')
i++ // Skip an extra character
continue
}

currBuilder.WriteByte(currTag[i])
}
m[nameBuilder.String()] = valBuilder.String()
}
return m
}