Skip to content

Commit

Permalink
Merge branch 'main' into issue-2755
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant authored Dec 17, 2024
2 parents cdb2da8 + 6ee2b0c commit 822a8b6
Show file tree
Hide file tree
Showing 116 changed files with 6,829 additions and 863 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
repository: gofeatureflag/go-feature-flag-cli
readme: "./cmd/lint/DOCKERHUB.md"
readme: "./cmd/cli/DOCKERHUB.md"

dockerhub-relay-proxy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: yq - portable yaml processor
uses: mikefarah/[email protected].5
uses: mikefarah/[email protected].6

- name: Bump chart appVersion
working-directory: ./release/
Expand Down
179 changes: 12 additions & 167 deletions .schema/flag-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
"$defs": {
"DTO": {
"properties": {
"trackEvents": {
"type": "boolean"
},
"disable": {
"type": "boolean"
},
"version": {
"type": "string"
},
"converter": {
"type": "string"
},
"variations": {
"additionalProperties": true,
"type": "object",
Expand Down Expand Up @@ -42,30 +54,6 @@
"type": "object",
"title": "metadata",
"description": "A field containing information about your flag such as an issue tracker link a description etc..."
},
"rule": {
"type": "string"
},
"percentage": {
"type": "number"
},
"true": true,
"false": true,
"default": true,
"rollout": {
"$ref": "#/$defs/Rollout"
},
"trackEvents": {
"type": "boolean"
},
"disable": {
"type": "boolean"
},
"version": {
"type": "string"
},
"converter": {
"type": "string"
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -111,32 +99,6 @@
"additionalProperties": false,
"type": "object"
},
"ProgressivePercentageV0": {
"properties": {
"initial": {
"type": "number"
},
"end": {
"type": "number"
}
},
"additionalProperties": false,
"type": "object"
},
"ProgressiveReleaseRampV0": {
"properties": {
"start": {
"type": "string",
"format": "date-time"
},
"end": {
"type": "string",
"format": "date-time"
}
},
"additionalProperties": false,
"type": "object"
},
"ProgressiveRollout": {
"properties": {
"initial": {
Expand Down Expand Up @@ -180,33 +142,6 @@
"date"
]
},
"ProgressiveV0": {
"properties": {
"percentage": {
"$ref": "#/$defs/ProgressivePercentageV0"
},
"releaseRamp": {
"$ref": "#/$defs/ProgressiveReleaseRampV0"
}
},
"additionalProperties": false,
"type": "object"
},
"Rollout": {
"properties": {
"experimentation": {
"$ref": "#/$defs/ExperimentationDto"
},
"progressive": {
"$ref": "#/$defs/ProgressiveV0"
},
"scheduled": {
"$ref": "#/$defs/ScheduledRolloutV0"
}
},
"additionalProperties": false,
"type": "object"
},
"Rule": {
"properties": {
"name": {
Expand Down Expand Up @@ -246,18 +181,6 @@
"additionalProperties": false,
"type": "object"
},
"ScheduledRolloutV0": {
"properties": {
"steps": {
"items": {
"$ref": "#/$defs/ScheduledStepV0"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object"
},
"ScheduledStep": {
"properties": {
"variations": {
Expand Down Expand Up @@ -304,84 +227,6 @@
},
"additionalProperties": false,
"type": "object"
},
"ScheduledStepV0": {
"properties": {
"variations": {
"additionalProperties": true,
"type": "object",
"title": "variations",
"description": "All the variations available for this flag. You need at least 2 variations and it is a key value pair. All the variations should have the same type."
},
"targeting": {
"items": {
"$ref": "#/$defs/Rule"
},
"type": "array",
"title": "targeting",
"description": "List of rule to target a subset of the users based on the evaluation context."
},
"bucketingKey": {
"type": "string"
},
"defaultRule": {
"$ref": "#/$defs/Rule",
"title": "defaultRule",
"description": "How do we evaluate the flag if the user is not part of any of the targeting rule."
},
"scheduledRollout": {
"items": {
"$ref": "#/$defs/ScheduledStep"
},
"type": "array",
"title": "scheduledRollout",
"description": "Configure an update on some fields of your flag over time."
},
"experimentation": {
"$ref": "#/$defs/ExperimentationDto",
"title": "experimentation",
"description": "Configure an experimentation. It will allow you to configure a start date and an end date for your flag."
},
"metadata": {
"type": "object",
"title": "metadata",
"description": "A field containing information about your flag such as an issue tracker link a description etc..."
},
"rule": {
"type": "string"
},
"percentage": {
"type": "number"
},
"true": true,
"false": true,
"default": true,
"rollout": {
"$ref": "#/$defs/Rollout"
},
"trackEvents": {
"type": "boolean"
},
"disable": {
"type": "boolean"
},
"version": {
"type": "string"
},
"converter": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"variations",
"defaultRule"
]
}
},
"additionalProperties": {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ Thanks so much to our contributors.
[Become a sponsor](https://github.com/sponsors/thomaspoignant) and show your support to GO Feature Flag.

These are our really cool sponsors!
<!-- sponsors --><a href="https://github.com/cybozu"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;2433152?v&#x3D;4" width="60px" alt="Cybozu" /></a><a href="https://github.com/efugier"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;17067968?u&#x3D;aa2eeb4971f0b2d7b4448964bf687fb039a573df&amp;v&#x3D;4" width="60px" alt="Emilien Fugier" /></a><a href="https://github.com/giulbia"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;11477672?u&#x3D;ab78754a59e3b3ea681035fe3459df5b0ccf7f5f&amp;v&#x3D;4" width="60px" alt="Giulia" /></a><!-- sponsors -->
<!-- sponsors --><a href="https://github.com/cybozu"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;2433152?v&#x3D;4" width="60px" alt="User avatar: Cybozu" /></a><!-- sponsors -->

## Adopters

Expand Down
36 changes: 20 additions & 16 deletions cmd/relayproxy/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/ofrep"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/service"
"go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" // nolint
"go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -54,37 +54,41 @@ func (s *Server) initRoutes() {
s.apiEcho.HideBanner = true
s.apiEcho.HidePort = true
s.apiEcho.Debug = s.config.IsDebugEnabled()
s.apiEcho.Use(otelecho.Middleware("go-feature-flag"))
// Timeout middleware has to be the first middleware in the list
// (see: https://github.com/labstack/echo/blob/3b017855b4d331002e2b8b28e903679b875ae3e9/middleware/timeout.go#L17)
s.apiEcho.Use(middleware.TimeoutWithConfig(
middleware.TimeoutConfig{
Skipper: func(c echo.Context) bool {
// ignore websocket in the timeout
return strings.HasPrefix(c.Request().URL.String(), "/ws")
},
Timeout: time.Duration(s.config.RestAPITimeout) * time.Millisecond,
OnTimeoutRouteErrorHandler: func(err error, c echo.Context) {
s.zapLog.Error("Timeout on route", zap.String("route", c.Path()), zap.Error(err))
},
ErrorMessage: `Timeout on the server, please retry later`,
}),
)
s.apiEcho.Use(custommiddleware.ZapLogger(s.zapLog, s.config))

s.apiEcho.Use(middleware.BodyDumpWithConfig(middleware.BodyDumpConfig{
Skipper: func(_ echo.Context) bool {
return !s.zapLog.Core().Enabled(zap.DebugLevel)
Skipper: func(c echo.Context) bool {
isSwagger := strings.HasPrefix(c.Request().URL.String(), "/swagger")
return isSwagger || !s.zapLog.Core().Enabled(zap.DebugLevel)
},
Handler: func(_ echo.Context, reqBody []byte, _ []byte) {
s.zapLog.Debug("Request info", zap.ByteString("request_body", reqBody))
},
}))

if s.services.Metrics != (metric.Metrics{}) {
s.apiEcho.Use(echoprometheus.NewMiddlewareWithConfig(echoprometheus.MiddlewareConfig{
Subsystem: metric.GOFFSubSystem,
Registerer: s.services.Metrics.Registry,
}))
}

s.apiEcho.Use(otelecho.Middleware("go-feature-flag"))
s.apiEcho.Use(middleware.CORSWithConfig(middleware.DefaultCORSConfig))
s.apiEcho.Use(custommiddleware.VersionHeader(s.config))
s.apiEcho.Use(middleware.Recover())
s.apiEcho.Use(middleware.TimeoutWithConfig(
middleware.TimeoutConfig{
Skipper: func(c echo.Context) bool {
// ignore websocket in the timeout
return strings.HasPrefix(c.Request().URL.String(), "/ws")
},
Timeout: time.Duration(s.config.RestAPITimeout) * time.Millisecond,
}),
)

// Init controllers
cAllFlags := controller.NewAllFlags(s.services.GOFeatureFlagService, s.services.Metrics)
Expand Down
4 changes: 2 additions & 2 deletions cmd/relayproxy/helm-charts/relay-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ sources:
- "https://github.com/thomaspoignant/go-feature-flag"
description: A Helm chart to deploy go-feature-flag-relay proxy into Kubernetes
type: application
version: 1.39.1
appVersion: "v1.39.1"
version: 1.40.0
appVersion: "v1.40.0"
icon: https://raw.githubusercontent.com/thomaspoignant/go-feature-flag/main/logo.png
maintainers:
- name: thomaspoignant
Expand Down
2 changes: 1 addition & 1 deletion cmd/relayproxy/helm-charts/relay-proxy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# relay-proxy

![Version: 1.39.1](https://img.shields.io/badge/Version-1.39.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.39.1](https://img.shields.io/badge/AppVersion-v1.39.1-informational?style=flat-square)
![Version: 1.40.0](https://img.shields.io/badge/Version-1.40.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.40.0](https://img.shields.io/badge/AppVersion-v1.40.0-informational?style=flat-square)

A Helm chart to deploy go-feature-flag-relay proxy into Kubernetes

Expand Down
Loading

0 comments on commit 822a8b6

Please sign in to comment.