Expose new Features endpoint for fetching feature gates.
Currently, we have two Feature flag apis.
-
/projects/:id/features
https://docs.gitlab.com/ee/operations/feature_flags.html are feature flags per project. These are meant to be used for projects deployed using GitLab. -
/features
https://docs.gitlab.com/ee/api/features.html are used for feature flags in the development of GitLab.
Feature flags in the development of GitLab are accessed directly by the Rails application, or injected into a context when making a gRPC call to Gitaly.
However, there are times when when neither are available. Praefect for instance, initiates gRPC calls to Gitaly nodes on its own and doesn't have a context with injected feature flags. Neither does it have access to the Rails database. In such a situation, we need an API to answer the question: "for this user_id or repository, is this feature flag enabled?"
We already supported setting a feature gate for a feature flag. To support the architecture mentioned in &9123, we'll need to add one more endpoint to fetch the list of future gates.
- The desired endpoint should be
/feature_gates
. It returns the list of enabled gates, grouped by feature flag id. - This endpoint supports filtering by an input feature flag param.
/feature_gates?flags=gitaly_mep_mep,gitaly_hello,gitaly_bye
. - This endpoint should support Etag.