Sha256: 481839d646c4a3fdedfc9d61938c9427cb34d0c90d38ba78f669cbe3fd54baa8

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true


module Pfab
  module Templates
    class LongRunningProcess < Pfab::Templates::Base
      def default_probe
        {
          httpGet: {
            path: get("health_check_path") || "/",
            port: get("port"),
          },
          initialDelaySeconds: 15,
          timeoutSeconds: 3
        }
      end

      def livenessProbe
        get("livenessProbe") || default_probe
      end

      def readinessProbe
        get("readinessProbe") || default_probe
      end

      def startupProbe
        get("startupProbe") || default_probe
      end

      def probes

        if application_type == "web" || get("probesEnabled")
          return {
            livenessProbe: livenessProbe,
            readinessProbe: readinessProbe,
            startupProbe: startupProbe,
          }
        end
        puts "probes are disabled, set `probesEnabled: true` to enable"
        return {

        }

      end


      def rolling_update_strategy
        {
          type: "RollingUpdate",
          rollingUpdate: {
            maxSurge: get("maxSurge") || 1,
            maxUnavailable: get("maxUnavailable") || 0,
          }
        }
      end






    end



  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pfab-0.58.11 lib/pfab/templates/long_running_process.rb
pfab-0.58.10 lib/pfab/templates/long_running_process.rb
pfab-0.58.9 lib/pfab/templates/long_running_process.rb
pfab-0.58.8 lib/pfab/templates/long_running_process.rb
pfab-0.58.7 lib/pfab/templates/long_running_process.rb
pfab-0.58.6 lib/pfab/templates/long_running_process.rb
pfab-0.58.5 lib/pfab/templates/long_running_process.rb
pfab-0.58.4 lib/pfab/templates/long_running_process.rb
pfab-0.58.3 lib/pfab/templates/long_running_process.rb