From 2ce4cdb81749c38ef7dd4a21171d71cbfec75d43 Mon Sep 17 00:00:00 2001 From: apavlitschenko Date: Thu, 21 Nov 2024 11:38:06 +0100 Subject: [PATCH 1/2] Added config.jsonnet to generate libs for the CRDs of the OpenFeatureOperator --- libs/openfeature/config.jsonnet | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 libs/openfeature/config.jsonnet diff --git a/libs/openfeature/config.jsonnet b/libs/openfeature/config.jsonnet new file mode 100644 index 00000000..b45f1392 --- /dev/null +++ b/libs/openfeature/config.jsonnet @@ -0,0 +1,24 @@ +# libs//config.jsonnet +local config = import 'jsonnet/config.jsonnet'; +local versions = [ + { tag: "v0.8.1", version: "0.8" }, + { tag: "v0.7.2", version: "0.7" }, + { tag: "v0.6.1", version: "0.6" }, + { tag: "v0.5.7", version: "0.5" }, + { tag: "v0.2.36", version: "0.2" }, + { tag: "v0.1.1", version: "0.1" }, + { tag: "v0.0.9", version: "0.0" }, +]; + +config.new( + name='openfeature', + specs=[ + { + output: v.version, + crds: ['https://github.com/open-feature/open-feature-operator/releases/download/%s/release.yaml' % v.tag] , + prefix: '^dev\\.openfeature\\.core\\..*', + localName: 'openfeature', + }, + for v in versions + ] +) From d44bb56dbad2a8be9f6fd4ae388f56fa92ecc174 Mon Sep 17 00:00:00 2001 From: apavlitschenko Date: Thu, 21 Nov 2024 11:47:32 +0100 Subject: [PATCH 2/2] Dirty-fix for known bug #307: Ignore keys containing '$'. --- pkg/builder/objects.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/builder/objects.go b/pkg/builder/objects.go index 085e15af..c18dd365 100644 --- a/pkg/builder/objects.go +++ b/pkg/builder/objects.go @@ -2,6 +2,7 @@ package builder import ( "fmt" + "log" "strings" ) @@ -82,6 +83,7 @@ func (o ObjectType) ConciseString() string { func printChildren(children map[string]Type, order []string, s string) string { j := "" + order = removeStringsWithDollar(order) for _, name := range order { c := children[name] colon := ":" @@ -119,3 +121,15 @@ func printChildren(children map[string]Type, order []string, s string) string { j = strings.TrimSuffix(j, s) return j } + +func removeStringsWithDollar(input []string) []string { + var result []string + for _, str := range input { + if !strings.Contains(str, "$") { + result = append(result, str) + } else { + log.Default().Printf("Warning: %s contains a '$' and has been ommited from final libsonnet as a temporary fix", str) + } + } + return result +}