Sha256: 222f49ba0ae047abee14b45e60c2cd0f1699d7e4b4e2c7d10ecdfb3af15af893

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    # The PersistentVolumeClaim Kubernetes resource
    class PersistentVolumeClaim < Template
      include Concerns::Annotated
      include Concerns::Namespaced

      attr_accessor :additional_labels, :storage_class, :access_modes, :storage

      def initialize(
        name,
        storage_class:,
        storage:,
        access_modes: ["ReadWriteOnce"]
      )
        super(name)
        @storage_class = storage_class
        @access_modes = access_modes
        @storage = storage
        @additional_labels = {}
      end

      def render
        {
          apiVersion:,
          kind:,
          metadata: {
            name:,
            labels: { "#{label_namespace}/name": name }.merge(additional_labels)
          }.merge(formatted_annotations).merge(formatted_namespace),
          spec: {
            accessModes: access_modes,
            storageClassName: storage_class,
            resources: {
              requests: {
                storage:
              }
            }
          }
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metatron-0.2.1 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.1.9 lib/metatron/templates/persistent_volume_claim.rb