Proposal: feature flag implementation for Juju
Casey Marshall
casey.marshall at canonical.com
Wed Nov 26 15:50:59 UTC 2014
+1 for feature flags in general and +1 for using environment variables
in upstart to get them to the servers & agents.
I think it'd be nice to have an environment variable per flag, with a
common prefix JUJU_FEATURE_. That way, if you need to check one in a
package init(), you don't have to parse the whole list of flags to find
the one you care about -- or depend on a globally initialized parsing of
that list.
env config seems reasonable, but dealing with parsing, errors and then
making that config globally available at init seems complex and not
always feasible.
How about defining them "free form" in an env config field, which is
then used to emit the env vars as described above to the upstart config
during bootstrap?
-Casey
On 11/25/2014 10:16 PM, Ian Booth wrote:
> I like feature flags so am +1 to the overall proposal. I also agree with the
> approach to keep them immutable, given the stated goals and complexity
> associated with making them not so.
>
> I think the env variable implementation is ok too - this keeps everything very
> loosely coupled and avoids polluting a juju environment with an extra config
> attribute.
>
> On 26/11/14 08:47, Tim Penhey wrote:
>> Hi all,
>>
>> There are often times when we want to hook up features for testing that
>> we don't want exposed to the general user community.
>>
>> In the past we have hooked things up in master, then when the release
>> branch is made, we have had to go and change things there. This is a
>> terrible way to do it.
>>
>> Here is my proposal:
>>
>> http://reviews.vapour.ws/r/531/diff/#
>>
>> We have an environment variable called JUJU_FEATURE_FLAGS. It contains
>> comma delimited strings that are used as flags.
>>
>> The value is read when the program initializes and is not mutable.
>>
>> Simple checks can be used in the code:
>>
>> if featureflag.Enabled("foo") {
>> // do foo like things
>> }
>>
>> Thoughts and suggestions appreciated, but I don't want to have the
>> bike-shedding go on too long.
>>
>> Tim
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20141126/6111c5e4/attachment.pgp>
More information about the Juju-dev
mailing list