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

🌱 Collect kind logs when e2e bootstrap fails #5910

Merged

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR improves the E2E test framework by collecting kind logs in case creating the bootstrap cluster fails for any reason

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 5, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 5, 2022
@@ -218,6 +218,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
RequiresDockerSock: config.HasDockerProvider(),
Images: config.Images,
IPFamily: config.GetVariable(IPFamily),
LogFolder: filepath.Join(artifactFolder, "kind"),
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, this change should be implemented by everyone using the E2E test framework.
An option to give people room to this change overtime is to log only if the log folder is defined.

Copy link
Member

Choose a reason for hiding this comment

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

Right now the field is not required but if the cluster creation fails it would log into folder "", right?

I would prefer one of the following options:

  1. enforce that the log folder is set (via an Expect at the beginning of CreateKindBootstrapClusterAndLoadImages)
  2. only export logs if the LogFolder is set

Both options are fine for me, I would prefer 1.. Afaik our API compatibility guarantees for framework allow this and as log folder is used everywhere it shouldn't be a problem for users to also set it here. Option 2. would probably mean that apart from us probably almost nobody benefits of this improvement.

(Would be good to mention this in the migration guide if we implement Option 1 though)

Copy link
Member Author

Choose a reason for hiding this comment

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

We are now exporting logs only if the LogFolder is set; this is documented in the migration guide (even if it is not mandatory)

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Thx!

test/framework/bootstrap/kind_provider.go Outdated Show resolved Hide resolved
@@ -218,6 +218,7 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
RequiresDockerSock: config.HasDockerProvider(),
Images: config.Images,
IPFamily: config.GetVariable(IPFamily),
LogFolder: filepath.Join(artifactFolder, "kind"),
Copy link
Member

Choose a reason for hiding this comment

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

Right now the field is not required but if the cluster creation fails it would log into folder "", right?

I would prefer one of the following options:

  1. enforce that the log folder is set (via an Expect at the beginning of CreateKindBootstrapClusterAndLoadImages)
  2. only export logs if the LogFolder is set

Both options are fine for me, I would prefer 1.. Afaik our API compatibility guarantees for framework allow this and as log folder is used everywhere it shouldn't be a problem for users to also set it here. Option 2. would probably mean that apart from us probably almost nobody benefits of this improvement.

(Would be good to mention this in the migration guide if we implement Option 1 though)

@sbueringer
Copy link
Member

Thx!

/lgtm
/test pull-cluster-api-test-mink8s-main

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 7, 2022
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit 728619c into kubernetes-sigs:main Jan 7, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.1 milestone Jan 7, 2022
@fabriziopandini fabriziopandini deleted the e2e-collect-kind-logs branch January 8, 2022 12:21
kashifest added a commit to Nordix/cluster-api-provider-metal3 that referenced this pull request Feb 1, 2022
This PR adds LogFolder Parameter in e2e for collecting kind logs. Please
see kubernetes-sigs/cluster-api#5910 for
reference.
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants