From a6cc964f6f424e574ad481b4a0bce2a2f368936c Mon Sep 17 00:00:00 2001 From: odubajDT Date: Thu, 16 Nov 2023 13:01:38 +0100 Subject: [PATCH] fix Signed-off-by: odubajDT --- Makefile | 2 +- apis/core/v1beta1/common/common_test.go | 22 ++++++++----------- .../flagdinjector/fake/flagdinjector_mock.go | 4 ++-- ...re.openfeature.dev_featureflagsources.yaml | 6 ++--- docs/crds.md | 4 ++-- webhooks/pod_webhook.go | 5 ----- 6 files changed, 17 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index aa880d5ad..6f1cfa479 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ CRDOC ?= $(LOCALBIN)/crdoc KUSTOMIZE_VERSION ?= v4.5.7 # renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools CONTROLLER_TOOLS_VERSION ?= v0.10.0 -CRDOC_VERSION ?= v0.7.0 +CRDOC_VERSION ?= v0.6.2 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize diff --git a/apis/core/v1beta1/common/common_test.go b/apis/core/v1beta1/common/common_test.go index 4bc0efb96..32a69fae1 100644 --- a/apis/core/v1beta1/common/common_test.go +++ b/apis/core/v1beta1/common/common_test.go @@ -6,18 +6,6 @@ import ( "github.com/stretchr/testify/require" ) -func Test_FLagSourceConfiguration_EnvVarKey(t *testing.T) { - require.Equal(t, "pre_suf", EnvVarKey("pre", "suf")) -} - -func Test_FLagSourceConfiguration_FeatureFlagConfigurationId(t *testing.T) { - require.Equal(t, "pre_suf", FeatureFlagConfigurationId("pre", "suf")) -} - -func Test_FLagSourceConfiguration_FeatureFlagConfigMapKey(t *testing.T) { - require.Equal(t, "pre_suf.flagd.json", FeatureFlagConfigMapKey("pre", "suf")) -} - func Test_FeatureFlagSource_SyncProvider(t *testing.T) { k := SyncProviderKubernetes f := SyncProviderFilepath @@ -35,6 +23,14 @@ func Test_FeatureFlagSource_SyncProvider(t *testing.T) { require.False(t, g.IsHttp()) } -func Test_FLagSourceConfiguration_envVarKey(t *testing.T) { +func Test_FLagSourceConfiguration_EnvVarKey(t *testing.T) { require.Equal(t, "pre_suf", EnvVarKey("pre", "suf")) } + +func Test_FLagSourceConfiguration_FeatureFlagConfigurationId(t *testing.T) { + require.Equal(t, "pre_suf", FeatureFlagConfigurationId("pre", "suf")) +} + +func Test_FLagSourceConfiguration_FeatureFlagConfigMapKey(t *testing.T) { + require.Equal(t, "pre_suf.flagd.json", FeatureFlagConfigMapKey("pre", "suf")) +} diff --git a/common/flagdinjector/fake/flagdinjector_mock.go b/common/flagdinjector/fake/flagdinjector_mock.go index 319c83b28..150db2954 100644 --- a/common/flagdinjector/fake/flagdinjector_mock.go +++ b/common/flagdinjector/fake/flagdinjector_mock.go @@ -6,11 +6,11 @@ package commonmock import ( context "context" - reflect "reflect" gomock "github.com/golang/mock/gomock" api "github.com/open-feature/open-feature-operator/apis/core/v1beta1" v1 "k8s.io/api/core/v1" v10 "k8s.io/apimachinery/pkg/apis/meta/v1" + reflect "reflect" ) // MockFlagdContainerInjector is a mock of IFlagdContainerInjector interface. @@ -62,4 +62,4 @@ func (m *MockFlagdContainerInjector) InjectFlagd(ctx context.Context, objectMeta func (mr *MockFlagdContainerInjectorMockRecorder) InjectFlagd(ctx, objectMeta, podSpec, flagSourceConfig interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectFlagd", reflect.TypeOf((*MockFlagdContainerInjector)(nil).InjectFlagd), ctx, objectMeta, podSpec, flagSourceConfig) -} \ No newline at end of file +} diff --git a/config/crd/bases/core.openfeature.dev_featureflagsources.yaml b/config/crd/bases/core.openfeature.dev_featureflagsources.yaml index 3f1452a75..534b071b7 100644 --- a/config/crd/bases/core.openfeature.dev_featureflagsources.yaml +++ b/config/crd/bases/core.openfeature.dev_featureflagsources.yaml @@ -170,9 +170,9 @@ spec: description: LogFormat allows for the sidecar log format to be overridden, defaults to 'json' type: string - metricsPort: - description: MetricsPort defines the port to serve metrics on, defaults - to 8014 + managementPort: + description: ManagemetPort defines the port to serve management on, + defaults to 8014 format: int32 type: integer otelCollectorUri: diff --git a/docs/crds.md b/docs/crds.md index 1b767149b..3c0832885 100644 --- a/docs/crds.md +++ b/docs/crds.md @@ -306,10 +306,10 @@ FeatureFlagSourceSpec defines the desired state of FeatureFlagSource false - metricsPort + managementPort integer - MetricsPort defines the port to serve metrics on, defaults to 8014
+ ManagemetPort defines the port to serve management on, defaults to 8014

Format: int32
diff --git a/webhooks/pod_webhook.go b/webhooks/pod_webhook.go index 630972ec2..45b1da869 100644 --- a/webhooks/pod_webhook.go +++ b/webhooks/pod_webhook.go @@ -53,11 +53,6 @@ func (m *PodMutator) Handle(ctx context.Context, req admission.Request) admissio return admission.Errored(http.StatusBadRequest, err) } - //TODO check this - if pod.Namespace == "" { - pod.Namespace = req.Namespace - } - annotations := pod.GetAnnotations() // Check enablement if !checkOFEnabled(annotations) {