-
Notifications
You must be signed in to change notification settings - Fork 1
Scopes
Gregory Nickonov edited this page Mar 1, 2019
·
1 revision
Sometimes (very often, actually) you have to declare several resources with the same name and repetition of the same resource name over and over again makes code look messy and not DRY. Scope is the answer to the problem - in the defined scope you can omit resource name in declarations and the scope name will be used instead:
R.scope :frontend do
config_map do
add_application_label
set BACKEND_URL: 'http://backend'
end
deployment do
container do
image V.frontend.image
end
environment do
use_config_map
end
end
end
The code above will define ConfigMap with the name frontend
, label application
and value BACKEND_URL
. It will also define a Deployment with the same name, that uses an image, defined in the values file and use environment variables, defined as values of the ConfigMap with the same name as a Deployment. Clear and DRY!