Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLI-916] Other formats for declarative state #2864

Open
1 task done
markphelps opened this issue Mar 17, 2024 · 1 comment
Open
1 task done

[FLI-916] Other formats for declarative state #2864

markphelps opened this issue Mar 17, 2024 · 1 comment
Labels
enhancement Created by Linear-GitHub Sync proposal Just putting it out there

Comments

@markphelps
Copy link
Collaborator

markphelps commented Mar 17, 2024

Problem

We currently support declarative flag state in YAML format: https://www.flipt.io/docs/configuration/storage#defining-flag-state

YAML is ok, but I'm wondering if it makes sense to support other formats for defining flag state. These other formats may allow for us to do more concrete validation of data, or support things such as references and functions

Ideal Solution

One of the first formats I've thought we could support is HCL from Hashicorp.

I've started working on a proof of concept parser that would allow us to define flag state in HCL and then turn that into native objects that Flipt can work with (ie for import/export or serving evaluation if using a declarative backend).

Heres what it might look like:

namespace "example" {
	name = "Example"
	description = "An example namespace"
}

flag "feature" {
	namespace = namespace.example
	name = "feature"
	type = "variant"
	enabled = true
	description = "A feature flag"
	
	variants = [
		{
			key = "enabled"
			name = "enabled"
			description = "The feature is enabled"
		},
		{
			key = "disabled"
			name = "disabled"
			description = "The feature is disabled"
		}
	]

	rules = {
		{
			segment = segment.example
			variant = "enabled"
		},
		{
			segment = segment.example
			distributions = {
				{
					rollout = 50
					variant = "enabled"
				},
				{
					rollout = 50
					variant = "disabled"
				}
			}
		}
	}
}

segment "example" {
	namespace = namespace.example
	name = "example"
	description = "An example segment"
	match_type = "all"

	constraints = {
		{
			type = "string"
			property = "email"
			operator = "contains"
			value = ["@example.com"]
		}
	}
}

Before I go too far, I wanted to open this up for feedback to see:

  1. If anyone would find this useful/interesting to support other formats for flag state in Flipt
  2. If HCL is the 'right' choice, as there are other options available as well, such as PKL from Apple

Search

  • I searched for other open and closed issues before opening this

Additional Context

No response

FLI-916

@markphelps markphelps added proposal Just putting it out there enhancement Created by Linear-GitHub Sync labels Mar 17, 2024
@markphelps markphelps changed the title Other formats for declarative state [FLI-916] Other formats for declarative state Mar 17, 2024
@piclemx
Copy link

piclemx commented Mar 22, 2024

Hello 👋,

I like the idea of it. I think you will gain more by doing one of the following.

  1. Pulumi (People can use the language of their choice and can used their common tools)
  2. Kubernetes Operator.

The last one can be used by either pulumi, HCL/terraform, CUE, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Created by Linear-GitHub Sync proposal Just putting it out there
Projects
Status: No status
Development

No branches or pull requests

2 participants