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

Report error in status if more than one DataScienceCluster installed #687

Merged
merged 3 commits into from
Nov 2, 2023

Conversation

ykaliuta
Copy link
Contributor

@ykaliuta ykaliuta commented Nov 1, 2023

Report error in status if more than one DataScienceCluster installed

V2

  • update phase to phaseError as well
  • add reporting for DSCInitialization

Description

How Has This Been Tested?

  • Installed 2 DSCs in the same namespace with different name
  • Checked oc describe datasciencecluster.datasciencecluster.opendatahub.io/<NAME> for both clusters

Both clusters report like

Status:
  Conditions:
    Last Heartbeat Time:   2023-11-01T08:33:42Z
    Last Transition Time:  2023-11-01T08:32:20Z
    Message:               only one instance of DataScienceCluster object is allowed. Update existing instance on namespace  and name ykaliuta.dsc2
    Reason:                DuplicateDataScienceCluster
    Status:                False
    Type:                  ReconcileComplete
    Last Heartbeat Time:   2023-11-01T08:33:42Z
    Last Transition Time:  2023-11-01T08:32:20Z
    Message:               only one instance of DataScienceCluster object is allowed. Update existing instance on namespace  and name ykaliuta.dsc2
    Reason:                DuplicateDataScienceCluster
    Status:                False
    Type:                  Available
    Last Heartbeat Time:   2023-11-01T08:33:42Z
    Last Transition Time:  2023-11-01T08:31:39Z
    Message:               only one instance of DataScienceCluster object is allowed. Update existing instance on namespace  and name ykaliuta.dsc2
    Reason:                DuplicateDataScienceCluster
    Status:                False
    Type:                  Progressing
    Last Heartbeat Time:   2023-11-01T08:33:42Z
    Last Transition Time:  2023-11-01T08:32:20Z
    Message:               only one instance of DataScienceCluster object is allowed. Update existing instance on namespace  and name ykaliuta.dsc2
    Reason:                DuplicateDataScienceCluster
    Status:                True
    Type:                  Degraded
    Last Heartbeat Time:   2023-11-01T08:33:42Z
    Last Transition Time:  2023-11-01T08:32:20Z
    Message:               only one instance of DataScienceCluster object is allowed. Update existing instance on namespace  and name ykaliuta.dsc2
    Reason:                DuplicateDataScienceCluster
    Status:                Unknown
    Type:                  Upgradeable
    Last Heartbeat Time:   2023-11-01T08:32:12Z
    Last Transition Time:  2023-11-01T08:32:12Z
    Message:               Component reconciled successfully
    Reason:                ReconcileCompleted
    Status:                True
    Type:                  workbenchesReady

For DSCInitialization checked both DataScinceCluster:


  status:
    conditions:
    - lastHeartbeatTime: "2023-11-01T20:26:35Z"
      lastTransitionTime: "2023-11-01T20:26:14Z"
      message: only one instance of DSCInitialization object is allowed
      reason: DuplicateDSCInitialization
      status: "False"
      type: ReconcileComplete
    - lastHeartbeatTime: "2023-11-01T20:26:35Z"
      lastTransitionTime: "2023-11-01T20:26:14Z"
      message: only one instance of DSCInitialization object is allowed
      reason: DuplicateDSCInitialization
      status: "False"
      type: Available
    - lastHeartbeatTime: "2023-11-01T20:26:35Z"
      lastTransitionTime: "2023-11-01T20:26:14Z"
      message: only one instance of DSCInitialization object is allowed
      reason: DuplicateDSCInitialization
      status: "False"
      type: Progressing
    - lastHeartbeatTime: "2023-11-01T20:26:35Z"
      lastTransitionTime: "2023-11-01T20:26:14Z"
      message: only one instance of DSCInitialization object is allowed
      reason: DuplicateDSCInitialization
      status: "True"
      type: Degraded
    - lastHeartbeatTime: "2023-11-01T20:26:35Z"
      lastTransitionTime: "2023-11-01T20:26:14Z"
      message: only one instance of DSCInitialization object is allowed
      reason: DuplicateDSCInitialization
      status: Unknown
      type: Upgradeable
    phase: Error

and DSCIinitialization:

  conditions:
  - lastHeartbeatTime: "2023-11-01T20:25:08Z"
    lastTransitionTime: "2023-11-01T20:23:46Z"
    message: only one instance of DSCInitialization object is allowed. Update existing
      instance name new
    reason: DuplicateDSCInitialization
    status: "False"
    type: ReconcileComplete
  - lastHeartbeatTime: "2023-11-01T20:25:08Z"
    lastTransitionTime: "2023-11-01T20:23:46Z"
    message: only one instance of DSCInitialization object is allowed. Update existing
      instance name new
    reason: DuplicateDSCInitialization
    status: "False"
    type: Available
  - lastHeartbeatTime: "2023-11-01T20:25:08Z"
    lastTransitionTime: "2023-11-01T20:19:40Z"
    message: only one instance of DSCInitialization object is allowed. Update existing
      instance name new
    reason: DuplicateDSCInitialization
    status: "False"
    type: Progressing
  - lastHeartbeatTime: "2023-11-01T20:25:08Z"
    lastTransitionTime: "2023-11-01T20:23:46Z"
    message: only one instance of DSCInitialization object is allowed. Update existing
      instance name new
    reason: DuplicateDSCInitialization
    status: "True"
    type: Degraded
  - lastHeartbeatTime: "2023-11-01T20:25:08Z"
    lastTransitionTime: "2023-11-01T20:23:46Z"
    message: only one instance of DSCInitialization object is allowed. Update existing
      instance name new
    reason: DuplicateDSCInitialization
    status: Unknown
    type: Upgradeable
  phase: Error

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • 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

