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

feat: watch Ingress CR updates #1319

Open
wants to merge 3 commits into
base: incubation
Choose a base branch
from

Conversation

zdtsw
Copy link
Member

@zdtsw zdtsw commented Oct 25, 2024

Description

if user set appsDomain, we need to trigger changes to reflect it

  • only on update event
  • only check cluster CR
  • set in cache
    move ingresscontroller to watch than own it

related to change from #1318
https://issues.redhat.com/browse/RHOAIENG-15048

How Has This Been Tested?

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

Copy link

openshift-ci bot commented Oct 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from zdtsw. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@zdtsw zdtsw requested review from lburgazzoli and VaishnaviHire and removed request for lphiri and MarianMacik October 25, 2024 10:28
@zdtsw
Copy link
Member Author

zdtsw commented Oct 27, 2024

/retest-required

Copy link

codecov bot commented Oct 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Please upload report for BASE (incubation@8ea9ea0). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...atasciencecluster/datasciencecluster_controller.go 0.00% 14 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             incubation    #1319   +/-   ##
=============================================
  Coverage              ?   19.01%           
=============================================
  Files                 ?       30           
  Lines                 ?     3382           
  Branches              ?        0           
=============================================
  Hits                  ?      643           
  Misses                ?     2670           
  Partials              ?       69           

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

Copy link
Contributor

Choose a reason for hiding this comment

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

changes to this file seems to be unrelated

Copy link
Member Author

Choose a reason for hiding this comment

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

these are auto generated from some previous commits.

main.go Outdated
cacheOptions := cache.Options{
Scheme: scheme,
ByObject: map[client.Object]cache.ByObject{
uingress: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about the impact of this, since there's no specific configuration, then I think this line does not have effects on the cache, am I wrong ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, i forgot to put the selector on it for "cluster" instance

@@ -635,6 +654,22 @@ func (r *DataScienceClusterReconciler) watchDefaultIngressSecret(ctx context.Con
return nil
}

func (r *DataScienceClusterReconciler) watchIngressResources(ctx context.Context, a client.Object) []reconcile.Request {
requestName, err := r.getRequestName(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated, but getRequestName seems incorrect as it would return a result even if there's no actual instances of a DSC

Copy link
Member Author

Choose a reason for hiding this comment

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

let me make another PR to follow this 0 instance case.
the original code was added 10 months ago.....

Copy link
Member Author

Choose a reason for hiding this comment

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

follow up in #1323

}),
).
Watches( // ingress
&unstructured.Unstructured{
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can probably import the related OpenShift struct

@@ -531,6 +532,19 @@ func (r *DataScienceClusterReconciler) SetupWithManager(ctx context.Context, mgr
}),
builder.WithPredicates(argoWorkflowCRDPredicates),
).
Watches( // ingresscontroller
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this watch ? it seems the same enqueue logic is performed by the Watches(corev1.Secret) below

Copy link
Member Author

Choose a reason for hiding this comment

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

all in all, why we need this IngressController? feel it was no need added there at first

- if user set appsDomain, we need to trigger changes to reflect it
	- only on update event
	- only check cluster CR
	- set in cache
- move ingresscontroller to watch than own it

Signed-off-by: Wen Zhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants