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

Serial mkfs #1169

Merged
merged 3 commits into from
Mar 10, 2023
Merged

Serial mkfs #1169

merged 3 commits into from
Mar 10, 2023

Conversation

artemvmin
Copy link
Contributor

@artemvmin artemvmin commented Mar 8, 2023

What type of PR is this?
/kind bug

What this PR does / why we need it:
Add concurrency limit to prevent OOMing when issuing multiple concurrent mkfs calls

Which issue(s) this PR fixes:
Fixes #1168

Does this PR introduce a user-facing change?:

Fixes CVE-2022-41723

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 8, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @artemvmin. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 8, 2023
@mattcary
Copy link
Contributor

mattcary commented Mar 8, 2023

/ok-to-test
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 8, 2023
@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, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: artemvmin, mattcary

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 Mar 8, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 8, 2023
@artemvmin
Copy link
Contributor Author

/retest

@artemvmin
Copy link
Contributor Author

/retest

@artemvmin
Copy link
Contributor Author

/assign @msau42

gopkg.in/gcfg.v1 v1.2.3
k8s.io/api v0.24.1
k8s.io/apimachinery v0.24.1
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
Copy link
Contributor

Choose a reason for hiding this comment

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

You may be able to get rid of the replace statement if you put 0.24.1 here

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 already tried that and wrestled with this for a while:

$> go mod tidy
go: finding module for package k8s.io/api/settings/v1alpha1
go: finding module for package k8s.io/api/batch/v2alpha1
go: finding module for package github.com/googleapis/gnostic/OpenAPIv2
go: finding module for package k8s.io/api/auditregistration/v1alpha1
sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/k8s-integration imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/discovery imports
        github.com/googleapis/gnostic/OpenAPIv2: module github.com/googleapis/gnostic@latest found (v0.6.9), but does not contain package github.com/googleapis/gnostic/OpenAPIv2
sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/k8s-integration imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1 imports
        k8s.io/api/auditregistration/v1alpha1: module k8s.io/api@latest found (v0.26.2), but does not contain package k8s.io/api/auditregistration/v1alpha1
sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/k8s-integration imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/batch/v2alpha1 imports
        k8s.io/api/batch/v2alpha1: module k8s.io/api@latest found (v0.26.2), but does not contain package k8s.io/api/batch/v2alpha1
sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/k8s-integration imports
        k8s.io/client-go/kubernetes imports
        k8s.io/client-go/kubernetes/typed/settings/v1alpha1 imports
        k8s.io/api/settings/v1alpha1: module k8s.io/api@latest found (v0.26.2), but does not contain package k8s.io/api/settings/v1alpha1

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 believe that means that some of our dependencies need us to specify the version via replace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible is arbitrary and doesn't show up in our go.sum file. Pulling the latest version is just a way for go mod tidy to satisfy the require directive syntax.

@msau42
Copy link
Contributor

msau42 commented Mar 9, 2023

We need to be careful with updating compute-gen.go.

We had to manually update it for hyperdisk work https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/commits/master/vendor/google.golang.org/api/compute cc @sunnylovestiramisu

@sunnylovestiramisu
Copy link
Contributor

Please do not update the compute-gen.go via go mod tidy/vendor. It will remove the hyperdisk feature support. :(

@@ -337,3 +337,17 @@ func (mounter *CSIProxyMounterV1) MountSensitiveWithoutSystemd(source string, ta
func (mounter *CSIProxyMounterV1) MountSensitiveWithoutSystemdWithMountFlags(source string, target string, fstype string, options []string, sensitiveOptions []string, mountFlags []string) error {
return errors.New("MountSensitiveWithoutSystemd is not implemented")
}

// CanSafelySkipMountPointCheck always returns false on Windows.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@msau42 I had to add this because of two breaking changes that updated the interface. Could you confirm that it's safe to use the upstream implementation?

https://github.com/kubernetes/mount-utils/blob/master/mount_windows.go#L247-L259

Copy link
Contributor

Choose a reason for hiding this comment

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

Until we switch to Windows host process #1071, we may not be able to do many mount operations directly. @mauriciopoppe can you confirm?

Copy link
Member

Choose a reason for hiding this comment

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

This file only uses the following exported properties from k8s.io/mount-utils:

  • mount.NormalizeWindowsPath (method)
  • mount.MountPoint (struct)

None of these paths use these two methods. I believe it's safe to use the upstream implementation, in Windows we're not doing mount directly yet because #1071 isn't merged, if #1071 is merged these two paths won't be used still.

lgtm

@@ -261,10 +266,9 @@ go.opencensus.io/trace/tracestate
# go4.org v0.0.0-20201209231011-d4a079459e60
## explicit; go 1.13
go4.org/bytereplacer
# golang.org/x/net v0.5.0
# golang.org/x/net v0.7.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this also fix the CVE-2022-41723? It needs golang.org/x/net update.

If yes, please add this CVE fix information to the release note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Nice catch.

@artemvmin
Copy link
Contributor Author

artemvmin commented Mar 9, 2023

Please do not update the compute-gen.go via go mod tidy/vendor. It will remove the hyperdisk feature support. :(

@sunnylovestiramisu Could you please elaborate? I don't see how this would break hyperdisk. All e2e tests are passing.

I have also confirmed that the generated compute-gen.go is the 2023 version, which includes Disk.ProvisionedThroughput.

We also shouldn't be manually replacing vendor files. The desired effect in af3994a can be achieved by updating https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/blob/master/go.mod#L6 to a newer version. Was the new version not available when we were doing hyperdisk integration?

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Mar 9, 2023
Copy link
Member

@mauriciopoppe mauriciopoppe left a comment

Choose a reason for hiding this comment

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

lgtm for Windows

@@ -337,3 +337,17 @@ func (mounter *CSIProxyMounterV1) MountSensitiveWithoutSystemd(source string, ta
func (mounter *CSIProxyMounterV1) MountSensitiveWithoutSystemdWithMountFlags(source string, target string, fstype string, options []string, sensitiveOptions []string, mountFlags []string) error {
return errors.New("MountSensitiveWithoutSystemd is not implemented")
}

// CanSafelySkipMountPointCheck always returns false on Windows.
Copy link
Member

Choose a reason for hiding this comment

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

This file only uses the following exported properties from k8s.io/mount-utils:

  • mount.NormalizeWindowsPath (method)
  • mount.MountPoint (struct)

None of these paths use these two methods. I believe it's safe to use the upstream implementation, in Windows we're not doing mount directly yet because #1071 isn't merged, if #1071 is merged these two paths won't be used still.

lgtm

@mauriciopoppe
Copy link
Member

Please do not update the compute-gen.go via go mod tidy/vendor. It will remove the hyperdisk feature support. :(

Maybe we could write the patch to the directory vendor-patches/ to know that this has to be applied to vendor. A check in presubmit would be to have a clean download of vendor/ + applying vendor-patches and this could be diffed with the presubmit vendor/.

@sunnylovestiramisu
Copy link
Contributor

Confirmed with the PD team that the current beta model has the hyperdisk fields

/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 10, 2023
@k8s-ci-robot k8s-ci-robot merged commit 9845c11 into kubernetes-sigs:master Mar 10, 2023
@artemvmin artemvmin deleted the serial-mkfs branch March 10, 2023 18:48
jsafrane added a commit to jsafrane/gcp-compute-persistent-disk-csi-driver that referenced this pull request Jul 18, 2023
This is partial cherry-pick of upstream PR
kubernetes-sigs#1169
to update only golang.org/x/net and related packages to version from the
PR.
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PDCSI driver OOMing when issuing too many concurrent mkfs calls
6 participants