Sha256: c643a468f8e172219e7d0886f3350415a446c505d817ac8cd2f4f174a6737f58

Contents?: true

Size: 928 Bytes

Versions: 16

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true

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

      attr_accessor :replicas, :additional_labels

      def initialize(name, replicas: 2)
        super(name)
        @api_version = "apps/v1"
        @replicas = replicas
      end

      def render
        {
          apiVersion:,
          kind:,
          metadata: {
            name:,
            labels: { "#{label_namespace}/name": name }.merge(additional_labels)
          }.merge(formatted_annotations).merge(formatted_namespace),
          spec: {
            replicas:,
            selector: {
              matchLabels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
            }
          }.merge(pod_template)
        }
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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