diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /app/models/clusters/platforms/kubernetes.rb | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'app/models/clusters/platforms/kubernetes.rb')
-rw-r--r-- | app/models/clusters/platforms/kubernetes.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb index 7ec614b048c..1bd8e8b44cb 100644 --- a/app/models/clusters/platforms/kubernetes.rb +++ b/app/models/clusters/platforms/kubernetes.rb @@ -50,12 +50,6 @@ module Clusters alias_attribute :ca_pem, :ca_cert - delegate :enabled?, to: :cluster, allow_nil: true - delegate :provided_by_user?, to: :cluster, allow_nil: true - delegate :allow_user_defined_namespace?, to: :cluster, allow_nil: true - - alias_method :active?, :enabled? - enum_with_nil authorization_type: { unknown_authorization: nil, rbac: 1, @@ -66,6 +60,19 @@ module Clusters nullify_if_blank :namespace + def enabled? + !!cluster&.enabled? + end + alias_method :active?, :enabled? + + def provided_by_user? + !!cluster&.provided_by_user? + end + + def allow_user_defined_namespace? + !!cluster&.allow_user_defined_namespace? + end + def predefined_variables(project:, environment_name:, kubernetes_namespace: nil) Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'KUBE_URL', value: api_url) |