@ykaliuta
Copy link
Contributor Author

ykaliuta commented Nov 1, 2023

Actually, should be revisited after issue #645 integration.

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.

/lgtm

@zdtsw
Copy link
Member

zdtsw commented Nov 1, 2023

ref: #644

@openshift-ci openshift-ci bot added the lgtm label Nov 1, 2023
@zdtsw
Copy link
Member

zdtsw commented Nov 1, 2023

do we want to add the same status update for DSCI as well?

@ykaliuta
Copy link
Contributor Author

ykaliuta commented Nov 1, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.

Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

@zdtsw
Copy link
Member

zdtsw commented Nov 1, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.

Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

ok, lets do like this way.
we can get this out first and create a new issue for the DSCI, then have another PR for that issue, how you feel?

@ykaliuta
Copy link
Contributor Author

ykaliuta commented Nov 1, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.
Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

ok, lets do like this way. we can get this out first and create a new issue for the DSCI, then have another PR for that issue, how you feel?

I'm ok with several patches in one PR.

Just thought a bit about that. May be there should exist some sort of Webhook to prevent such configurations at the first place?

The instance will be used to report failed status for > 1 case.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
In case of > 1 dataclusters installed report error condition in the
kubernetes status which previously was only reported in the operator
logs.

Add DuplicateDataScienceCluster string constant for that.

Reuse `instance` variable for reportError.

Fixes: opendatahub-io#644

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
Repeat for DSCInitialization the same logic as for
DataScienceCluster.

The check is performed in both DSCInitialization and
DataScienceCluster controllers.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
@zdtsw
Copy link
Member

zdtsw commented Nov 2, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.
Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

ok, lets do like this way. we can get this out first and create a new issue for the DSCI, then have another PR for that issue, how you feel?

I'm ok with several patches in one PR.

Just thought a bit about that. May be there should exist some sort of Webhook to prevent such configurations at the first place?

i do not want to enforce git webhook (if this is the webhook you meant) or it will be a new commit everytime and difficult for reviewer, we do have squash-merge for PR so the committer (or reviewer) is responsibile to get a clean history for the PR before merge

@ykaliuta
Copy link
Contributor Author

ykaliuta commented Nov 2, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.
Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

ok, lets do like this way. we can get this out first and create a new issue for the DSCI, then have another PR for that issue, how you feel?

I'm ok with several patches in one PR.
Just thought a bit about that. May be there should exist some sort of Webhook to prevent such configurations at the first place?

i do not want to enforce git webhook (if this is the webhook you meant) or it will be a new commit everytime and difficult for reviewer, we do have squash-merge for PR so the committer (or reviewer) is responsibile to get a clean history for the PR before merge

No, I meant kubernetes validating webhook, like https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation

@zdtsw
Copy link
Member

zdtsw commented Nov 2, 2023

do we want to add the same status update for DSCI as well?

Good question. Probably it will not do any harm. Just IIUC it is more complicated for the user to encounter. Like install the operator twice. When deploying twice just the DataScienceCluster is much easier.
Well, if there are no objections I'll add it as well. To both DSCI and DSC Reconcile.

ok, lets do like this way. we can get this out first and create a new issue for the DSCI, then have another PR for that issue, how you feel?

I'm ok with several patches in one PR.
Just thought a bit about that. May be there should exist some sort of Webhook to prevent such configurations at the first place?

i do not want to enforce git webhook (if this is the webhook you meant) or it will be a new commit everytime and difficult for reviewer, we do have squash-merge for PR so the committer (or reviewer) is responsibile to get a clean history for the PR before merge

No, I meant kubernetes validating webhook, like https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation

ok, but then it is a totally different story which will add new webhook in api to validate fields etc.
I started this way a couple of months ago but did not continue with it due to other high priority tasks, but if you would like you can create a ticket and work on this.

@ykaliuta
Copy link
Contributor Author

ykaliuta commented Nov 2, 2023

Just thought a bit about that. May be there should exist some sort of Webhook to prevent such configurations at the first place?

i do not want to enforce git webhook (if this is the webhook you meant) or it will be a new commit everytime and difficult for reviewer, we do have squash-merge for PR so the committer (or reviewer) is responsibile to get a clean history for the PR before merge

No, I meant kubernetes validating webhook, like https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation

ok, but then it is a totally different story which will add new webhook in api to validate fields etc.

Sure, it's a further enhancement and it's good to get proper reporting first (I've updated the PR BTW and added phaseError set like in some other places)

I started this way a couple of months ago but did not continue with it due to other high priority tasks, but if you would like you can create a ticket and work on this.

Sounds great actually!

@zdtsw
Copy link
Member

zdtsw commented Nov 2, 2023

create issue : #693

@zdtsw zdtsw added the odh-2.4 label Nov 2, 2023
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.

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 2, 2023
Copy link

openshift-ci bot commented Nov 2, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zdtsw
Once this PR has been reviewed and has the lgtm label, please assign lavlas for approval. 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 merged commit 4e95d43 into opendatahub-io:incubation Nov 2, 2023
6 of 7 checks passed
VaishnaviHire pushed a commit to VaishnaviHire/opendatahub-operator that referenced this pull request Nov 15, 2023
…pendatahub-io#687)

* DSCc, DSCIc: move len > 1 check after getting first instance.

In case of > 1 dataclusters installed report error condition in the
kubernetes status which previously was only reported in the operator
logs.
Add DuplicateDataScienceCluster string constant for that.

* DSCc, DSCIc: set status for > 1 DSCInitialization

Repeat for DSCInitialization the same logic as for
DataScienceCluster.

The check is performed in both DSCInitialization and
DataScienceCluster controllers.

Fixes: opendatahub-io#644
Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>

---------

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
(cherry picked from commit 4e95d43)
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.

2 participants