From 1188ce1576078a5fc16872fca78c4c004aa0c721 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Mon, 8 Apr 2024 18:23:48 +0200 Subject: [PATCH] feat(mr): create namespace for Model Registry (#930) * feat(mr): create namespace for smm Signed-off-by: Wen Zhou * fix: rebase Signed-off-by: Zhou, Wen * update: code review comments Signed-off-by: Wen Zhou * fix(doc): wrong comments Signed-off-by: Wen Zhou * update: remove label to keep namespace even opreator is uninstalled Signed-off-by: Wen Zhou --------- Signed-off-by: Wen Zhou Signed-off-by: Zhou, Wen --- components/modelregistry/modelregistry.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/modelregistry/modelregistry.go b/components/modelregistry/modelregistry.go index ec8e2ab6e3e..d76c07a1026 100644 --- a/components/modelregistry/modelregistry.go +++ b/components/modelregistry/modelregistry.go @@ -14,12 +14,17 @@ import ( dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1" "github.com/opendatahub-io/opendatahub-operator/v2/components" + "github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" "github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy" ) var ( ComponentName = "model-registry-operator" Path = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/odh" + // we should not apply this label to the namespace, as it triggered namspace deletion during operator uninstall + // modelRegistryLabels = cluster.WithLabels( + // labels.ODH.OwnedNamespace, "true", + // ). ) // Verifies that ModelRegistry implements ComponentInterface. @@ -82,6 +87,13 @@ func (m *ModelRegistry) ReconcileComponent(_ context.Context, cli client.Client, return fmt.Errorf("failed to update image from %s : %w", Path, err) } } + + // Create odh-model-registries namespace + // We do not delete this namespace even when ModelRegistry is Removed or when operator is uninstalled. + _, err := cluster.CreateNamespace(cli, "odh-model-registries") + if err != nil { + return err + } } // Deploy ModelRegistry Operator err = deploy.DeployManifestsFromPath(cli, owner, Path, dscispec.ApplicationsNamespace, m.GetComponentName(), enabled)