Class: Metatron::Templates::RoleBinding
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::RoleBinding
- Includes:
- Concerns::Annotated, Concerns::Namespaced
- Defined in:
- lib/metatron/templates/role_binding.rb
Overview
Template for basic RoleBinding k8s resource
Instance Attribute Summary collapse
-
#role ⇒ Object
Returns the value of attribute role.
-
#role_ref ⇒ Object
(also: #roleRef)
Returns the value of attribute role_ref.
-
#subjects ⇒ Object
Returns the value of attribute subjects.
Attributes inherited from Metatron::Template
#additional_labels, #api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name, role) ⇒ RoleBinding
constructor
A new instance of RoleBinding.
- #render ⇒ Object
Methods included from Concerns::Namespaced
#formatted_namespace, included, #namespaced_initialize
Methods included from Concerns::Annotated
#annotated_initialize, #formatted_annotations, included
Methods inherited from Metatron::Template
initializer, initializers, metatron_template_class?, nearest_metatron_ancestor
Constructor Details
#initialize(name, role) ⇒ RoleBinding
Returns a new instance of RoleBinding.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/metatron/templates/role_binding.rb', line 14 def initialize(name, role) super(name) @api_version = "rbac.authorization.k8s.io/v1" @role = role @role_ref = { kind: "Role", name: role.respond_to?(:name) ? role.name : role, apiGroup: "rbac.authorization.k8s.io" } @subjects = [] end |
Instance Attribute Details
#role ⇒ Object
Returns the value of attribute role.
10 11 12 |
# File 'lib/metatron/templates/role_binding.rb', line 10 def role @role end |
#role_ref ⇒ Object Also known as: roleRef
Returns the value of attribute role_ref.
10 11 12 |
# File 'lib/metatron/templates/role_binding.rb', line 10 def role_ref @role_ref end |
#subjects ⇒ Object
Returns the value of attribute subjects.
10 11 12 |
# File 'lib/metatron/templates/role_binding.rb', line 10 def subjects @subjects end |
Instance Method Details
#render ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/metatron/templates/role_binding.rb', line 26 def render { apiVersion:, kind:, metadata: { name:, labels: base_labels.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace).compact, roleRef:, subjects: }.compact end |