From 3d410fed5feb7a36a927f2c7ee0b4237eff87f89 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 21 Mar 2023 10:18:28 +0800 Subject: [PATCH] Fix: system crd validation hook should not always use the default vela system (#5711) Signed-off-by: Somefive (cherry picked from commit b4b0f99f4144e74db46612f273856e3329f7c088) Co-authored-by: Somefive --- cmd/core/app/hooks/pre_start_hook.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/core/app/hooks/pre_start_hook.go b/cmd/core/app/hooks/pre_start_hook.go index c8686983c..05f4cd398 100644 --- a/cmd/core/app/hooks/pre_start_hook.go +++ b/cmd/core/app/hooks/pre_start_hook.go @@ -22,6 +22,7 @@ import ( "time" "github.com/kubevela/pkg/util/compression" + "github.com/kubevela/pkg/util/k8s" "github.com/kubevela/pkg/util/singleton" "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" @@ -55,7 +56,7 @@ func (in *SystemCRDValidationHook) Run(ctx context.Context) error { feature.DefaultMutableFeatureGate.Enabled(features.GzipApplicationRevision) { appRev := &v1beta1.ApplicationRevision{} appRev.Name = fmt.Sprintf("core.pre-check.%d", time.Now().UnixNano()) - appRev.Namespace = types.DefaultKubeVelaNS + appRev.Namespace = k8s.GetRuntimeNamespace() key := client.ObjectKeyFromObject(appRev) appRev.SetLabels(map[string]string{oam.LabelPreCheck: types.VelaCoreName}) appRev.Spec.Application.Name = appRev.Name