summaryrefslogtreecommitdiff
path: root/qa/qa/resource/kubernetes_cluster/base.rb
blob: 38bca48be17632ad85bdd533687e7805815769ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require 'securerandom'

module QA
  module Resource
    module KubernetesCluster
      class Base < Resource::Base
        attr_writer :add_name_uuid

        attribute :id
        attribute :name
        attribute :domain
        attribute :enabled
        attribute :managed
        attribute :management_project_id

        attribute :api_url
        attribute :token
        attribute :ca_cert
        attribute :namespace

        attribute :authorization_type
        attribute :environment_scope

        def initialize
          @add_name_uuid = true
          @enabled = true
          @managed = true
          @authorization_type = :rbac
          @environment_scope = :*
        end

        def name=(new_name)
          @name = @add_name_uuid ? "#{new_name}-#{SecureRandom.hex(5)}" : new_name
        end
      end
    end
  end
end