Class: Gitlab::QA::Service::KubernetesCluster
- Inherits:
-
Object
- Object
- Gitlab::QA::Service::KubernetesCluster
- Includes:
- Gitlab::QA::Support::Shellout
- Defined in:
- lib/gitlab/qa/service/kubernetes_cluster.rb
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
- #apply_manifest(manifest) ⇒ Object
- #cluster_name ⇒ Object
- #create! ⇒ Object
- #create_registry_mirror ⇒ Object
- #create_secret(secret, secret_name) ⇒ Object
-
#initialize(provider_class: QA::Service::ClusterProvider::K3d) ⇒ KubernetesCluster
constructor
A new instance of KubernetesCluster.
- #remove! ⇒ Object
- #to_s ⇒ Object
Methods included from Gitlab::QA::Support::Shellout
Constructor Details
#initialize(provider_class: QA::Service::ClusterProvider::K3d) ⇒ KubernetesCluster
Returns a new instance of KubernetesCluster.
13 14 15 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 13 def initialize(provider_class: QA::Service::ClusterProvider::K3d) @provider = provider_class.new end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
11 12 13 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 11 def provider @provider end |
Instance Method Details
#apply_manifest(manifest) ⇒ Object
46 47 48 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 46 def apply_manifest(manifest) shell('kubectl apply -f -', stdin_data: manifest) end |
#cluster_name ⇒ Object
30 31 32 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 30 def cluster_name @provider.cluster_name end |
#create! ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 17 def create! validate_dependencies @provider.validate_dependencies @provider.setup self end |
#create_registry_mirror ⇒ Object
38 39 40 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 38 def create_registry_mirror @provider.create_registry_mirror end |
#create_secret(secret, secret_name) ⇒ Object
42 43 44 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 42 def create_secret(secret, secret_name) shell("kubectl create secret generic #{secret_name} --from-literal=token='#{secret}'", mask_secrets: [secret]) end |
#remove! ⇒ Object
26 27 28 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 26 def remove! @provider.teardown end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/gitlab/qa/service/kubernetes_cluster.rb', line 34 def to_s cluster_name end |