The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:
Feature #11608
Lowrider: Data/Model separation by including Hiera-like functionality in Puppet
| Status: | Closed | Start date: | 12/28/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | 01/09/2012 | |
| Assignee: | % Done: | 0% | ||
| Category: | - | Estimated time: | 40.00 hours | |
| Target version: | 3.0.0 | |||
| Affected Puppet version: | Branch: | https://github.com/puppetlabs/puppet/pull/718 | ||
| Keywords: | ||||
We've Moved!Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com |
||||
Description
Codename: Lowrider¶
Problem¶
In order for modules to be truly reusuable, you need to be able to supply site-specific data outside the module itself.
Authors however need to be able to supply data themselves with modules, but well separated outside the manifests so that users can override data.
Overview¶
We’re going to build Hiera-like functionality into Puppet itself as a first class citizen, using the Hiera code base as a starting point, and freezing the existing Hiera project with minimal maintenance by Puppet Labs.
“hiera” will generally be retired as a user facing element with the noun “data” and the verb “lookup”.
Backwards compatibility will be provided by existing Hiera installs, so it’s critical that users can continue to run Hiera alongside Territory while they do any necessary migration. Existing Hiera users are important to us.
At this stage we are looking to support a single on-disk data format, JSON.
Goals¶
- Automatically look up unspecified class parameters in the data store.
- Allow manual look up of data in the data store by explicit keys.
- Provide a Face to interact with the data store.
Out of scope, to implement later¶
- A remote read/write API/service wrapped around Hiera.
Out of scope, no plan to implement later.¶
- Allow module authors to ship data in their modules.
We have a general principle we’re looking to promote where class parameters are considered your interface for the user of your module. Just like you wouldn’t make GUI elements that control aspects of a program your users shouldn’t need to modify, you shouldn’t make class parameters for everything. This should be kept in mind with the design.
We are not interacting with an external Hiera install here, we are creating Hiera-like functionality in Puppet core, using the Hiera code base.
Automatically look up unspecified class parameters in the data store¶
class ntp($servers=['time.puppetlabs.com']) {
...
}
Lookup Order¶
- Directly specified value
class { ntp: servers => ["ntp.puppetlabs.lan", "ntp2.puppetlabs.lan"] }
- Value via Hiera when not directly specified
class { ntp: }will lookup the keyntp::servers
- Default value in class definition when not directly specified or found in Hiera
class { ntp:}andclass ntp ($servers=["default.server"]) { ... }
Note the change from existing Hiera where we are now going to be looking up the fully qualified variable name as the key, avoiding the existing problem of a global namespace being polluted with ‘ntp_ntpservers’.
Default Hierarchy¶
Proposed:
:hierarchy:
- %{certname}
- %{environment}
- global
Note the rename of ‘common’ in Hiera terminology to ‘global’, and associated design question.
Allow manual look up of data in the data store by explicit keys¶
Puppet manifests should have access to the data store using a data lookup function like this:
class site {
class { 'ntp':
ntpservers => lookup('dmz_ntpservers'),
}
$maintenance_message = lookup('dmz_maintenance_state_text')
file { '/etc/motd':
content => $maintenance_message,
}
}
This is where users can lookup arbitrary keys and use the returned data in class or resource declarations, or really for any DSL purpose.
Puppet Data Face:¶
The current Hiera CLI functionality will be ported to a Face with the following feature set:
- Ability to read data from the data store
- Ability to query values based on a user supplied scope
Example:
# Query the data backend for var_name:
$ puppet data search var_name
# Query the data backend for var_name with a specific scope:
$ puppet data search var_name --scope "key=value"
Puppet Deprecations¶
- extlookup function
Hiera functionality that will not survive the transition¶
- “puppet” backend for Hiera
- YAML support
- We won’t port
hiera_include()as we’re going to fix #7801
Rough User Stories/Desires¶
- As a user, I want to be able to migrate a node from prod –> test –> prod without needing to copy all the data back and forth.
- This is the driver behind having the environment in the default hierarchy, rather than environment-specific data stores.
Outstanding Questions¶
General¶
- ???
- ???
Design¶
- Is our default hierarchy right?
- Is ‘global’ the right name for the previously-known-as ‘common’ hierarchical layer?
- What do we name the function(s) for data lookup? Is
lookup()right? - With regard to the replacement of
hiera_include(), do we need to enforce a convention here around the key lookup? - What do we do about the existing hiera config file? That can’t be expressed in puppet.conf can it?
Related issues
History
#1
Updated by Kelsey Hightower over 4 years ago
- Due date set to 12/14/2012
- Status changed from Investigating to Accepted
- Estimated time set to 40.00
- Branch set to https://github.com/kelseyhightower/puppet/tree/ticket/master/11608_data_separation_with_hiera
#2
Updated by Kelsey Hightower over 4 years ago
- Due date changed from 12/14/2012 to 01/09/2012
#3
Updated by Nigel Kersten over 4 years ago
- Description updated (diff)
- Assignee changed from Kelsey Hightower to Nigel Kersten
#4
Updated by Nigel Kersten over 4 years ago
- Description updated (diff)
#5
Updated by Nigel Kersten over 4 years ago
- Subject changed from Data/Model separation with Hiera to Lowrider: Data/Model separation by integrating Hiera into Puppet
#6
Updated by Nigel Kersten over 4 years ago
- Description updated (diff)
#7
Updated by Nigel Kersten over 4 years ago
- Status changed from Accepted to Needs More Information
#8
Updated by Nigel Kersten over 4 years ago
- Description updated (diff)
#9
Updated by Nigel Kersten about 4 years ago
- Subject changed from Lowrider: Data/Model separation by integrating Hiera into Puppet to Lowrider: Data/Model separation by including Hiera-like functionality in Puppet
- Description updated (diff)
#10
Updated by Nigel Kersten about 4 years ago
- Description updated (diff)
#11
Updated by Nigel Kersten about 4 years ago
- Description updated (diff)
#12
Updated by Nigel Kersten about 4 years ago
- Description updated (diff)
#13
Updated by Nigel Kersten about 4 years ago
- Description updated (diff)
#14
Updated by Luke Kanies about 4 years ago
Added the explicit dependency to #7801.
#15
Updated by Nigel Kersten about 4 years ago
- Description updated (diff)
#16
Updated by Nigel Kersten about 4 years ago
- Parent task deleted (
#7811)
#17
Updated by Nigel Kersten about 4 years ago
- Project changed from Product Roadmap to Puppet
- Target version deleted (
Telly)
#18
Updated by R.I. Pienaar about 4 years ago
Quick question, you say:
At this stage we are looking to support a single on-disk data format, JSON.
Will the plugin capability remain so people can write their own as today? With the same level of simplicity?
#19
Updated by Nigel Kersten about 4 years ago
RI, we’ve just had a major resetting of this after we started working with Kelsey and Pieter, and this ticket isn’t quite accurate, as it’s at the wrong descriptive level.
We’ll sync up soon.
#20 Updated by Anonymous about 4 years ago
Nigel, Kelsey – can y'all please update this ticket, or adjust the roadmap to point to the current state ticket, for this work. Thanks.
#21
Updated by Kelsey Hightower about 4 years ago
I don’t seem to have permission to edit the ticket description :(
I will work with someone to get that fixed.
#22
Updated by Nigel Kersten about 4 years ago
I can’t see why that would be… made you a manager of the project to see if that helps Kelsey.
#23 Updated by Anonymous about 4 years ago
- Is our default hierarchy right?
+1
- Is ‘global’ the right name for the previously-known-as ‘common’ hierarchical layer?
+1
- What do we name the function(s) for data lookup? Is lookup() right?
+1
- With regard to the replacement of hiera_include(), do we need to enforce a convention here around the key lookup?
Can you elaborate on this a bit? What sort of convention are you thinking of?
- What do we do about the existing hiera config file? That can’t be expressed in puppet.conf can it?
We could do away with the Hiera config file and inline this in the [master.data] section of puppet.conf iff we implemented support for multi-value keys. This would probably look like:
[master.data]
dir=%{certname}
dir=%{environment}
dir=global
The downside is that we cannot guarantee that people aren’t already relying on the existing duplicate handling behavior, and this would create unrelated errors elsewhere in the application. If we could find a reasonable way to represent this in a backwards compatible way, we should absolutely roll it in.
#24 Updated by Anonymous about 4 years ago
Pieter van de Bruggen wrote:
- What do we do about the existing hiera config file? That can’t be expressed in puppet.conf can it?
We could do away with the Hiera config file and inline this in the [master.data] section of puppet.conf iff we implemented support for multi-value keys. This would probably look like:
[master.data] dir=%{certname} dir=%{environment} dir=globalThe downside is that we cannot guarantee that people aren’t already relying on the existing duplicate handling behavior, and this would create unrelated errors elsewhere in the application. If we could find a reasonable way to represent this in a backwards compatible way, we should absolutely roll it in.
That radical change to the semantics of the configuration file also conflicts with existing use of all section names outside the limited set of applications as environments.
Introducing a new and exciting sigil (%) into the entire Puppet ecosystem seems like a bad choice, to me, in the context.
#25
Updated by Nigel Kersten about 4 years ago
- Assignee changed from Nigel Kersten to Kelsey Hightower
As discussed Kelsey, it would be great if you could update this with the plan you’re working to from the other docs.
#26 Updated by Anonymous almost 4 years ago
Kelsey: Can you elaborate on what you meant by enforcing a convention around key lookup (re: hiera_include)?
Daniel: Agreed on every point. Dotted (and space-separated) section names are a convention I’ve seen commonly in other INI files, but it’s definitely not something we’ve got support for currently. Given our current world, I’m fairly convinced we can’t reasonably integrate support for Hiera configuration into the puppet.conf file. We’ll let it live in $confdir/hiera.yml then.
#27
Updated by Kelsey Hightower almost 4 years ago
Pieter van de Bruggen wrote:
Kelsey: Can you elaborate on what you meant by enforcing a convention around key lookup (re: hiera_include)?
Daniel: Agreed on every point. Dotted (and space-separated) section names are a convention I’ve seen commonly in other INI files, but it’s definitely not something we’ve got support for currently. Given our current world, I’m fairly convinced we can’t reasonably integrate support for Hiera configuration into the
puppet.conffile. We’ll let it live in$confdir/hiera.ymlthen.
I dont’t think we need hiera_include anymore now that #7801 is merged.
#28 Updated by Anonymous almost 4 years ago
- Target version set to 3.0.0
#29
Updated by Kelsey Hightower almost 4 years ago
- Status changed from Needs More Information to Merged - Pending Release
#30
Updated by Kelsey Hightower almost 4 years ago
I’m in the process of working with doc team to make sure we have update docs and such.
#31
Updated by Kelsey Hightower almost 4 years ago
- Branch changed from https://github.com/kelseyhightower/puppet/tree/ticket/master/11608_data_separation_with_hiera to https://github.com/puppetlabs/puppet/pull/718
#32
Updated by Kelsey Hightower almost 4 years ago
- Status changed from Merged - Pending Release to Closed