Skip to content

Commit

Permalink
Merge branch 'main' into feat/support-new-schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbaert committed Dec 21, 2023
2 parents 735a94a + 3385d58 commit 8102fcf
Show file tree
Hide file tree
Showing 41 changed files with 7,086 additions and 190 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev-benches-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4
- name: Upload artifact
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3
with:
path: './dev/bench'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@13b55b33dd8996121833dbc1db458c793a334630 # v3
uses: actions/deploy-pages@f33f41b675f0ab2dc5a6863c9a170fe83af3571e # v4
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- uses: google-github-actions/release-please-action@a2d8d683f209466ee8c695cd994ae2cf08b1642d # v4
- uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4
id: release
with:
token: ${{secrets.GITHUB_TOKEN}}
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4
uses: docker/metadata-action@9dc751fe249ad99385a2583ee0d084c400eee04e
with:
images: ${{ env.REGISTRY }}/${{ matrix.path }}

Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
COMMIT=${{ github.sha }}
DATE=${{ needs.release-please.outputs.date }}
- name: Install Cosign
uses: sigstore/cosign-installer@9614fae9e5c5eddabb09f90a270fcb487c9f7149
uses: sigstore/cosign-installer@b18d21aaa20ef40c4e681202a598b7591d5be577

- name: Sign the image
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ core-coverage.out
go.work
go.work.sum
bin/
node_modules/

# built documentation
site
Expand Down
11 changes: 7 additions & 4 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ config:

ignores:
- "**/CHANGELOG.md"
- ".venv"
- "node_modules"
- "playground-app/node_modules"
- "tmp"
- "**/protos.md" # auto-generated
- "schemas" # submodule
- "spec" # submodule
- "test-harness" # submodule
- "**/protos.md" # auto-generated
- "docs/playground" # auto-generated
- "schemas" # submodule
- "spec" # submodule
- "test-harness" # submodule
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,22 @@ generate-proto-docs: pull-schemas-submodule

.PHONY: run-web-docs
run-web-docs: generate-docs generate-proto-docs
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material

# Run the playground app in dev mode
# See the readme in the playground-app folder for more details
.PHONY: playground-dev
playground-dev:
cd playground-app && npm ci && npm run dev

# Build the playground app
# See the readme in the playground-app folder for more details
.PHONY: playground-build
playground-build:
cd playground-app && npm ci && npm run build

# Publish the playground app to the docs folder
# See the readme in the playground-app folder for more details
.PHONY: playground-publish
playground-publish: playground-build
cp playground-app/dist/assets/index-*.js docs/playground/playground.js
2 changes: 1 addition & 1 deletion core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
golang.org/x/mod v0.14.0
golang.org/x/net v0.19.0
golang.org/x/sync v0.5.0
google.golang.org/grpc v1.60.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.28.4
Expand Down
2 changes: 2 additions & 0 deletions core/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,8 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k=
google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
13 changes: 13 additions & 0 deletions docs/assets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@
--md-default-bg-color--light: hsla(240, 4%, 11%, 0.54);
--md-default-bg-color--lighter: hsla(240, 4%, 11%, 0.26);
--md-default-bg-color--lightest: hsla(240, 4%, 11%, 0.07);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed !important;
}

.output {
transition: opacity .5s ease-in-out;
opacity: 0;
}

.output.visible {
opacity: 1;
}
6 changes: 6 additions & 0 deletions docs/playground/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!--
The playground.js is automatically generated using the 'make playground-publish' command.
For more information, please refer to the README.md in 'playground-app' folder.
-->
<script type="module" crossorigin src="./playground.js"></script>
<div id="playground"></div>
62 changes: 62 additions & 0 deletions docs/playground/playground.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/flag-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ As long as a JsonLogic operator is structurally valid, it will return a falsy/nu

These are custom operations specific to flagd and flagd providers.
They are purpose-built extensions to JsonLogic in order to support common feature flag use cases.
Consistent with build-in JsonLogic operators, flagd's custom operators return falsy/nullish values with invalid inputs.
Consistent with built-in JsonLogic operators, flagd's custom operators return falsy/nullish values with invalid inputs.

| Function | Description | Context attribute type | Example |
| ---------------------------------- | --------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
29 changes: 12 additions & 17 deletions docs/reference/flagd-cli/flagd_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,18 @@ flagd start [flags]
### Options

