Sha256: 88979ca197ce42b92cc0ca2dd9f942e4002a6be3de3bd6551a2ebe9401a9d6f9

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 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

      alias storageClassName storage_class
      alias accessModes access_modes

      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:,
            storageClassName:,
            resources: {
              requests: {
                storage:
              }
            }
          }
        }
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
metatron-0.6.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.5.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.4.2 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.4.1 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.4.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.3.4 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.3.3 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.3.2 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.3.1 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.3.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.8 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.7 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.6 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.5 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.4 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.3 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.2.2 lib/metatron/templates/persistent_volume_claim.rb