Skip to content

Commit

Permalink
update(codeflare): new path to manifests
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Oct 19, 2023
1 parent a38e31f commit 7c7cda2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,49 +361,6 @@ spec:
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
trustyai:
description: TrustyAI component configuration.
properties:
devFlags:
description: Add developer fields
properties:
manifests:
description: List of custom manifests for the given component
items:
properties:
contextDir:
default: ""
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
sourcePath:
default: ""
description: 'sourcePath is the subpath within contextDir
where kustomize builds start. Examples include
any sub-folder or path: `base`, `overlays/dev`,
`default`, `odh` etc'
type: string
uri:
default: ""
description: uri is the URI point to a git repo
with tag/branch. e.g https://github.com/org/repo/tarball/<tag/branch>
type: string
type: object
type: array
type: object
managementState:
description: "Set to one of the following values: \n - \"Managed\"
: the operator is actively managing the component and trying
to keep it active. It will only upgrade the component if
it is safe to do so \n - \"Removed\" : the operator is actively
managing the component and will not install it, or if it
is installed, the operator will try to remove it"
enum:
- Managed
- Removed
pattern: ^(Managed|Unmanaged|Force|Removed)$
type: string
type: object
workbenches:
description: Workbenches component configuration.
properties:
Expand Down
42 changes: 23 additions & 19 deletions components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package codeflare

import (
"fmt"

"path/filepath"

dsci "github.com/opendatahub-io/opendatahub-operator/v2/apis/dscinitialization/v1"
Expand All @@ -17,7 +16,7 @@ import (

var (
ComponentName = "codeflare"
CodeflarePath = deploy.DefaultManifestPath + "/" + ComponentName + "/base"
CodeflarePath = deploy.DefaultManifestPath + "/" + ComponentName + "/manifests"
CodeflareOperator = "codeflare-operator"
RHCodeflareOperator = "rhods-codeflare-operator"
)
Expand Down Expand Up @@ -52,9 +51,8 @@ var _ components.ComponentInterface = (*CodeFlare)(nil)

func (c *CodeFlare) ReconcileComponent(cli client.Client, owner metav1.Object, dscispec *dsci.DSCInitializationSpec) error {
var imageParamMap = map[string]string{
"odh-codeflare-operator-image": "RELATED_IMAGE_ODH_CODEFLARE_OPERATOR_IMAGE",
"odh-mcad-controller-image": "RELATED_IMAGE_ODH_MCAD_CONTROLLER_IMAGE",
"namespace": dscispec.ApplicationsNamespace,
"odh-codeflare-operator-controller-image": "RELATED_IMAGE_ODH_CODEFLARE_OPERATOR_IMAGE", // no need mcad, embedded in cfo
"namespace": dscispec.ApplicationsNamespace,
}
platform, err := deploy.GetPlatform(cli)
if err != nil {
Expand All @@ -71,35 +69,41 @@ func (c *CodeFlare) ReconcileComponent(cli client.Client, owner metav1.Object, d
// check if the CodeFlare operator is installed
// codeflare operator not installed
// overwrite dependent operator if downstream not match upstream
if platform == deploy.SelfManagedRhods || platform == deploy.ManagedRhods {
dependentOperator = RHCodeflareOperator
}

if found, err := deploy.OperatorExists(cli, dependentOperator); err != nil {
return err
} else if !found {
return fmt.Errorf("operator %s not found. Please install the operator before enabling %s component",
dependentOperator, ComponentName)
}
// No need check operator, we will install it
// if found, err := deploy.OperatorExists(cli, dependentOperator); err != nil {
// return err
// } else if !found {
// return fmt.Errorf("operator %s not found. Please install the operator before enabling %s component",
// dependentOperator, ComponentName)
// }

// Update image parameters only when we do not have customized manifests set
if dscispec.DevFlags.ManifestsUri == "" && len(c.DevFlags.Manifests) == 0 {
if err := deploy.ApplyParams(CodeflarePath, c.SetImageParamsMap(imageParamMap), true); err != nil {
if err := deploy.ApplyParams(CodeflarePath+"/base", c.SetImageParamsMap(imageParamMap), true); err != nil {
return err
}
}
// Deploy Codeflare if it is managed
err = deploy.DeployManifestsFromPath(cli, owner, CodeflarePath, dscispec.ApplicationsNamespace, c.GetComponentName(), operatorv1.Managed)
return err
case operatorv1.Unmanaged:
if platform == deploy.SelfManagedRhods || platform == deploy.ManagedRhods {
dependentOperator = RHCodeflareOperator
}
if dscispec.DevFlags.ManifestsUri == "" && len(c.DevFlags.Manifests) == 0 {
if err := deploy.ApplyParams(CodeflarePath, c.SetImageParamsMap(imageParamMap), true); err != nil {
if err := deploy.ApplyParams(CodeflarePath+"/base", c.SetImageParamsMap(imageParamMap), true); err != nil {
return err
}
}
// Deploy Codeflare if it is unmanaged
err = deploy.DeployManifestsFromPath(cli, owner, CodeflarePath, dscispec.ApplicationsNamespace, c.GetComponentName(), operatorv1.Unmanaged)
return err
// check if CFO already there
if found, err := deploy.OperatorExists(cli, dependentOperator); err != nil {
return err
} else if found {
// TODO: event: tell user to delete it
fmt.Printf("user need to uninstall: " + dependentOperator)
return nil
}
}
return nil
}
Expand Down
3 changes: 1 addition & 2 deletions get_all_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ MANIFESTS_TARBALL_URL="${GITHUB_URL}/${MANIFEST_ORG}/odh-manifests/tarball/${MAN
# component: dsp, kserve, dashbaord, cf/ray. in the format of "repo-org:repo-name:branch-name:source-folder:target-folder"
# TODO: modelmesh, kserve, etc
declare -A COMPONENT_MANIFESTS=(
# ["codeflare"]="opendatahub-io:codeflare-operator:main:config:codeflare"
["codeflare"]="opendatahub-io:distributed-workloads:main:codeflare-stack:codeflare"
["codeflare"]="opendatahub-io:codeflare-operator:main:config:codeflare"
["ray"]="opendatahub-io:kuberay:master:ray-operator/config:ray"
["data-science-pipelines-operator"]="opendatahub-io:data-science-pipelines-operator:main:config:data-science-pipelines-operator"
["odh-dashboard"]="opendatahub-io:odh-dashboard:incubation:manifests:odh-dashboard"
Expand Down

0 comments on commit 7c7cda2

Please sign in to comment.