lib/floe/container_runner/docker_mixin.rb in floe-0.11.3 vs lib/floe/container_runner/docker_mixin.rb in floe-0.12.0
- old
+ new
@@ -22,9 +22,12 @@
# and https://github.com/kubernetes/kubernetes/blob/952a9cb0/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L178-L184
#
# This does not follow the leading and trailing character restriction because we will embed it
# below with a prefix and suffix that already conform to the RFC.
normalized_name = name.downcase.gsub(/[^a-z0-9-]/, "-")[0, MAX_CONTAINER_NAME_SIZE]
+ # Ensure that the normalized_name doesn't end in any invalid characters after we
+ # limited the length to the MAX_CONTAINER_NAME_SIZE.
+ normalized_name.gsub!(/[^a-z0-9]+$/, "")
"floe-#{normalized_name}-#{SecureRandom.hex(4)}"
end
end
end