Skip to content

Commit f8173a4

Browse files
NilushiyaNilushiya.Ktoddbaertgemini-code-assist[bot]beeme1mr
authored
feat: metadata support in the kubernetes_sync (#1905)
## This PR - Preserve FeatureFlag metadata when syncing from Kubernetes by marshalling `spec.flagSpec` directly from unstructured objects. - Harden informer tombstone handling and watcher readiness for Kubernetes sync. - Add unit tests covering metadata preservation and tombstone unwrap. ### Related Issues Fixes # #754 (CRD definition is not following the latest flagD specifications) - in the [open-feature-operator](https://github.com/open-feature/open-feature-operator) already rased the pr for open-feature-operator CRD support for metaData - (open-feature/open-feature-operator#808 that alone is not enough, so in Flagd also want to change. This PR refers to that. ### Notes - Architecture unchanged; only Kubernetes sync path touched. - No dependency/version changes. ### Follow-up Tasks - None. This change keeps the Kubernetes sync path working with metadata by treating FeatureFlag resources as unstructured objects and marshaling spec.flagSpec directly. That avoids converting into typed CRDs (which can drop unknown fields like metadata) and ensures delete tombstones are handled safely, so the synced payload now preserves any metadata the CRD allows. ### How to test 1) From repo root: - `cd core && GOPATH=/tmp/go GOCACHE=/tmp/go-build go test ./pkg/sync/kubernetes` 2) (Optional) Build and run your existing workflow to confirm metadata is present end-to-end. --------- Signed-off-by: Nilushiya.K <Nilushiya.K@cloudsolutions.com.sa> Signed-off-by: Todd Baert <todd.baert@dynatrace.com> Signed-off-by: Nilushiya Kaneshalingam <107831659+Nilushiya@users.noreply.github.com> Co-authored-by: Nilushiya.K <Nilushiya.K@cloudsolutions.com.sa> Co-authored-by: Todd Baert <todd.baert@dynatrace.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
1 parent 5fa86c6 commit f8173a4

4 files changed

Lines changed: 144 additions & 166 deletions

File tree

core/go.mod

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/google/uuid v1.6.0
1414
github.com/hashicorp/go-memdb v1.3.5
1515
github.com/open-feature/flagd-schemas v0.2.13
16-
github.com/open-feature/open-feature-operator/apis v0.2.45
16+
github.com/open-feature/open-feature-operator/api v0.2.47
1717
github.com/prometheus/client_golang v1.23.2
1818
github.com/robfig/cron v1.2.0
1919
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
@@ -89,7 +89,6 @@ require (
8989
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
9090
github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect
9191
github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect
92-
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
9392
github.com/felixge/httpsnoop v1.0.4 // indirect
9493
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
9594
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
@@ -129,9 +128,6 @@ require (
129128
github.com/spf13/pflag v1.0.6 // indirect
130129
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
131130
github.com/x448/float16 v0.8.4 // indirect
132-
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
133-
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
134-
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
135131
go.opencensus.io v0.24.0 // indirect
136132
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
137133
go.opentelemetry.io/contrib/bridges/prometheus v0.67.0 // indirect
@@ -159,21 +155,19 @@ require (
159155
golang.org/x/text v0.35.0 // indirect
160156
golang.org/x/time v0.11.0 // indirect
161157
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
162-
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
163158
google.golang.org/api v0.235.0 // indirect
164159
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
165160
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
166161
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
167162
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
168163
gopkg.in/inf.v0 v0.9.1 // indirect
169164
k8s.io/api v0.33.2 // indirect
170-
k8s.io/apiextensions-apiserver v0.31.1 // indirect
171165
k8s.io/klog/v2 v2.130.1 // indirect
172166
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
173-
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
174-
sigs.k8s.io/controller-runtime v0.19.3 // indirect
167+
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
168+
sigs.k8s.io/controller-runtime v0.20.1 // indirect
175169
sigs.k8s.io/gateway-api v1.2.1 // indirect
176-
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
170+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
177171
sigs.k8s.io/randfill v1.0.0 // indirect
178172
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
179173
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)