Skip to content

Commit

Permalink
Merge branch 'main' into feature/opentel
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant authored May 3, 2024
2 parents 6490002 + 32e4fc0 commit db5fbdc
Show file tree
Hide file tree
Showing 14 changed files with 617 additions and 224 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ Please add a description of what your pull request is doing.
- If there are breaking changes, please describe them in detail and why we cannot avoid them.
-->

# Changes include
- [ ] Bugfix (non-breaking change that solves an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking changes (change that is not backward-compatible and/or changes current functionality)

# Closes issue(s)
<!--
Please add the id of the issue this pull request is resolving.
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,14 @@ updates:
- "automerge"
commit-message:
prefix: "chore"

- package-ecosystem: npm
directory: "/website"
schedule:
interval: monthly
time: "04:00"
open-pull-requests-limit: 10
labels:
- "dependencies"
commit-message:
prefix: "chore(website)"
2 changes: 1 addition & 1 deletion background_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func newBackgroundUpdater(pollingInterval time.Duration, useJitter bool) backgro
}
}

// close stop the ticker and close the channel.
// close stops the ticker and closes the channel.
func (bgu *backgroundUpdater) close() {
bgu.ticker.Stop()
close(bgu.updaterChan)
Expand Down
81 changes: 36 additions & 45 deletions cmd/relayproxy/helm-charts/relay-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ It will install the chart in your cluster.
<tbody>
<tr>
<td id="affinity">
<a href="./values.yaml#L122">affinity</a>
<a href="./values.yaml#L121">affinity</a>
</td>
<td>
object
Expand All @@ -61,7 +61,7 @@ object
</tr>
<tr>
<td id="autoscaling">
<a href="./values.yaml#L103">autoscaling</a>
<a href="./values.yaml#L102">autoscaling</a>
</td>
<td>
object
Expand All @@ -85,7 +85,7 @@ object
</tr>
<tr>
<td id="autoscaling--enabled">
<a href="./values.yaml#L105">autoscaling.enabled</a>
<a href="./values.yaml#L104">autoscaling.enabled</a>
</td>
<td>
bool
Expand All @@ -103,7 +103,7 @@ false
</tr>
<tr>
<td id="autoscaling--maxReplicas">
<a href="./values.yaml#L109">autoscaling.maxReplicas</a>
<a href="./values.yaml#L108">autoscaling.maxReplicas</a>
</td>
<td>
int
Expand All @@ -121,7 +121,7 @@ int
</tr>
<tr>
<td id="autoscaling--minReplicas">
<a href="./values.yaml#L107">autoscaling.minReplicas</a>
<a href="./values.yaml#L106">autoscaling.minReplicas</a>
</td>
<td>
int
Expand All @@ -139,7 +139,7 @@ int
</tr>
<tr>
<td id="autoscaling--targetCPUUtilizationPercentage">
<a href="./values.yaml#L111">autoscaling.targetCPUUtilizationPercentage</a>
<a href="./values.yaml#L110">autoscaling.targetCPUUtilizationPercentage</a>
</td>
<td>
int
Expand All @@ -157,7 +157,7 @@ int
</tr>
<tr>
<td id="autoscaling--targetMemoryUtilizationPercentage">
<a href="./values.yaml#L113">autoscaling.targetMemoryUtilizationPercentage</a>
<a href="./values.yaml#L112">autoscaling.targetMemoryUtilizationPercentage</a>
</td>
<td>
int
Expand All @@ -175,7 +175,7 @@ int
</tr>
<tr>
<td id="env">
<a href="./values.yaml#L15">env</a>
<a href="./values.yaml#L14">env</a>
</td>
<td>
object
Expand All @@ -193,7 +193,7 @@ object
</tr>
<tr>
<td id="fullnameOverride">
<a href="./values.yaml#L42">fullnameOverride</a>
<a href="./values.yaml#L41">fullnameOverride</a>
</td>
<td>
string
Expand All @@ -211,7 +211,7 @@ string
</tr>
<tr>
<td id="image--pullPolicy">
<a href="./values.yaml#L33">image.pullPolicy</a>
<a href="./values.yaml#L32">image.pullPolicy</a>
</td>
<td>
string
Expand All @@ -229,7 +229,7 @@ string
</tr>
<tr>
<td id="image--repository">
<a href="./values.yaml#L31">image.repository</a>
<a href="./values.yaml#L30">image.repository</a>
</td>
<td>
string
Expand All @@ -247,7 +247,7 @@ string
</tr>
<tr>
<td id="image--tag">
<a href="./values.yaml#L35">image.tag</a>
<a href="./values.yaml#L34">image.tag</a>
</td>
<td>
string
Expand All @@ -265,7 +265,7 @@ string
</tr>
<tr>
<td id="imagePullSecrets">
<a href="./values.yaml#L38">imagePullSecrets</a>
<a href="./values.yaml#L37">imagePullSecrets</a>
</td>
<td>
list
Expand All @@ -283,7 +283,7 @@ list
</tr>
<tr>
<td id="ingress">
<a href="./values.yaml#L76">ingress</a>
<a href="./values.yaml#L75">ingress</a>
</td>
<td>
object
Expand Down Expand Up @@ -317,7 +317,7 @@ object
</tr>
<tr>
<td id="ingress--annotations">
<a href="./values.yaml#L82">ingress.annotations</a>
<a href="./values.yaml#L81">ingress.annotations</a>
</td>
<td>
object
Expand All @@ -335,7 +335,7 @@ object
</tr>
<tr>
<td id="ingress--className">
<a href="./values.yaml#L80">ingress.className</a>
<a href="./values.yaml#L79">ingress.className</a>
</td>
<td>
string
Expand All @@ -353,7 +353,7 @@ string
</tr>
<tr>
<td id="ingress--enabled">
<a href="./values.yaml#L78">ingress.enabled</a>
<a href="./values.yaml#L77">ingress.enabled</a>
</td>
<td>
bool
Expand All @@ -371,7 +371,7 @@ false
</tr>
<tr>
<td id="nameOverride">
<a href="./values.yaml#L40">nameOverride</a>
<a href="./values.yaml#L39">nameOverride</a>
</td>
<td>
string
Expand All @@ -389,7 +389,7 @@ string
</tr>
<tr>
<td id="nodeSelector">
<a href="./values.yaml#L116">nodeSelector</a>
<a href="./values.yaml#L115">nodeSelector</a>
</td>
<td>
object
Expand All @@ -407,7 +407,7 @@ object
</tr>
<tr>
<td id="podAnnotations">
<a href="./values.yaml#L54">podAnnotations</a>
<a href="./values.yaml#L53">podAnnotations</a>
</td>
<td>
object
Expand All @@ -425,7 +425,7 @@ object
</tr>
<tr>
<td id="podSecurityContext">
<a href="./values.yaml#L57">podSecurityContext</a>
<a href="./values.yaml#L56">podSecurityContext</a>
</td>
<td>
object
Expand All @@ -443,34 +443,25 @@ object
</tr>
<tr>
<td id="relayproxy--config">
<a href="./values.yaml#L4">relayproxy.config</a>
<a href="./values.yaml#L3">relayproxy.config</a>
</td>
<td>
tpl/object
string
</td>
<td>
<div style="max-width: 300px;">
<pre lang="tpl">
relayproxy.config: |
listen: 1031
pollingInterval: 1000
startWithRetrieverError: false
retriever:
kind: http
url: https://raw.githubusercontent.com/thomaspoignant/go-feature-flag/main/examples/retriever_file/flags.goff.yaml
exporter:
kind: log

<pre lang="json">
"listen: 1031\npollingInterval: 1000\nstartWithRetrieverError: false\nretriever:\n kind: http\n url: https://raw.githubusercontent.com/thomaspoignant/go-feature-flag/main/examples/retriever_file/flags.goff.yaml\nexporter:\n kind: log\n"
</pre>
</div>
</td>
<td>
Define this for extra Django environment variables
GO Feature Flag relay proxy configuration as string.
</td>
</tr>
<tr>
<td id="replicaCount">
<a href="./values.yaml#L27">replicaCount</a>
<a href="./values.yaml#L26">replicaCount</a>
</td>
<td>
int
Expand All @@ -488,7 +479,7 @@ int
</tr>
<tr>
<td id="resources--requests--cpu">
<a href="./values.yaml#L100">resources.requests.cpu</a>
<a href="./values.yaml#L99">resources.requests.cpu</a>
</td>
<td>
string
Expand All @@ -506,7 +497,7 @@ string
</tr>
<tr>
<td id="resources--requests--memory">
<a href="./values.yaml#L98">resources.requests.memory</a>
<a href="./values.yaml#L97">resources.requests.memory</a>
</td>
<td>
string
Expand All @@ -524,7 +515,7 @@ string
</tr>
<tr>
<td id="securityContext">
<a href="./values.yaml#L61">securityContext</a>
<a href="./values.yaml#L60">securityContext</a>
</td>
<td>
object
Expand All @@ -542,7 +533,7 @@ object
</tr>
<tr>
<td id="service--port">
<a href="./values.yaml#L73">service.port</a>
<a href="./values.yaml#L72">service.port</a>
</td>
<td>
int
Expand All @@ -560,7 +551,7 @@ int
</tr>
<tr>
<td id="service--type">
<a href="./values.yaml#L71">service.type</a>
<a href="./values.yaml#L70">service.type</a>
</td>
<td>
string
Expand All @@ -578,7 +569,7 @@ string
</tr>
<tr>
<td id="serviceAccount--annotations">
<a href="./values.yaml#L48">serviceAccount.annotations</a>
<a href="./values.yaml#L47">serviceAccount.annotations</a>
</td>
<td>
object
Expand All @@ -596,7 +587,7 @@ object
</tr>
<tr>
<td id="serviceAccount--create">
<a href="./values.yaml#L46">serviceAccount.create</a>
<a href="./values.yaml#L45">serviceAccount.create</a>
</td>
<td>
bool
Expand All @@ -614,7 +605,7 @@ true
</tr>
<tr>
<td id="serviceAccount--name">
<a href="./values.yaml#L51">serviceAccount.name</a>
<a href="./values.yaml#L50">serviceAccount.name</a>
</td>
<td>
string
Expand All @@ -632,7 +623,7 @@ string
</tr>
<tr>
<td id="tolerations">
<a href="./values.yaml#L119">tolerations</a>
<a href="./values.yaml#L118">tolerations</a>
</td>
<td>
list
Expand Down
3 changes: 1 addition & 2 deletions cmd/relayproxy/helm-charts/relay-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
relayproxy:
# -- (tpl/object) Define this for extra Django environment variables
# @notationType -- tpl
# -- GO Feature Flag relay proxy configuration as string.
config: | # This is a configuration example for the relay-proxy
listen: 1031
pollingInterval: 1000
Expand Down
24 changes: 24 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"log"
"sync"
"time"

"github.com/thomaspoignant/go-feature-flag/retriever"
Expand Down Expand Up @@ -77,6 +78,9 @@ type Config struct {
// if in the evaluation context you have a field with the same name, it will override the common one.
// Default: nil
EvaluationContextEnrichment map[string]interface{}

// offlineMutex is a mutex to protect the Offline field.
offlineMutex *sync.RWMutex
}

// GetRetrievers returns a retriever.Retriever configure with the retriever available in the config.
Expand All @@ -96,3 +100,23 @@ func (c *Config) GetRetrievers() ([]retriever.Retriever, error) {
}
return retrievers, nil
}

// SetOffline set GO Feature Flag in offline mode.
func (c *Config) SetOffline(control bool) {
if c.offlineMutex == nil {
c.offlineMutex = &sync.RWMutex{}
}
c.offlineMutex.Lock()
defer c.offlineMutex.Unlock()
c.Offline = control
}

// IsOffline return if the GO Feature Flag is in offline mode.
func (c *Config) IsOffline() bool {
if c.offlineMutex == nil {
c.offlineMutex = &sync.RWMutex{}
}
c.offlineMutex.RLock()
defer c.offlineMutex.RUnlock()
return c.Offline
}
Loading

0 comments on commit db5fbdc

Please sign in to comment.