-
Notifications
You must be signed in to change notification settings - Fork 222
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
V2: Declarative Management API #3832
Comments
It is a lame optimization but we could shorten
Also, worth noting that there is also the resource type that needs to go in there, which makes this longer. # list flags example:
GET /v2/manage/environments/{env}/flipt.core.Flag/namespaces/{namespace}/resources
# or perhaps:
GET /v2/manage/environments/{env}/namespaces/{namespace}/flipt.core.Flag
# or just:
GET /v2/manage/environments/{env}/namespaces/{namespace}/flags Which I appreciate is even more verbose. But we do need something to identify the resource type on. |
We could also drop GET /v2/environments/{env}/flipt.core.Flag/namespaces/{namespace}/resources |
Some more thoughts on the implementation details of the API (i.e. protobuf and gRPC shape) Prior Art (Flipt Cloud)In Flipt Cloud we planned for the future by using a This allowed us to write a single (generic) resource server / storage implementation that routed to the details for marshalling via looking up the implementation type name in a map. The resulting RPCs looked like so: service ManagementService {
// ...
rpc GetResource(GetResourceRequest) returns (ResourceResponse) {}
rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse) {}
rpc CreateResource(UpdateResourceRequest) returns (ResourceResponse) {}
rpc UpdateResource(UpdateResourceRequest) returns (ResourceResponse) {}
rpc DeleteResource(DeleteResourceRequest) returns (DeleteResourceResponse) {}
} Where many of the payloads had to duplicate the type (known as TypeUrl in Any) from message Resource {
// type is the fully-qualified protobuf message name
string type = 1;
string namespace = 2;
string key = 3;
google.protobuf.Any payload = 4;
} This was so that we could substitute these from the URL paths into the payload via Gateway. It was a little weird and I wonder if we can do any better. Possible Paths ForwardURL structure
Just do the same again, incorporating environment scope into the protobuf types and gRPC gateway routes. For example: message Resource {
string environment = 1;
string type = 2;
string namespace = 3;
string key = 4;
google.protobuf.Any payload = 5;
} and # Read
GET /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}/{key}
# List
GET /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
# Create
POST /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
# Update
PUT /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
# Delete
DELETE /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}/{key}
We could remove the redundency from the Create and Update RPCs, by removing the Type from the payloads. The benefit just removes some odd redundency when interfacing with the Update and Create endpoints where you need to duplicate the type information. Something like (compared with the previous approach): # Read
GET /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}/{key}
# List
GET /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
# Create
-POST /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
+POST /v2/environments/{env}/namespaces/{namespace}/resources
# Update
-PUT /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}
+PUT /v2/environments/{env}/namespaces/{namespace}/resources
# Delete
DELETE /v2/environments/{env}/namespaces/{namespace}/resources/{type=**}/{key}
Where M is the number of RPCs for the different operations (i.e. read / list / create / update / delete ~ 5) and N is the number of resource types we want to implemented (currently flags and segments ~ 2). Instead of having a generic CRUD slot supporting both types, we just enumerate all the options explicitly. Future resource types will need enumerating in the API contract in order to add them. Type parametersGiven we go forward with something like (1) or (2) then we need to decide how to address types. For example, Flag type resource was Alternatively, we could alias these to something else that is more compact. |
New Declarative Management API Design
Overview
Design and implement a new declarative management API for Flipt v2 that supports GitOps workflows and multi-environment configurations while maintaining compatibility with v1 flag evaluation.
Requirements
Environments
API Structure
Resource Hierarchy
API Routes
/v2/management/environments/{env}/...
New Features
Validation
Service-side Validation
Client-side Tools
State Management
Updates
Future Considerations
Non-Requirements
Implementation Notes
Flag State Format
Error Handling
Questions for Discussion
/v2/management/environments/{env}/namespaces/{namespace}/resource
it seems quite verbose to meThe text was updated successfully, but these errors were encountered: