Skip to content

Commit

Permalink
fix(provider/kubernetes): v2 Allow ":" in keys (#2420)
Browse files Browse the repository at this point in the history
Colons are allowed in Kubernetes resource names, and used by default
for several RBAC roles like "system:masters".

Replace ";" with ";" when storing the key, and do the opposite when
retrieving the key.
  • Loading branch information
wjoel authored and lwander committed Mar 12, 2018
1 parent 1efd1ef commit 8324822
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public static LogicalKind fromString(String name) {
private static String createKey(Object... elems) {
List<String> components = Arrays.stream(elems)
.map(s -> s == null ? "" : s.toString())
.map(s -> s.replaceAll(":", ";"))
.collect(Collectors.toList());
components.add(0, provider);
return String.join(":", components);
Expand Down Expand Up @@ -120,6 +121,10 @@ public static Optional<CacheKey> parseKey(String key) {
return Optional.empty();
}

for (String part : parts) {
part.replaceAll(";", ":");
}

try {
Kind kind = Kind.fromString(parts[1]);
switch (kind) {
Expand Down

0 comments on commit 8324822

Please sign in to comment.