Service resources

Service resources are environment-wide information pools filled and viewed by application components. Service resources work like exported resources, providing information about other nodes from PuppetDB. The uniqueness of service resources is found in their building of  dependencies between nodes. Service resources are declared as Puppet types, written in Ruby. Providers are optional, and allow for exported resource availability tests.

Service resource types provide a framework of information that can be stored and transported via application orchestration's consume and export metaparameters. The type is required for a service resource, and declares the structure of the information using Ruby code. They are always stored in modules at lib/puppet/type/<resource>.rb, and will be sent to all nodes in an environment when deployed, but will not be actioned upon by nodes not using the resource. The following sample type could encompass the database resource exported by app1 and consumed by app2:

#lib/puppet/type/database.rb

# Notice the :is_capability => true. This property creates this type as an
# environment-wide service, to be produced and consumed.
Puppet::Type.newtype
:database, :is_capability => true do
newparam :host
end

This simple example provides us with a way to export information about a database, specifically the host parameter. This can be filled with the export parameter, and read with the consume parameter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.196.184