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

NO-ISSUE: Ensure that openshift_version isn't empty #6863

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhernand
Copy link
Contributor

@jhernand jhernand commented Oct 3, 2024

We found a situation where the openshift_version column of the clusters table is empty. We haven't been able to understand why, but it results in an error when running validations. For example, the dual-stack VIP validation produces a false negative:

2024-09-11T05:39:04.055138029Z time="2024-09-11T05:39:04Z"
level=error
msg="Cluster 686c7849-8d68-4340-b81d-9add8c4261fe failed VIP validations"
func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).validateAndUpdateClusterParams"
file="/remote-source/assisted-service/app/internal/bminventory/inventory.go:1889"
error="dual-stack VIPs are not supported in OpenShift "
pkg=Inventory

Note how the error message doesn't contain the OpenShift version at the end. It should, as the code is like this:

return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion))

So we are assuming, at least in that code, that the openshift_version column is not empty.

This patch adds a database constraint to ensure that that openshift_column isn't null or empty. That doesn't address the root cause (because we don't know it) but at least it should catch situations where something tries to set that column empty.

Related: https://issues.redhat.com/browse/OCPBUGS-42059
Related:

return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion))

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

We found a situation where the `openshift_version` column of the
clusters table is empty. We haven't been able to understand why, but it
results in an error when running validations. For example, the
dual-stack VIP validation produces a false negative:

```
2024-09-11T05:39:04.055138029Z time="2024-09-11T05:39:04Z"
level=error
msg="Cluster 686c7849-8d68-4340-b81d-9add8c4261fe failed VIP validations"
func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).validateAndUpdateClusterParams"
file="/remote-source/assisted-service/app/internal/bminventory/inventory.go:1889"
error="dual-stack VIPs are not supported in OpenShift "
pkg=Inventory
```

Note how the error message doesn't contain the OpenShift version at the
end. It should, as the code is like this:

```go
return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion))
```

So we are assuming, at least in that code, that the `openshift_version`
column is not empty.

This patch changes adds a database constraint to ensure that that
`openshift_column` isn't null or empty. That doesn't address the root
cause (because we don't know it) but at least it should catch situations
where something tries to set that column empty.

Related: https://issues.redhat.com/browse/OCPBUGS-42059
Related: https://github.com/openshift/assisted-service/blob/e59df80246f418b62048d7252e4d79bf5723c81e/internal/cluster/validations/validations.go#L256
Signed-off-by: Juan Hernandez <[email protected]>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 3, 2024
@openshift-ci-robot
Copy link

@jhernand: This pull request explicitly references no jira issue.

In response to this:

We found a situation where the openshift_version column of the clusters table is empty. We haven't been able to understand why, but it results in an error when running validations. For example, the dual-stack VIP validation produces a false negative:

2024-09-11T05:39:04.055138029Z time="2024-09-11T05:39:04Z"
level=error
msg="Cluster 686c7849-8d68-4340-b81d-9add8c4261fe failed VIP validations"
func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).validateAndUpdateClusterParams"
file="/remote-source/assisted-service/app/internal/bminventory/inventory.go:1889"
error="dual-stack VIPs are not supported in OpenShift "
pkg=Inventory

Note how the error message doesn't contain the OpenShift version at the end. It should, as the code is like this:

return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion))

So we are assuming, at least in that code, that the openshift_version column is not empty.

This patch changes adds a database constraint to ensure that that openshift_column isn't null or empty. That doesn't address the root cause (because we don't know it) but at least it should catch situations where something tries to set that column empty.

Related: https://issues.redhat.com/browse/OCPBUGS-42059
Related:

return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion))

List all the issues related to this PR

  • New Feature
  • [X ] Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 3, 2024
@openshift-ci openshift-ci bot added the api-review Categorizes an issue or PR as actively needing an API review. label Oct 3, 2024
Copy link

openshift-ci bot commented Oct 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhernand

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 3, 2024
@jhernand jhernand marked this pull request as draft October 3, 2024 11:52
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 3, 2024
@jhernand
Copy link
Contributor Author

jhernand commented Oct 3, 2024

/retest

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.38%. Comparing base (341f986) to head (b5163e0).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6863      +/-   ##
==========================================
- Coverage   68.74%   62.38%   -6.37%     
==========================================
  Files         249      249              
  Lines       37439    37439              
==========================================
- Hits        25739    23355    -2384     
- Misses       9402    11985    +2583     
+ Partials     2298     2099     -199     

see 35 files with indirect coverage changes

Copy link

openshift-ci bot commented Oct 3, 2024

@jhernand: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/edge-subsystem-kubeapi-aws b5163e0 link true /test edge-subsystem-kubeapi-aws
ci/prow/edge-e2e-ai-operator-ztp-capi b5163e0 link false /test edge-e2e-ai-operator-ztp-capi
ci/prow/edge-unit-test b5163e0 link true /test edge-unit-test
ci/prow/edge-e2e-ai-operator-disconnected-capi b5163e0 link false /test edge-e2e-ai-operator-disconnected-capi
ci/prow/edge-subsystem-aws b5163e0 link true /test edge-subsystem-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants