Allow Plugins to provide custom Fn:: functions

Registered by Zane Bitter

The idea here is to be able to extend the templating system with your own functions.

This will be based on the same plugin system as used for resources. However functions are a bit trickier: there are two sets of functions we run at different times - ones dealing with static data and ones dealing with runtime data. We may need to provide a way to register each type separately.

We also currently apply functions in a fixed order, which is likely (although not guaranteed) to result in everything in the template being able to be resolved. We'll probably need to fix this so that all functions are guaranteed to resolve no matter their order of nesting.

Blueprint information

Status:
Complete
Approver:
Steven Hardy
Priority:
High
Drafter:
None
Direction:
Approved
Assignee:
Zane Bitter
Definition:
Approved
Series goal:
Accepted for icehouse
Implementation:
Implemented
Milestone target:
milestone icon 2014.1
Started by
Zane Bitter
Completed by
Zane Bitter

Related branches

Whiteboard

(stevebaker) It looks like the direction for HOT is for a small focused group of functions, and implementing some function-type behaviour with resources. Should we obsolete this blueprint for now?

(zaneb) There are some possible architectural benefits (especially with supporting multiple template formats) to doing this work. I'm actually playing around with some stuff at the moment, so let's no obsolete it quite yet.

(pafuent) If I got it right, dependencies among resources are now handled considering only a limited set of specific functions (https://github.com/openstack/heat/blob/master/heat/engine/resource.py#L338). Just in case, let's have in mind that this plugin system should also handle all the generated dependecies among resources derived from the plugged custom functions.

Gerrit topic: https://review.openstack.org/#q,topic:bp/function-plugins,n,z

Addressed by: https://review.openstack.org/73812
    Prevent user introspection of Python objects

Addressed by: https://review.openstack.org/73813
    Add a base class for pluggable functions

Addressed by: https://review.openstack.org/73814
    Refactor re-resolving of templates

Addressed by: https://review.openstack.org/73815
    Re-resolve functions during stack update

Addressed by: https://review.openstack.org/73816
    Calculate dependencies based on unresolved template

Addressed by: https://review.openstack.org/73817
    Evaluate lazy functions in autoscaling launch config

Addressed by: https://review.openstack.org/73818
    unit tests: Always resolve static functions

Addressed by: https://review.openstack.org/73819
    Fix test_association_eip unit test

Addressed by: https://review.openstack.org/73820
    unit tests: Fix types in Fn::ResourceFacade tests

Addressed by: https://review.openstack.org/73821
    unit tests: Refactor to accomodate lazy evaluation

Addressed by: https://review.openstack.org/73822
    Replace function resolution with lazy evaluation

Addressed by: https://review.openstack.org/74584
    Move HOT to a separate subpackage

Addressed by: https://review.openstack.org/74585
    Provide access to the template version

Addressed by: https://review.openstack.org/74586
    Disallow Heat-only functions in CloudFormation templates

Addressed by: https://review.openstack.org/74587
    Move built-in functions to separate modules

Addressed by: https://review.openstack.org/74588
    Remove Fn::FindInMap from HOT

Addressed by: https://review.openstack.org/74589
    Give cfn a separate Template class

Addressed by: https://review.openstack.org/74590
    Add a plugin_manager module

Addressed by: https://review.openstack.org/74591
    Use PluginManager to load resources

Addressed by: https://review.openstack.org/74592
    Load functions from plugins

Addressed by: https://review.openstack.org/76323
    Move the code that reads the global environment

Addressed by: https://review.openstack.org/76324
    Docs: use the plugin manager to list resources

Gerrit topic: https://review.openstack.org/#q,topic:typeless-function-plugins,n,z

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.