Skip to content

Commit 5649c72

Browse files
committed
remove XFS quota patch from origin
1 parent a8ce528 commit 5649c72

File tree

5 files changed

+0
-739
lines changed

5 files changed

+0
-739
lines changed
-64
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
package node
22

33
import (
4-
"errors"
54
"fmt"
65
"os"
76
"path/filepath"
87

98
"github.com/golang/glog"
109

11-
kapiv1 "k8s.io/api/core/v1"
12-
"k8s.io/kubernetes/cmd/kubelet/app"
13-
"k8s.io/kubernetes/pkg/volume"
14-
15-
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
1610
cmdutil "github.com/openshift/origin/pkg/cmd/util"
17-
"github.com/openshift/origin/pkg/volume/emptydir"
1811
)
1912

2013
// TODO this is a best effort check at the moment that should either move to kubelet or be removed entirely
@@ -83,60 +76,3 @@ func initializeVolumeDir(rootDirectory string) error {
8376
}
8477
return nil
8578
}
86-
87-
// TODO this needs to move into the forked kubelet with a `--openshift-config` flag
88-
// PatchUpstreamVolumePluginsForLocalQuota checks if the node config specifies a local storage
89-
// perFSGroup quota, and if so will test that the volumeDirectory is on a
90-
// filesystem suitable for quota enforcement. If checks pass the k8s emptyDir
91-
// volume plugin will be replaced with a wrapper version which adds quota
92-
// functionality.
93-
func PatchUpstreamVolumePluginsForLocalQuota(nodeConfig configapi.NodeConfig) func() []volume.VolumePlugin {
94-
// This looks a little weird written this way but it allows straight lifting from here to kube at a future time
95-
// and will allow us to wrap the exec.
96-
97-
existingProbeVolumePlugins := app.ProbeVolumePlugins
98-
return func() []volume.VolumePlugin {
99-
if nodeConfig.VolumeConfig.LocalQuota.PerFSGroup == nil {
100-
return existingProbeVolumePlugins()
101-
}
102-
103-
glog.V(4).Info("Replacing empty-dir volume plugin with quota wrapper")
104-
wrappedEmptyDirPlugin := false
105-
106-
quotaApplicator, err := emptydir.NewQuotaApplicator(nodeConfig.VolumeDirectory)
107-
if err != nil {
108-
glog.Fatalf("Could not set up local quota, %s", err)
109-
}
110-
111-
// Create a volume spec with emptyDir we can use to search for the
112-
// emptyDir plugin with CanSupport:
113-
emptyDirSpec := &volume.Spec{
114-
Volume: &kapiv1.Volume{
115-
VolumeSource: kapiv1.VolumeSource{
116-
EmptyDir: &kapiv1.EmptyDirVolumeSource{},
117-
},
118-
},
119-
}
120-
121-
ret := existingProbeVolumePlugins()
122-
for idx, plugin := range ret {
123-
// Can't really do type checking or use a constant here as they are not exported:
124-
if plugin.CanSupport(emptyDirSpec) {
125-
wrapper := emptydir.EmptyDirQuotaPlugin{
126-
VolumePlugin: plugin,
127-
Quota: *nodeConfig.VolumeConfig.LocalQuota.PerFSGroup,
128-
QuotaApplicator: quotaApplicator,
129-
}
130-
ret[idx] = &wrapper
131-
wrappedEmptyDirPlugin = true
132-
}
133-
}
134-
// Because we can't look for the k8s emptyDir plugin by any means that would
135-
// survive a refactor, error out if we couldn't find it:
136-
if !wrappedEmptyDirPlugin {
137-
glog.Fatal(errors.New("No plugin handling EmptyDir was found, unable to apply local quotas"))
138-
}
139-
140-
return ret
141-
}
142-
}

pkg/cmd/server/start/start_node.go

-2
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,6 @@ func StartNode(nodeConfig configapi.NodeConfig, components *utilflags.ComponentF
484484
node.EnsureKubeletAccess()
485485
// TODO perform this "ensure" in ansible and skip it entirely.
486486
node.EnsureVolumeDir(nodeConfig.VolumeDirectory)
487-
// TODO accept an --openshift-config in our fork. This overwrites the volume creation patch for the node.
488-
kubeletapp.ProbeVolumePlugins = node.PatchUpstreamVolumePluginsForLocalQuota(nodeConfig)
489487

490488
go func() {
491489
glog.Fatal(runKubeletInProcess(kubeletArgs))

pkg/volume/emptydir/empty_dir_quota.go

-92
This file was deleted.

0 commit comments

Comments
 (0)