Class: Clusters::KubernetesNamespace

Inherits:
ApplicationRecord show all
Includes:
Gitlab::Kubernetes
Defined in:
app/models/clusters/kubernetes_namespace.rb

Constant Summary

Constants included from Gitlab::Kubernetes

Gitlab::Kubernetes::EXEC_COMMAND

Instance Method Summary collapse

Methods included from Gitlab::Kubernetes

#add_terminal_auth, build_header_hash, #container_exec_url, #filter_by_annotation, #filter_by_label, #filter_by_legacy_label, #filter_by_project_environment, #terminals_for_pod, #to_kubeconfig

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Method Details

#predefined_variablesObject


36
37
38
39
40
41
42
43
44
# File 'app/models/clusters/kubernetes_namespace.rb', line 36

def predefined_variables
  Gitlab::Ci::Variables::Collection.new.tap do |variables|
    variables
      .append(key: 'KUBE_SERVICE_ACCOUNT', value: .to_s)
      .append(key: 'KUBE_NAMESPACE', value: namespace.to_s)
      .append(key: 'KUBE_TOKEN', value: .to_s, public: false, masked: true)
      .append(key: 'KUBECONFIG', value: kubeconfig, public: false, file: true)
  end
end

#token_nameObject


32
33
34
# File 'app/models/clusters/kubernetes_namespace.rb', line 32

def token_name
  "#{namespace}-token"
end