Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c3adbc5
fix: fixing null pointer exception error (#1709)
Ayushman-Gaur Apr 21, 2026
065763f
chore(main): release dev.openfeature.contrib.tools.flagdcore 1.0.1 (#…
openfeaturebot Apr 22, 2026
23f5799
feat: add GCP Secret Manager OpenFeature provider
mahpatil Apr 24, 2026
a917da4
fix: simplify and strengthen FlagCacheCTest concurrent expiry test
mahpatil Apr 24, 2026
f73f21c
Revert "fix: simplify and strengthen FlagCacheCTest concurrent expiry…
mahpatil Apr 24, 2026
41ec35a
fix: rewrite FlagCacheCTest with correct VmLens structure
mahpatil Apr 24, 2026
44c2ef1
test: add VmLens concurrent test for get on timed-out entry with insert
mahpatil Apr 25, 2026
177b40c
Rename provider to gcp
mahpatil May 12, 2026
26a50a6
refactor: use @BeforeEach fixtures in concurrentExpiryAndInsertDoNotL…
mahpatil Apr 27, 2026
836b27f
fix(gofeatureflag): issue when using inProcess with high concurency (…
thomaspoignant Apr 25, 2026
28aa584
chore(main): release dev.openfeature.contrib.providers.go-feature-fla…
openfeaturebot Apr 25, 2026
1a0c292
Refactor tests and samples for gcp provider
mahpatil May 12, 2026
4db90cd
Restore flagd-core tools back to upstream
mahpatil May 12, 2026
18823d1
Merge branch 'main' into feat/gcp-secret-manager
mahpatil May 12, 2026
ae8f727
Update all other references to secret manager to gcp
mahpatil May 12, 2026
f0949f2
Fix spotless:checks
mahpatil May 12, 2026
7544afd
Fix compilation errors - passing mvn tests
mahpatil May 12, 2026
04f14cd
Refactor GcpProviderOptions to reduce duplication
mahpatil May 12, 2026
11a0ad3
Add GcpProviderOptions
mahpatil May 12, 2026
a9dd1eb
Fix spotless:checks
mahpatil May 12, 2026
68fbf35
Fix compilation errors - passing mvn tests
mahpatil May 12, 2026
fe78e94
Refactor GcpProviderOptions to reduce duplication
mahpatil May 12, 2026
13dc277
Add GcpProviderOptions
mahpatil May 12, 2026
a3e904c
Merge branch 'feat/gcp-secret-manager' of https://github.com/mahpatil…
mahpatil May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"providers/statsig": "0.2.1",
"providers/multiprovider": "0.0.3",
"providers/ofrep": "0.0.1",
"providers/gcp": "0.0.1",
"tools/junit-openfeature": "0.2.1",
"tools/flagd-http-connector": "0.0.4",
"tools/flagd-api": "1.0.0",
Expand Down
58 changes: 37 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8" ?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>

<groupId>dev.openfeature.contrib</groupId>
Expand Down Expand Up @@ -45,19 +48,23 @@
<module>providers/optimizely</module>
<module>providers/multiprovider</module>
<module>providers/ofrep</module>
<module>providers/gcp</module>
<module>tools/flagd-http-connector</module>
</modules>

<scm>
<connection>scm:git:https://github.com/open-feature/java-sdk-contrib.git</connection>
<developerConnection>scm:git:https://github.com/open-feature/java-sdk-contrib.git</developerConnection>
<connection
>scm:git:https://github.com/open-feature/java-sdk-contrib.git</connection>
<developerConnection
>scm:git:https://github.com/open-feature/java-sdk-contrib.git</developerConnection>
<url>https://github.com/open-feature/java-sdk-contrib</url>
</scm>

<properties>
<toolchain.jdk.version>[21,)</toolchain.jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.reporting.outputEncoding
>UTF-8</project.reporting.outputEncoding>
<module-name>${groupId}.${artifactId}</module-name>
<javadoc.failOnWarnings>true</javadoc.failOnWarnings>
<!-- This is required for later correct replacement of surefireArgLine -->
Expand Down Expand Up @@ -237,7 +244,8 @@
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>${module-name}</Automatic-Module-Name>
<Automatic-Module-Name
>${module-name}</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -285,8 +293,10 @@
</executions>
<configuration>
<skip>${maven.deploy.skip}</skip>
<repository>https://repo1.maven.org/maven2</repository>
<snapshotRepository>https://central.sonatype.com/repository/maven-snapshots</snapshotRepository>
<repository
>https://repo1.maven.org/maven2</repository>
<snapshotRepository
>https://central.sonatype.com/repository/maven-snapshots</snapshotRepository>
<snapshotServerId>central</snapshotServerId>
</configuration>
</plugin>
Expand All @@ -310,7 +320,8 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<failOnWarnings>${javadoc.failOnWarnings}</failOnWarnings>
<failOnWarnings
>${javadoc.failOnWarnings}</failOnWarnings>
<excludePackageNames>
dev.openfeature.flagd.grpc
</excludePackageNames>
Expand Down Expand Up @@ -338,7 +349,8 @@
<configuration>
<projectType>library</projectType>
<schemaVersion>1.3</schemaVersion>
<includeBomSerialNumber>true</includeBomSerialNumber>
<includeBomSerialNumber
>true</includeBomSerialNumber>
<includeCompileScope>true</includeCompileScope>
<includeProvidedScope>true</includeProvidedScope>
<includeRuntimeScope>true</includeRuntimeScope>
Expand Down Expand Up @@ -384,7 +396,8 @@
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<skipPublishing>${maven.deploy.skip}</skipPublishing>
<skipPublishing
>${maven.deploy.skip}</skipPublishing>
</configuration>
</plugin>
<!-- End publish to maven central -->
Expand Down Expand Up @@ -412,7 +425,8 @@
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<excludeGeneratedSources>true</excludeGeneratedSources>
<excludeGeneratedSources
>true</excludeGeneratedSources>
</configuration>
<dependencies>
<dependency>
Expand All @@ -437,7 +451,8 @@
<artifactId>maven-pmd-plugin</artifactId>
<version>3.28.0</version>
<configuration>
<excludeRoots>${basedir}/target/generated-sources/</excludeRoots>
<excludeRoots
>${basedir}/target/generated-sources/</excludeRoots>
</configuration>
<executions>
<execution>
Expand All @@ -456,7 +471,8 @@
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.9.8.3</version>
<configuration>
<excludeFilterFile>spotbugs-exclusions.xml</excludeFilterFile>
<excludeFilterFile
>spotbugs-exclusions.xml</excludeFilterFile>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
Expand Down Expand Up @@ -501,8 +517,8 @@
<include>.gitignore</include>
</includes>
<!-- define the steps to apply to those files -->
<trimTrailingWhitespace/>
<endWithNewline/>
<trimTrailingWhitespace />
<endWithNewline />
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
Expand All @@ -511,16 +527,16 @@
</formats>
<!-- define a language-specific format -->
<java>
<palantirJavaFormat/>
<palantirJavaFormat />

<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
<importOrder/>
<importOrder />

<removeUnusedImports/>
<formatAnnotations/>
<removeUnusedImports />
<formatAnnotations />

</java>
</configuration>
Expand Down
7 changes: 7 additions & 0 deletions providers/gcp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## 0.0.1

### ✨ New Features

* Initial release with scaffolding for Google Cloud and GCP Secret Manager OpenFeature provider.
121 changes: 121 additions & 0 deletions providers/gcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# GCP Provider

An OpenFeature provider that reads feature flags from Google Cloud. Currently supports [Google Cloud Secret Manager](https://cloud.google.com/secret-manager), purpose-built for secrets requiring versioning, rotation, and fine-grained IAM access control.

## Installation

<!-- x-release-please-start-version -->
```xml
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>gcp</artifactId>
<version>0.0.1</version>
</dependency>
```
<!-- x-release-please-end-version -->

## Quick Start

```java
import dev.openfeature.contrib.providers.gcp.GcpSecretManagerProvider;
import dev.openfeature.contrib.providers.gcp.GcpSecretManagerProviderOptions;
import dev.openfeature.sdk.OpenFeatureAPI;

GcpSecretManagerProviderOptions options = GcpSecretManagerProviderOptions.builder()
.projectId("my-gcp-project")
.build();

OpenFeatureAPI.getInstance().setProvider(new GcpSecretManagerProvider(options));

// Evaluate a boolean flag stored as secret "enable-dark-mode" with value "true"
boolean darkMode = OpenFeatureAPI.getInstance().getClient()
.getBooleanValue("enable-dark-mode", false);
```

## How It Works

Each feature flag is stored as an individual **secret** in GCP Secret Manager. The flag key maps directly to the secret name (with an optional prefix). The `latest` version is accessed by default.

Supported raw value formats:

| Flag type | Secret value example |
|-----------|---------------------|
| Boolean | `true` or `false` |
| Integer | `42` |
| Double | `3.14` |
| String | `dark-mode` |
| Object | `{"color":"blue","level":3}` |

## Authentication

The provider uses [Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/provide-credentials-adc) by default. No explicit credentials are required when running on GCP infrastructure (Cloud Run, GKE, Compute Engine) or when `gcloud auth application-default login` has been run locally.

To use explicit credentials:

```java
import com.google.auth.oauth2.ServiceAccountCredentials;
import java.io.FileInputStream;

GoogleCredentials credentials = ServiceAccountCredentials.fromStream(
new FileInputStream("/path/to/service-account-key.json"));

GcpSecretManagerProviderOptions options = GcpSecretManagerProviderOptions.builder()
.projectId("my-gcp-project")
.credentials(credentials)
.build();
```

## Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `projectId` | `String` | *(required)* | GCP project ID that owns the secrets |
| `credentials` | `GoogleCredentials` | `null` (ADC) | Explicit credentials; falls back to Application Default Credentials when null |
| `secretVersion` | `String` | `"latest"` | Secret version to access. Use `"latest"` for the current version or a numeric string (e.g. `"3"`) to pin to a specific version |
| `cacheExpiry` | `Duration` | `5 minutes` | How long fetched secret values are cached before re-fetching from GCP |
| `cacheMaxSize` | `int` | `500` | Maximum number of secret values held in the in-memory cache |
| `namePrefix` | `String` | `null` | Optional prefix prepended to every flag key. E.g. prefix `"ff-"` maps flag `"my-flag"` to secret `"ff-my-flag"` |

## Advanced Usage

### Pinning to a specific secret version

```java
GcpSecretManagerProviderOptions options = GcpSecretManagerProviderOptions.builder()
.projectId("my-gcp-project")
.secretVersion("5") // always use version 5
.build();
```

### Secret name prefix

```java
GcpSecretManagerProviderOptions options = GcpSecretManagerProviderOptions.builder()
.projectId("my-gcp-project")
.namePrefix("feature-flags/")
.build();
```

### Tuning cache for high-throughput scenarios

Secret Manager has API quotas (10,000 access operations per minute per project). Use a longer `cacheExpiry` to stay within quota.

```java
GcpSecretManagerProviderOptions options = GcpSecretManagerProviderOptions.builder()
.projectId("my-gcp-project")
.cacheExpiry(Duration.ofMinutes(10))
.cacheMaxSize(1000)
.build();
```

## Running Integration Tests

Integration tests require real GCP credentials and pre-created test secrets.

1. Configure ADC: `gcloud auth application-default login`
2. Create test secrets in your project (see `GcpSecretManagerProviderIntegrationTest` for the required secret names and values)
3. Run:

```bash
GCP_PROJECT_ID=my-project mvn verify -pl providers/gcp -Dgroups=integration
```
Loading
Loading