Sha256: 5486d7b7bd53ac84799137020919f6dd823fc63565efe89dbdfd398c798e33ca

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    # Template for basic ClusterRole k8s resource
    class ClusterRole < Template
      include Concerns::Annotated

      attr_accessor :rules, :aggregation_rule

      alias aggregationRule aggregation_rule

      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).compact,
          aggregationRule:,
          rules:
        }.compact
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metatron-0.3.3 lib/metatron/templates/cluster_role.rb
metatron-0.3.2 lib/metatron/templates/cluster_role.rb
metatron-0.3.1 lib/metatron/templates/cluster_role.rb
metatron-0.3.0 lib/metatron/templates/cluster_role.rb
metatron-0.2.8 lib/metatron/templates/cluster_role.rb