101c4480b3
When Kubernetes clusters were originally built they could only exist at the project level, and so there was logic included that assumed there would only ever be a single Kubernetes namespace per cluster. We now support clusters at the group and instance level, which allows multiple namespaces. This change consolidates various project-specific fallbacks to generate namespaces, and hands all responsibility to the Clusters::KubernetesNamespace model. There is now no concept of a single namespace for a Clusters::Platforms::Kubernetes; to retrieve a namespace a project must now be supplied in all cases. This simplifies upcoming work to use a separate Kubernetes namespace per project environment (instead of a namespace per project).
12 lines
357 B
Ruby
12 lines
357 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Clusters
|
|
class Project < ApplicationRecord
|
|
self.table_name = 'cluster_projects'
|
|
|
|
belongs_to :cluster, class_name: 'Clusters::Cluster'
|
|
belongs_to :project, class_name: '::Project'
|
|
|
|
has_many :kubernetes_namespaces, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
|
|
end
|
|
end
|