-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
UPSTREAM: <carry>: XFS quota for emptyDir volumes #19533
Conversation
TIL [WIP] is enough to hold |
@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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typemeta. what is this?
@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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@deads2k fixed up again |
/retest |
1 similar comment
/retest |
I've tested this now and it works. Note that I changed |
/retest |
This is ready for review/merge now |
}, | ||
} | ||
|
||
quota := resource.NewQuantity(volumeConfig.LocalQuota.PerFSGroupInGiB*1024*1024*1024, resource.BinarySI) |
There was a problem hiding this comment.
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.
On disk format looks ok. Parsing code looks reasonable. You might want to add a check for sane values. /lgtm |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
/approve |
[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 |
/retest |
2 similar comments
/retest |
/retest |
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: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