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

UPSTREAM: <carry>: XFS quota for emptyDir volumes #19533

Merged
merged 3 commits into from
May 15, 2018

Conversation

sjenning
Copy link
Contributor

@sjenning sjenning commented Apr 26, 2018

Moves the XFS quota patch out of origin and into the vendored kube since we use the kubelet directly in 3.10.

The configuration is now /var/lib/origin/openshift.local.volumes/volume-config.yaml and would look like this:

apiVersion: kubelet.config.openshift.io/v1
kind: VolumeConfig
localQuota:
  perFSGroupInGiB: 1

If the file exists, any error in the patching is fatal. If the file does not exist, the patching doesn't occur and PatchVolumePluginsForLocalQuota() return immediately without patching the volume plugins.

xref https://bugzilla.redhat.com/show_bug.cgi?id=1572285

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Apr 26, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 26, 2018
@sjenning
Copy link
Contributor Author

TIL [WIP] is enough to hold
/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 27, 2018
@sjenning
Copy link
Contributor Author

sjenning commented May 1, 2018

@smarterclayton @derekwaynecarr @deads2k can I get review on this sooner rather than later? I don't want this to blow up the release or delay 3.10 rollouts on Online.

@@ -0,0 +1,91 @@
package app
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, filename patch_volumequota.go please.

// volume plugin will be replaced with a wrapper version which adds quota
// functionality.
func PatchVolumePluginsForLocalQuota(rootdir string, plugins *[]volume.VolumePlugin) error {
volumeConfigFilePath := rootdir + "volume-config.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with the kubelet standards. Is it normal to be this opinionated about filenames? Also, why not path.Join? This isn't on a hot path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was to avoid adding a flag. If you don't hardcode the path to this file, you need to get it via some config, which we were looking to avoid.

I can use path.Join

)

// VolumeConfig contains options for configuring volumes on the node.
type VolumeConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll want a typemeta here for versioning this format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typemeta. what is this?

@sjenning
Copy link
Contributor Author

sjenning commented May 3, 2018

@deads2k mind taking another look. Especially wrt to the typemeta thing. Not sure if I'm doing it right.

}

var volumeConfig VolumeConfig
err = yaml.Unmarshal(volumeConfigFile, &volumeConfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

Make a group and version for this file and require them to be set as you expect. This will allow you to version it later if need be.

Copy link
Contributor

Choose a reason for hiding this comment

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

VolumeConfig in kubelet.config.openshift.io/v1 comes mind.

@sjenning
Copy link
Contributor Author

sjenning commented May 3, 2018

@deads2k fixed up again

@sjenning
Copy link
Contributor Author

sjenning commented May 3, 2018

/retest

1 similar comment
@sjenning
Copy link
Contributor Author

sjenning commented May 4, 2018

/retest

@sjenning sjenning changed the title [WIP] UPSTREAM: <carry>: XFS quota for emptyDir volumes UPSTREAM: <carry>: XFS quota for emptyDir volumes May 4, 2018
@openshift-ci-robot openshift-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 May 4, 2018
@sjenning
Copy link
Contributor Author

sjenning commented May 4, 2018

I've tested this now and it works. Note that I changed perFSGroup to perFSGroupInGiB and change type from Quantity to int64. The yaml unmarshaller didn't know what to do with the Quantity type.

@sjenning
Copy link
Contributor Author

sjenning commented May 5, 2018

/retest

@sjenning
Copy link
Contributor Author

sjenning commented May 7, 2018

This is ready for review/merge now

},
}

quota := resource.NewQuantity(volumeConfig.LocalQuota.PerFSGroupInGiB*1024*1024*1024, resource.BinarySI)
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 want to check that it's greater than zero.

@deads2k
Copy link
Contributor

deads2k commented May 9, 2018

On disk format looks ok. Parsing code looks reasonable. You might want to add a check for sane values.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 9, 2018
Copy link
Member

@derekwaynecarr derekwaynecarr left a comment

Choose a reason for hiding this comment

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

it would be good if you can add a test case in a follow-on pr.

// ProbeVolumePlugins collects all volume plugins into an easy to use list.
func probeVolumePlugins() []volume.VolumePlugin {
func ProbeVolumePlugins() []volume.VolumePlugin {
Copy link
Member

Choose a reason for hiding this comment

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

noting that upstream is already this way...

// filesystem suitable for quota enforcement. If checks pass the k8s emptyDir
// volume plugin will be replaced with a wrapper version which adds quota
// functionality.
func PatchVolumePluginsForLocalQuota(rootdir string, plugins *[]volume.VolumePlugin) error {
Copy link
Member

Choose a reason for hiding this comment

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

can we get a test case for this?

or if not here, something that verifies that the function works moving forward as a follow-on?

@derekwaynecarr
Copy link
Member

/approve
/lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: derekwaynecarr, sjenning

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2018
@sjenning
Copy link
Contributor Author

/retest

2 similar comments
@sjenning
Copy link
Contributor Author

/retest

@sjenning
Copy link
Contributor Author

/retest

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. lgtm Indicates that a PR is ready to be merged. 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.

6 participants