Skip to content

BZ 2087504: Add Early test to check for CRD subresource.status#26954

Merged
openshift-merge-robot merged 5 commits intoopenshift:masterfrom
DennisPeriquet:crd_subresource_status
May 18, 2022
Merged

BZ 2087504: Add Early test to check for CRD subresource.status#26954
openshift-merge-robot merged 5 commits intoopenshift:masterfrom
DennisPeriquet:crd_subresource_status

Conversation

@DennisPeriquet
Copy link
Copy Markdown
Contributor

@DennisPeriquet DennisPeriquet commented Mar 31, 2022

TRT-158

The purpose of this test is to enforce (at least for the ones that have it now), spec/status separation by ensuring:

  • there is a "status" element in the openapiv3 spec
  • there is a subresource.status defined in the CRD (which will enable the .../status endpoint) which can be used for the controller to write status.

The CRDs that do not pass are treated as "exceptions" for now. We can open up a BZ for them.

@DennisPeriquet DennisPeriquet changed the title Add Early test to check for CRD subresource.status WIP:Add Early test to check for CRD subresource.status Mar 31, 2022
@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 Mar 31, 2022
@DennisPeriquet DennisPeriquet changed the title WIP:Add Early test to check for CRD subresource.status WIP: Add Early test to check for CRD subresource.status Mar 31, 2022
@openshift-ci openshift-ci Bot requested review from deads2k and sttts March 31, 2022 00:32
@DennisPeriquet DennisPeriquet force-pushed the crd_subresource_status branch from 4347b5a to 9af899c Compare April 1, 2022 01:26
@DennisPeriquet DennisPeriquet changed the title WIP: Add Early test to check for CRD subresource.status Add Early test to check for CRD subresource.status Apr 1, 2022
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 1, 2022
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/retest


// check_crds returns a list of names of CRDs that don't have subresource.status
// For now, it ignores the ones that are currently failing.
func check_crds(crd_item_list []v1.CustomResourceDefinition) []string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

checkCRDs is the general go format.

Comment thread test/extended/operators/check_crd_status.go
}

failures := []string{}
for _, crd_item := range crd_item_list {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

crdItem, crdItemList typically in go. (for these and any other vars/funcs in here, see https://go.dev/doc/effective_go#mixed-caps

}

// Use the latest version
index := len(crd_item.Spec.Versions) - 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the latest version always the last in the list?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hm... I looked at the version name field and it can be something like v1, v1beta, etc. and so we can't tell which one is latest. So I added a loop to check all versions. It turns out today, there is only one version in all of the CRDs ending in openshift.io.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah good, that makes sense, I recall it was a pretty huge pain to support more than one version at a time.

})
})

func get_crd_item_list(crdClient apiextensionsclientset.Clientset) ([]v1.CustomResourceDefinition, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest getCRDs

// check_crd_subresource_status gets the list of CustomeResourceDefinitions and
// checks if the subresource.status stanza is present. It also does a count.
// This is meant to be a test you can run outside of CI.
//
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't want to commit this second variant correct?

It should be possible to run a specific ginko test, assuming you've oc login'd to the correct cluster under test,

$ with make && ./openshift-tests run-test "[sig-arch] ClusterOperators should define valid related objects [Suite:openshift/conformance/parallel]"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried the command above (but just built openshift-tests separately and ran it) and it works. So I remove it. Thanks for the tip.

@DennisPeriquet DennisPeriquet force-pushed the crd_subresource_status branch from 9af899c to c1968d6 Compare April 1, 2022 16:52
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/retest-required

@DennisPeriquet DennisPeriquet force-pushed the crd_subresource_status branch from 91498a7 to c83df77 Compare April 1, 2022 20:46
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/retest-required

@dgoodwin
Copy link
Copy Markdown
Contributor

dgoodwin commented Apr 4, 2022

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2022
e2e "k8s.io/kubernetes/test/e2e/framework"

exutil "github.com/openshift/origin/test/extended/util"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

alias as apiextensionsv1 for consistency

for i := 0; i < len(crdItem.Spec.Versions); i++ {

versionName = crdItem.Spec.Versions[i].Name
if crdItem.Spec.Versions[i].Subresources == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if any version has a status, that will be good enough. As opposed to requiring all versions to have a status.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't look addressed, still looks like we fail for any version missing status.

I'd expect a bool foundVersionWithStatusSubresource, add to failures outside the loop if it never got set to true.

Comment thread test/extended/operators/check_crd_status.go Outdated
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2022
@DennisPeriquet DennisPeriquet force-pushed the crd_subresource_status branch 3 times, most recently from a5ef5f9 to f43e620 Compare April 7, 2022 18:20
}

// Iterate through all versions of the Spec.
var versionName string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to define this outside the loop.

Comment thread test/extended/operators/check_crd_status.go
@DennisPeriquet DennisPeriquet force-pushed the crd_subresource_status branch from f43e620 to 774ec60 Compare April 7, 2022 18:37
@dgoodwin
Copy link
Copy Markdown
Contributor

dgoodwin commented Apr 8, 2022

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2022
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@deads2k deads2k added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label May 17, 2022
@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@DennisPeriquet DennisPeriquet changed the title Add Early test to check for CRD subresource.status BZ 2087504: Add Early test to check for CRD subresource.status May 17, 2022
@DennisPeriquet
Copy link
Copy Markdown
Contributor Author

/bugzilla refresh

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 17, 2022

@DennisPeriquet: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

Retaining the bugzilla/valid-bug label as it was manually added.

Details

In response to this:

/bugzilla refresh

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/test-infra repository.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

9 similar comments
@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2022

@DennisPeriquet: 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/e2e-agnostic-cmd 477306d link false /test e2e-agnostic-cmd
ci/prow/e2e-gcp-ovn-rt-upgrade 477306d link false /test e2e-gcp-ovn-rt-upgrade
ci/prow/e2e-aws-single-node-upgrade 477306d link false /test e2e-aws-single-node-upgrade
ci/prow/e2e-aws-cgroupsv2 477306d link false /test e2e-aws-cgroupsv2

Full PR test history. Your PR dashboard.

Details

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/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

7 similar comments
@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants