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

set umask on linux and darwin when testing kubeadm copycerts #104284

Merged
merged 1 commit into from
Aug 11, 2021

Conversation

BenTheElder
Copy link
Member

What type of PR is this?

/kind failing-test

What this PR does / why we need it:

Makes the kubeadm copycerts unit tests independent of the system umask.

Which issue(s) this PR fixes:

Fixes #104265

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. size/M Denotes a PR that changes 30-99 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 11, 2021
@k8s-ci-robot k8s-ci-robot added area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 11, 2021
@BenTheElder
Copy link
Member Author

/sig cluster-lifecycle

@BenTheElder BenTheElder changed the title set umask on linux when testing kubeadm copycerts [WIP] set umask on linux when testing kubeadm copycerts Aug 11, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2021
@BenTheElder BenTheElder changed the title [WIP] set umask on linux when testing kubeadm copycerts set umask on linux and darwin when testing kubeadm copycerts Aug 11, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2021
@BenTheElder
Copy link
Member Author

Tested on Linux and macOS locally.

@@ -0,0 +1,27 @@
//+build darwin linux
Copy link
Member

@pacoxu pacoxu Aug 11, 2021

Choose a reason for hiding this comment

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

+++ b/cmd/kubeadm/app/phases/copycerts/testutil_umask.go
@@ -1,4 +1,4 @@
-//+build darwin linux
+// +build darwin linux

+++ b/cmd/kubeadm/app/phases/copycerts/testutil_umask_noop.go
@@ -1,4 +1,4 @@
-//+build !darwin,!linux
+// +build !darwin,!linux

to pass hack/verify-boilerplate.sh

Copy link
Member Author

Choose a reason for hiding this comment

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

I will appease the robots! 🙃

@@ -0,0 +1,27 @@
// +build darwin linux
Copy link
Member Author

Choose a reason for hiding this comment

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

there's no // +build unix (I hallucinated it I swear) and we don't currently actively support platforms other than these + windows, with these two being the only known platforms we support that do.

I didn't find many comparable examples in the existing codebase, mostly code that targets linux or windows specifically (for e.g. kubelet).

Copy link
Member

Choose a reason for hiding this comment

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

I think we usually just do !windows in such a case, which is not enrirely accurate.


package copycerts

func setNoUmask() {
Copy link
Member

Choose a reason for hiding this comment

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

Like i've mentioned on the issue these file mask unit tests are broken on windows, since the OS simply does not have mode bits for files. Some of the go stdlib logic is no-op on windows. I think we cross compile the kubeadm binary for windows, but we never run unit tests on windows.
If we do, this change is accurate and probably more tests would fail in cmd/kubeadm.

Thanks
/approve
/triage accepted
/priority backlog
@pacoxu please apply LGTM given you were already reviewing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think maybe some limited windows unit test running occurs, but not in CI or the release and I would be surprised if it didn't have many issues similar to #102607 already ...

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 11, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, neolit123

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 Aug 11, 2021
@pacoxu
Copy link
Member

pacoxu commented Aug 11, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2021
@k8s-ci-robot k8s-ci-robot merged commit 53d24cd into kubernetes:master Aug 11, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Aug 11, 2021
@BenTheElder BenTheElder deleted the umask-fun branch August 11, 2021 17:13
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/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

k8s.io/kubernetes/cmd/kubeadm/app/phases/copycerts TestDownloadCerts fails
4 participants