Sha256: 9459e64a0206e0eb0a874e114586ea283a9e9afde0a045b9ad5195b47402abc0

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 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: base_labels.merge(additional_labels)
          }.merge(formatted_annotations).merge(formatted_namespace),
          spec: {
            accessModes:,
            storageClassName:,
            resources: {
              requests: {
                storage:
              }
            }
          }
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metatron-0.8.2 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.8.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.7.0 lib/metatron/templates/persistent_volume_claim.rb
metatron-0.6.1 lib/metatron/templates/persistent_volume_claim.rb