gitlab-org--gitlab-foss/lib/gitlab/namespace_sanitizer.rb
Mayra Cabrera e3ca493876 Add Clusters::KubernetesNamespace model
This model will be used to persist into database Kubernetes properties,
such as namespace, service account name and service account token.
2018-10-22 09:54:00 -05:00

9 lines
179 B
Ruby

# frozen_string_literal: true
module Gitlab
class NamespaceSanitizer
def self.sanitize(namespace)
namespace.gsub(/[^-a-z0-9]/, '-').gsub(/^-+/, '')
end
end
end