Sha256: 866f5b2bc750a4e29ee752f566b1ec862266b738784ffb6fe53db067b2c659e4

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    # Template for basic Role k8s resource
    class ResourceQuota < Template
      include Concerns::Annotated
      include Concerns::Namespaced

      attr_accessor :additional_labels, :spec

      def initialize(name)
        super
        @additional_labels = {}
        @spec = {}
      end

      def render
        {
          apiVersion:,
          kind:,
          metadata: {
            name:,
            labels: base_labels.merge(additional_labels)
          }.merge(formatted_annotations).merge(formatted_namespace).compact
        }.merge(formatted_spec)
      end

      def formatted_spec = (@spec || {}).empty? ? {} : { spec: }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metatron-0.8.2 lib/metatron/templates/resource_quota.rb