Sha256: f9b1a3f04718f3f277c502a95a03b8874307fac5c75a1829154991ede3ad5fde

Contents?: true

Size: 880 Bytes

Versions: 4

Compression:

Stored size: 880 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: base_labels.merge(additional_labels)
          }.merge(formatted_annotations).merge(formatted_namespace),
          spec: {
            replicas:,
            selector: {
              matchLabels: base_labels.merge(additional_pod_labels)
            }
          }.merge(pod_template)
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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