Skip to content

Commit

Permalink
feat(mr): create namespace for Model Registry (opendatahub-io#930)
Browse files Browse the repository at this point in the history
* feat(mr): create namespace for smm

Signed-off-by: Wen Zhou <[email protected]>

* fix: rebase

Signed-off-by: Zhou, Wen <[email protected]>

* update: code review comments

Signed-off-by: Wen Zhou <[email protected]>

* fix(doc): wrong comments

Signed-off-by: Wen Zhou <[email protected]>

* update: remove label to keep namespace even opreator is uninstalled

Signed-off-by: Wen Zhou <[email protected]>

---------

Signed-off-by: Wen Zhou <[email protected]>
Signed-off-by: Zhou, Wen <[email protected]>
  • Loading branch information
zdtsw authored Apr 8, 2024
1 parent 562ae3d commit 1188ce1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1188ce1

Please sign in to comment.