```
-b, --bearer-token string DEPRECATED: Superseded by --sources.
-C, --cors-origin strings CORS allowed origins, * will allow all origins
-e, --evaluator string DEPRECATED: Set an evaluator e.g. json, yaml/yml.Please note that yaml/yml and json evaluations work the same (yaml/yml files are converted to json internally) (default "json")
-h, --help help for start
-z, --log-format string Set the logging format, e.g. console or json (default "console")
-m, --management-port int32 Port for management operations (default 8014)
-t, --metrics-exporter string Set the metrics exporter. Default(if unset) is Prometheus. Can be override to otel - OpenTelemetry metric exporter. Overriding to otel require otelCollectorURI to be present
--metrics-port int32 DEPRECATED: Superseded by --management-port. (default 8014)
-o, --otel-collector-uri string Set the grpc URI of the OpenTelemetry collector for flagd runtime. If unset, the collector setup will be ignored and traces will not be exported.
-p, --port int32 Port to listen on (default 8013)
-c, --server-cert-path string Server side tls certificate path
-k, --server-key-path string Server side tls key path
-d, --socket-path string Flagd socket path. With grpc the service will become available on this address. With http(s) the grpc-gateway proxy will use this address internally.
-s, --sources string JSON representation of an array of SourceConfig objects. This object contains 2 required fields, uri (string) and provider (string). Documentation for this object: https://github.com/open-feature/flagd/blob/main/docs/configuration/configuration.md#sync-provider-customisation
-y, --sync-provider string DEPRECATED: Set a sync provider e.g. filepath or remote
-a, --sync-provider-args stringToString DEPRECATED: Sync provider arguments as key values separated by = (default [])
-f, --uri .yaml/.yml/.json Set a sync provider uri to read data from, this can be a filepath, URL (HTTP and gRPC) or FeatureFlag custom resource. When flag keys are duplicated across multiple providers the merge priority follows the index of the flag arguments, as such flags from the uri at index 0 take the lowest precedence, with duplicated keys being overwritten by those from the uri at index 1. Please note that if you are using filepath, flagd only supports files with .yaml/.yml/.json extension.
-C, --cors-origin strings CORS allowed origins, * will allow all origins
-h, --help help for start
-z, --log-format string Set the logging format, e.g. console or json (default "console")
-m, --management-port int32 Port for management operations (default 8014)
-t, --metrics-exporter string Set the metrics exporter. Default(if unset) is Prometheus. Can be override to otel - OpenTelemetry metric exporter. Overriding to otel require otelCollectorURI to be present
-o, --otel-collector-uri string Set the grpc URI of the OpenTelemetry collector for flagd runtime. If unset, the collector setup will be ignored and traces will not be exported.
-p, --port int32 Port to listen on (default 8013)
-c, --server-cert-path string Server side tls certificate path
-k, --server-key-path string Server side tls key path
-d, --socket-path string Flagd socket path. With grpc the service will become available on this address. With http(s) the grpc-gateway proxy will use this address internally.
-s, --sources string JSON representation of an array of SourceConfig objects. This object contains 2 required fields, uri (string) and provider (string). Documentation for this object: https://github.com/open-feature/flagd/blob/main/docs/configuration/configuration.md#sync-provider-customisation
-f, --uri .yaml/.yml/.json Set a sync provider uri to read data from, this can be a filepath, URL (HTTP and gRPC) or FeatureFlag custom resource. When flag keys are duplicated across multiple providers the merge priority follows the index of the flag arguments, as such flags from the uri at index 0 take the lowest precedence, with duplicated keys being overwritten by those from the uri at index 1. Please note that if you are using filepath, flagd only supports files with .yaml/.yml/.json extension.
```

### Options inherited from parent commands
Expand Down
22 changes: 2 additions & 20 deletions flagd-proxy/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,19 @@ import (

const (
logFormatFlagName = "log-format"
metricsPortFlagName = "metrics-port" // deprecated
managementPortFlagName = "management-port"
portFlagName = "port"
defaultManagementPort = 8016
)

func init() {
flags := startCmd.Flags()

// allows environment variables to use _ instead of -
flags.Int32P(portFlagName, "p", 8015, "Port to listen on")
flags.Int32(metricsPortFlagName, defaultManagementPort, "DEPRECATED: Superseded by --management-port.")
flags.Int32P(managementPortFlagName, "m", defaultManagementPort, "Management port")
flags.Int32P(managementPortFlagName, "m", 8016, "Management port")
flags.StringP(logFormatFlagName, "z", "console", "Set the logging format, e.g. console or json")

_ = viper.BindPFlag(logFormatFlagName, flags.Lookup(logFormatFlagName))
_ = viper.BindPFlag(metricsPortFlagName, flags.Lookup(metricsPortFlagName))
_ = viper.BindPFlag(managementPortFlagName, flags.Lookup(managementPortFlagName))
_ = viper.BindPFlag(portFlagName, flags.Lookup(portFlagName))
}
Expand All @@ -64,29 +60,15 @@ var startCmd = &cobra.Command{
}
logger := logger.NewLogger(l, Debug)

if viper.GetUint16(metricsPortFlagName) != defaultManagementPort {
logger.Warn("DEPRECATED: The --metrics-port flag has been deprecated and is superseded by --management-port.")
}

ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)

syncStore := subscriptions.NewManager(ctx, logger)
s := syncServer.NewServer(logger, syncStore)

// If --management-port is set use that value. If not and
// --metrics-port is set use that value. Otherwise use the default
// value.
managementPort := uint16(defaultManagementPort)
if viper.GetUint16(managementPortFlagName) != defaultManagementPort {
managementPort = viper.GetUint16(managementPortFlagName)
} else if viper.GetUint16(metricsPortFlagName) != defaultManagementPort {
managementPort = viper.GetUint16(metricsPortFlagName)
}

cfg := service.Configuration{
ReadinessProbe: func() bool { return true },
Port: viper.GetUint16(portFlagName),
ManagementPort: managementPort,
ManagementPort: viper.GetUint16(managementPortFlagName),
}

errChan := make(chan error, 1)
Expand Down
Loading

0 comments on commit 8102fcf

Please sign in to comment.