Skip to content

Commit 1188ce1

Browse files
authored
feat(mr): create namespace for Model Registry (#930)
* feat(mr): create namespace for smm Signed-off-by: Wen Zhou <wenzhou@redhat.com> * fix: rebase Signed-off-by: Zhou, Wen <wenzhou@redhat.com> * update: code review comments Signed-off-by: Wen Zhou <wenzhou@redhat.com> * fix(doc): wrong comments Signed-off-by: Wen Zhou <wenzhou@redhat.com> * update: remove label to keep namespace even opreator is uninstalled Signed-off-by: Wen Zhou <wenzhou@redhat.com> --------- Signed-off-by: Wen Zhou <wenzhou@redhat.com> Signed-off-by: Zhou, Wen <wenzhou@redhat.com>
1 parent 562ae3d commit 1188ce1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/modelregistry/modelregistry.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ import (
1414

1515
dsciv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
1616
"github.com/opendatahub-io/opendatahub-operator/v2/components"
17+
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
1718
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/deploy"
1819
)
1920

2021
var (
2122
ComponentName = "model-registry-operator"
2223
Path = deploy.DefaultManifestPath + "/" + ComponentName + "/overlays/odh"
24+
// we should not apply this label to the namespace, as it triggered namspace deletion during operator uninstall
25+
// modelRegistryLabels = cluster.WithLabels(
26+
// labels.ODH.OwnedNamespace, "true",
27+
// ).
2328
)
2429

2530
// Verifies that ModelRegistry implements ComponentInterface.
@@ -82,6 +87,13 @@ func (m *ModelRegistry) ReconcileComponent(_ context.Context, cli client.Client,
8287
return fmt.Errorf("failed to update image from %s : %w", Path, err)
8388
}
8489
}
90+
91+
// Create odh-model-registries namespace
92+
// We do not delete this namespace even when ModelRegistry is Removed or when operator is uninstalled.
93+
_, err := cluster.CreateNamespace(cli, "odh-model-registries")
94+
if err != nil {
95+
return err
96+
}
8597
}
8698
// Deploy ModelRegistry Operator
8799
err = deploy.DeployManifestsFromPath(cli, owner, Path, dscispec.ApplicationsNamespace, m.GetComponentName(), enabled)

0 commit comments

Comments
 (0)