Sha256: 1ce0b143735a4d538c7cc2e13c2dac2fd0f97e1c352c1c73411c9407baa0785c
Contents?: true
Size: 794 Bytes
Versions: 6
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true module Metatron module Templates # Template for basic Role k8s resource class Role < Template include Concerns::Annotated include Concerns::Namespaced attr_accessor :rules def initialize(name) super(name) @api_version = "rbac.authorization.k8s.io/v1" @rules = [] end def render { apiVersion:, kind:, metadata: { name:, labels: { "#{label_namespace}/name": name }.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace).compact, rules: formatted_rules }.compact end def formatted_rules = rules.map { _1.respond_to?(:render) ? _1.render : _1 } end end end
Version data entries
6 entries across 6 versions & 1 rubygems