Skip to content

Commit

Permalink
feat(codeflare): support unmanaged and update manifests location
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Oct 5, 2023
1 parent 8d80553 commit e8076fb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 14 additions & 5 deletions components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ func (c *CodeFlare) GetComponentName() string {
var _ components.ComponentInterface = (*CodeFlare)(nil)

func (c *CodeFlare) ReconcileComponent(cli client.Client, owner metav1.Object, dscispec *dsci.DSCInitializationSpec) error {
enabled := c.GetManagementState() == operatorv1.Managed
platform, err := deploy.GetPlatform(cli)
if err != nil {
return err
}

if enabled {
var enabled, unmanaged = false, false
dependentOperator := CodeflareOperator
switch c.GetManagementState() {
case operatorv1.Managed:
enabled = true
// Download manifests and update paths
if err = c.OverrideManifests(string(platform)); err != nil {
return err
}
// check if the CodeFlare operator is installed
// codeflare operator not installed
dependentOperator := CodeflareOperator
// overwrite dependent operator if downstream not match upstream
if platform == deploy.SelfManagedRhods || platform == deploy.ManagedRhods {
dependentOperator = RHCodeflareOperator
Expand All @@ -89,10 +91,17 @@ func (c *CodeFlare) ReconcileComponent(cli client.Client, owner metav1.Object, d
return err
}
}
case operatorv1.Unmanaged:
unmanaged = true
if dscispec.DevFlags.ManifestsUri == "" {
if err := deploy.ApplyImageParams(CodeflarePath, imageParamMap); err != nil {
return err
}
}
}

// Deploy Codeflare
err = deploy.DeployManifestsFromPath(cli, owner, CodeflarePath, dscispec.ApplicationsNamespace, c.GetComponentName(), enabled)
// Deploy Codeflare if it is managed or unmanaged but not removed
err = deploy.DeployManifestsFromPath(cli, owner, CodeflarePath, dscispec.ApplicationsNamespace, c.GetComponentName(), enabled || unmanaged)
return err
}

Expand Down
4 changes: 3 additions & 1 deletion components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ type Component struct {
// - "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
//
// +kubebuilder:validation:Enum=Managed;Removed
// - "Unmanaged" : the operator will not take any action related to the component
//
// +kubebuilder:validation:Enum=Managed;Removed;Unmanaged
ManagementState operatorv1.ManagementState `json:"managementState,omitempty"`
// Add any other common fields across components below

Expand Down
4 changes: 2 additions & 2 deletions get_all_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ 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: workbench, modelmesh, monitoring, etc
declare -A COMPONENT_MANIFESTS=(
["codeflare"]="opendatahub-io:distributed-workloads:main:codeflare-stack:codeflare"
["ray"]="opendatahub-io:distributed-workloads:main:ray:ray"
["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"
["kf-notebook-controller"]="opendatahub-io:kubeflow:v1.7-branch:components/notebook-controller/config:odh-notebook-controller/kf-notebook-controller"
Expand Down

0 comments on commit e8076fb

Please sign in to comment.