Class: Gitlab::Kubernetes::DefaultNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/kubernetes/default_namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster, project:) ⇒ DefaultNamespace

Ideally we would just use an environment record here instead of passing a project and name/slug separately, but we need to be able to look up namespaces before the environment has been persisted.


14
15
16
17
# File 'lib/gitlab/kubernetes/default_namespace.rb', line 14

def initialize(cluster, project:)
  @cluster = cluster
  @project = project
end

Instance Attribute Details

#clusterObject (readonly)

Returns the value of attribute cluster.


6
7
8
# File 'lib/gitlab/kubernetes/default_namespace.rb', line 6

def cluster
  @cluster
end

#projectObject (readonly)

Returns the value of attribute project.


6
7
8
# File 'lib/gitlab/kubernetes/default_namespace.rb', line 6

def project
  @project
end

Instance Method Details

#from_environment_name(name) ⇒ Object


19
20
21
# File 'lib/gitlab/kubernetes/default_namespace.rb', line 19

def from_environment_name(name)
  from_environment_slug(generate_slug(name))
end

#from_environment_slug(slug) ⇒ Object


23
24
25
# File 'lib/gitlab/kubernetes/default_namespace.rb', line 23

def from_environment_slug(slug)
  default_platform_namespace(slug) || default_project_namespace(slug)
end