Class: Kube::Cluster::Standard::ServiceAccountWithRole
- Inherits:
-
Manifest
- Object
- Schema::Manifest
- Manifest
- Kube::Cluster::Standard::ServiceAccountWithRole
- Defined in:
- lib/kube/cluster/standard/service_account_with_role.rb
Overview
Bundles a ServiceAccount, a Role, and the RoleBinding that ties them together into one Manifest. The Role and RoleBinding take the ServiceAccount’s name unless a name is given explicitly:
ServiceAccountWithRole.new(
service_account: ServiceAccount.new(name: "glauth-config-builder"),
role: Role.new(rules: [
"secrets" => %w[get list],
"batch/cronjobs" => %w[get],
]),
)
Instance Attribute Summary
Attributes inherited from Manifest
Instance Method Summary collapse
-
#initialize(service_account:, role:, name: nil, &block) ⇒ ServiceAccountWithRole
constructor
A new instance of ServiceAccountWithRole.
Methods inherited from Manifest
Constructor Details
#initialize(service_account:, role:, name: nil, &block) ⇒ ServiceAccountWithRole
Returns a new instance of ServiceAccountWithRole.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kube/cluster/standard/service_account_with_role.rb', line 22 def initialize(service_account:, role:, name: nil, &block) name ||= service_account.name role.name = name role_binding = Kube::Cluster::Standard::RoleBinding.new( role: role, service_account: service_account, name: name, ) super(service_account, role, role_binding) instance_exec(&block) if block end |