Method: Krane::DeployTask#initialize

Defined in:
lib/krane/deploy_task.rb

#initialize(namespace:, context:, current_sha: nil, logger: nil, kubectl_instance: nil, bindings: {}, global_timeout: nil, selector: nil, selector_as_filter: false, filenames: [], protected_namespaces: nil, render_erb: false, kubeconfig: nil) ⇒ DeployTask

Initializes the deploy task

Parameters:

  • Kubernetes namespace (required)

  • Kubernetes context (required)

  • (defaults to: nil)

    The SHA of the commit

  • (defaults to: nil)

    Logger object (defaults to an instance of Krane::FormattedLogger)

  • (defaults to: nil)

    Kubectl instance

  • (defaults to: {})

    Bindings parsed by Krane::BindingsParser

  • (defaults to: nil)

    Timeout in seconds

  • (defaults to: nil)

    Selector(s) parsed by Krane::LabelSelector

  • (defaults to: false)

    Allow selecting a subset of Kubernetes resource templates to deploy

  • (defaults to: [])

    An array of filenames and/or directories containing templates (required)

  • (defaults to: nil)

    Array of protected Kubernetes namespaces (defaults to Krane::DeployTask::PROTECTED_NAMESPACES)

  • (defaults to: false)

    Enable ERB rendering



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/krane/deploy_task.rb', line 107

def initialize(namespace:, context:, current_sha: nil, logger: nil, kubectl_instance: nil, bindings: {},
  global_timeout: nil, selector: nil, selector_as_filter: false, filenames: [], protected_namespaces: nil,
  render_erb: false, kubeconfig: nil)
  @logger = logger || Krane::FormattedLogger.build(namespace, context)
  @template_sets = TemplateSets.from_dirs_and_files(paths: filenames, logger: @logger, render_erb: render_erb)
  @task_config = Krane::TaskConfig.new(context, namespace, @logger, kubeconfig)
  @bindings = bindings
  @namespace = namespace
  @namespace_tags = []
  @context = context
  @current_sha = current_sha
  @kubectl = kubectl_instance
  @global_timeout = global_timeout
  @selector = selector
  @selector_as_filter = selector_as_filter
  @protected_namespaces = protected_namespaces || PROTECTED_NAMESPACES
  @render_erb = render_erb
end