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

e2e: support CSI images in -list-images #108458

Merged
merged 1 commit into from
Mar 11, 2022

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Mar 2, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

It was possible to patch images in the YAML files via KUBE_TEST_REPO, but it
was not possible to know in advance which images might be needed. Now
-list-images also includes all images referenced
by the test-manifest/storage-csi YAML files.

Special notes for your reviewer:

This is an alternative for #108261

Does this PR introduce a user-facing change?

When invoked with `-list-images`, the e2e.test binary now also lists the images that might be needed for storage tests.

/cc @jsafrane @derek-pryor

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Mar 2, 2022
@k8s-ci-robot
Copy link
Contributor

@pohly: GitHub didn't allow me to request PR reviews from the following users: derek-pryor.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

What type of PR is this?

/kind feature

What this PR does / why we need it:

It was possible to patch images in the YAML files via KUBE_TEST_REPO, but it
was not possible to know in advance which images might be needed. Now
-list-images also includes the k8s.gcr.io/sig-storage images referenced
by the test-manifest/storage-csi YAML files.

Special notes for your reviewer:

This is an alternative for #108261

Does this PR introduce a user-facing change?

The e2e.test binary now also lists k8s.gcr.io/sig-storage images that might be needed for tests when invoked with `-list-images`.

/cc @jsafrane @derek-pryor

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.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 2, 2022
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 2, 2022
@k8s-ci-robot
Copy link
Contributor

@pohly: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Mar 2, 2022
@pohly pohly mentioned this pull request Mar 2, 2022
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 2, 2022
@pohly
Copy link
Contributor Author

pohly commented Mar 2, 2022

I was focusing on just on "our" (= k8s.io/sig-storage) images initially, but then thought some more and decided that list all images that are referenced by our YAML files is the better and probably right solution, because the additional images (like socat and busybox) might also be used.

@pohly
Copy link
Contributor Author

pohly commented Mar 2, 2022

New images (from go test -v ./test/e2e -list-images):

> alpine/socat:1.0.3
5a7
> k8s.gcr.io/cloud-provider-gcp/gcp-compute-persistent-disk-csi-driver:v1.2.2
7a10
> k8s.gcr.io/e2e-test-images/busybox:1.29-1
40a44,56
> k8s.gcr.io/sig-storage/csi-attacher:v3.1.0
> k8s.gcr.io/sig-storage/csi-attacher:v3.3.0
> k8s.gcr.io/sig-storage/csi-external-health-monitor-controller:v0.4.0
> k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.1.0
> k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0
> k8s.gcr.io/sig-storage/csi-provisioner:v2.1.0
> k8s.gcr.io/sig-storage/csi-provisioner:v3.0.0
> k8s.gcr.io/sig-storage/csi-resizer:v1.1.0
> k8s.gcr.io/sig-storage/csi-resizer:v1.3.0
> k8s.gcr.io/sig-storage/csi-snapshotter:v3.0.3
> k8s.gcr.io/sig-storage/csi-snapshotter:v4.2.1
> k8s.gcr.io/sig-storage/hostpathplugin:v1.7.3
> k8s.gcr.io/sig-storage/livenessprobe:v2.4.0

@pohly
Copy link
Contributor Author

pohly commented Mar 2, 2022

/retest

@derek-pryor
Copy link
Contributor

Manually patched openshift-tests with this change and verified that openshift-tests images works as we wanted.
/lgtm

@k8s-ci-robot
Copy link
Contributor

@derek-pryor: changing LGTM is restricted to collaborators

In response to this:

Manually patched openshift-tests with this change and verified that openshift-tests images works as we wanted.
/lgtm

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.

@pohly
Copy link
Contributor Author

pohly commented Mar 3, 2022

/assign @jsafrane

// with many dependencies.
items := bytes.Split(data, []byte("\n---"))
for i, item := range items {
// We don't care what the acsictual type is. We just
Copy link
Member

Choose a reason for hiding this comment

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

typo: acsictual

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Urgh. Looks like a cat stepped on my keyboard. I don't have a cat. Fixed.

// We don't care what the acsictual type is. We just
// unmarshal into generic maps and then look up images.
var object interface{}
if err := yaml.Unmarshal(item, &object); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to use unstructured parse? Random example:
https://github.com/openshift/azure-disk-csi-driver-operator/blob/master/vendor/github.com/openshift/library-go/pkg/operator/resource/resourceread/unstructured.go#L13

In addition, there are some helpers that can handle interface{}, would NestedSlice / NestedString help? It would require this code to know what is a slice in "spec", "template", "spec", "containers", "image" below, not sure if it's worth the effort.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm aware of unstructured.Unstructured. I decided against using it here because it would add another dependency (not a big deal, though) and because I would still need to walk the fields myself. At least that is my understanding of the current helpers: NestedString returns the first match, but not all of them.

It was possible to patch images in the YAML files via KUBE_TEST_REPO, but it
was not possible to know in advance which images might be needed. Now
-list-images also includes all images referenced by the
test-manifest/storage-csi YAML files.
@jsafrane
Copy link
Member

jsafrane commented Mar 8, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 8, 2022
@pohly
Copy link
Contributor Author

pohly commented Mar 8, 2022

/assign @mkumatag

For approval.

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

/hold @dims if you have any comments!

Comment on lines +102 to +104
if err != nil {
panic(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

this can be worrisome but UT will make sure this won't happen(especially when yaml.Unmarshal goes wrong)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We control the input, so we know that this cannot go wrong.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 10, 2022
@dims
Copy link
Member

dims commented Mar 10, 2022

/lgtm
/approve

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 10, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, mkumatag, pohly

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

@dims
Copy link
Member

dims commented Mar 10, 2022

@pohly could you write up this (how to list the images and how to specify a yaml to override) somewhere please? @mkumatag you are using this trick too? if so please collaborate with @pohly ? thanks!

@mkumatag
Copy link
Member

@pohly could you write up this (how to list the images and how to specify a yaml to override) somewhere please? @mkumatag you are using this trick too? if so please collaborate with @pohly ? thanks!

I see some information is located here: https://github.com/kubernetes/kubernetes/tree/master/test/images#testing-images but not sure that's good enough!

@pohly
Copy link
Contributor Author

pohly commented Mar 10, 2022

I am not familiar with how people use this and it's not a concept that I came up with. In other words, someone else needs to write better documentation if the current one is not good enough.

@dims
Copy link
Member

dims commented Mar 10, 2022

/retest

1 similar comment
@pohly
Copy link
Contributor Author

pohly commented Mar 10, 2022

/retest

@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

1 similar comment
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 897f2f7 into kubernetes:master Mar 11, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.24 milestone Mar 11, 2022
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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants