Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize Internal APIs for components #1304

Conversation

VaishnaviHire
Copy link
Member

@VaishnaviHire VaishnaviHire commented Oct 14, 2024

Description

This PR includes following changes. Some of the items are yet to be completed:

  • Define Internal API structs for components
  • Implement one component controller (Dashboard)
  • Move away from ComponentInterface
  • Update and add Tests
  • Update an add statuses
  • Update the DataScienceCluster controller

How Has This Been Tested?

CatalogSource: quay.io/vhire/opendatahub-operator-catalog:v2.19.4

  1. Install operator by deploying above catalogsource
  2. Create DSCI
  3. Create DSC (only enable Dashboard)
  4. Verify Dashboard CR is created
  5. Verify Dashboard resources are deployed

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
Comment on lines 274 to 280
DeleteFunc: func(e event.DeleteEvent) bool {
labelList := e.Object.GetLabels()
if value, exist := labelList[labels.ODH.Component(ComponentNameUpstream)]; exist && value == "true" {
return true
}
return false
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want apply label on Dashboard CR as well just like all the other resources we are doing now?

controllers/components/base_reconciler_type.go Outdated Show resolved Hide resolved
controllers/components/dashboard_controller.go Outdated Show resolved Hide resolved
PROJECT Show resolved Hide resolved
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 51.20482% with 81 lines in your changes missing coverage. Please review.

Please upload report for BASE (feature-operator-refactor@cfa6cb2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...atasciencecluster/datasciencecluster_controller.go 0.00% 50 Missing ⚠️
pkg/controller/actions/action_update_status.go 78.46% 11 Missing and 3 partials ⚠️
pkg/controller/actions/action_delete_resources.go 75.55% 9 Missing and 2 partials ⚠️
pkg/plugins/addLabelsplugin.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##             feature-operator-refactor    #1304   +/-   ##
============================================================
  Coverage                             ?   19.98%           
============================================================
  Files                                ?       32           
  Lines                                ?     3438           
  Branches                             ?        0           
============================================================
  Hits                                 ?      687           
  Misses                               ?     2684           
  Partials                             ?       67           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lburgazzoli
Copy link
Contributor

LGTM

@ykaliuta
Copy link
Contributor

/hold

ykaliuta added a commit to ykaliuta/opendatahub-operator that referenced this pull request Oct 18, 2024
The option is deprecated by
opendatahub-io#1304

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
}
}

if rr.DSCI.Spec.DevFlags != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove that, deprecated by coming #1307

components.Component `json:""`
}

func (d *Dashboard) Init(ctx context.Context, platform cluster.Platform) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is should not be reverted, it is sort of regression.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

return nil
}

func CreateDashboardInstance(dsc *dscv1.DataScienceCluster) *componentsv1.Dashboard {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just allocates a structure with some predefined fields. Can it be named less dramatic :) ? NewDashboard() or something?

Copy link
Member

@grdryn grdryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't gotten all of the way through this yet, but leaving some minor comments from this pass.

Again, I'm very rusty when it comes to Go and operators currently, so please excuse any comments that don't make sense! 🙂

Makefile Show resolved Hide resolved
controller: true
domain: opendatahub.io
group: components
kind: Kserve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kind: Kserve
kind: KServe

I guess this might be slightly preferred? I don't know what the implications of one over the other are though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure either. I defined the crd Kserve to be consistent with current component spec https://github.com/opendatahub-io/opendatahub-operator/blob/incubation/apis/datasciencecluster/v1/datasciencecluster_types.go#L68

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont see it is a big problem, we are using Kserve in most of the places from Operator, even the current DSC.components.

pkg/upgrade/upgrade.go Show resolved Hide resolved
Copy link
Member

@zdtsw zdtsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small bits as comments

apis/components/v1/dashboard_types.go Show resolved Hide resolved
apis/components/v1/dashboard_types.go Show resolved Hide resolved
apis/components/component.go Outdated Show resolved Hide resolved
components/dashboard/dashboard.go Show resolved Hide resolved
config/crd/kustomization.yaml Outdated Show resolved Hide resolved
controllers/components/dashboard/dashboard_controller.go Outdated Show resolved Hide resolved
// Include status changes as we need to determine the component
// readiness by observing the status of the deployments
Watches(&appsv1.Deployment{}, componentEventHandler, builder.WithPredicates(componentLabelPredicate)).
// Ignore status changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i understand this comment on Route?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route status can change, but that should not trigger a reconcile loop

controllers/components/dashboard/dashboard_controller.go Outdated Show resolved Hide resolved
controllers/datasciencecluster/kubebuilder_rbac.go Outdated Show resolved Hide resolved
pkg/metadata/annotations/annotations.go Outdated Show resolved Hide resolved
feat(dashboard): configure watched resources event filter

(cherry picked from commit c9ef475)

Update predicate for create event

Fix: Update manifests map in initialization

Update controllers/components/dashboard/dashboard_controller.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update controllers/components/dashboard/dashboard_controller.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update pkg/metadata/annotations/annotations.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update controllers/datasciencecluster/kubebuilder_rbac.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update apis/components/component.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update controllers/components/dashboard/dashboard_controller.go

Co-authored-by: Wen Zhou <wenzhou@redhat.com>

Update bundle
@ykaliuta
Copy link
Contributor

/unhold

@zdtsw
Copy link
Member

zdtsw commented Oct 22, 2024

lgtm

Copy link

openshift-ci bot commented Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lburgazzoli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 6db3f70 into opendatahub-io:feature-operator-refactor Oct 22, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants