Skip to content

Declaring resources

Gregory Nickonov edited this page Mar 1, 2019 · 1 revision

Resources are defined using factories in form R.resource_kind [<resource name>] do ... end. Resource name can be a String or Ruby Symbol (identifier, started with the colon). Let's take a look at the following code:

R.config_map 'frontend' do
  set 'BACKEND_ADDRESS': 'http://backend'
end

After processing the following YAML resource manifest will be generated:

apiVersion: v1
kind: ConfigMap
metadata:
  name: frontend
data:
  BACKEND_ADDRESS: "http://backend"

For the aesthetic purposes (or to save 1 or 2 characters per identifier) component definition can be defined using Symbols instead of strings:

R.config_map :frontend do
  set BACKEND_ADDRESS: 'http://backend'
end
Clone this wiki locally