Skip to content

Pod Template Owners

Gregory Nickonov edited this page Mar 13, 2019 · 9 revisions

Pod Template Owners is the collective name of the resources that have a Pod Template somewhere inside. Since that Pod Template definition is usually on the different level of nesting for different resource kinds, it's hard to create, for example, Helm template helpers to unify the work with them. Fortunately, it's not the case for the Sunstone, so any Pod Template Owner defines pod_template method that enables the whole bunch of methods to help define the pods and containers.

pod_template

Used to either access the PodTemplate object or to execute a block in the context of PodTemplate object. The former syntax can be used when only single action has to be performed on PodTemplate:

R.deployment :backend do
  pod_template.metadata.add_label application: metadata.name
end

However, usually, you'll need to access .spec field of PodTemplate and perform a number of actions related to that field, so Pod Template Owners provide pod_spec helper.

pod_spec

Used to access Pod Specification, value of the pod_template.spec field or execute a block in the context of PodTemplate .spec object:

R.cron_job :hourly do
  schedule '0 * * * *'

  pod_spec do
    image_pull_secret 'registry-secret'

    restart_policy :OnFailure
  end
end

container

A shortcut to pod_spec.container.

volumes

A shortcut to pod_spec.volumes.

Clone this wiki locally