Set rootcontext of emptyDir tmpfs mounts correctly
This commit is contained in:
@@ -58,12 +58,12 @@ func (plugin *secretPlugin) CanSupport(spec *api.Volume) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (plugin *secretPlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference) (volume.Builder, error) {
|
||||
return plugin.newBuilderInternal(spec, podRef)
|
||||
func (plugin *secretPlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference, opts volume.VolumeOptions) (volume.Builder, error) {
|
||||
return plugin.newBuilderInternal(spec, podRef, opts)
|
||||
}
|
||||
|
||||
func (plugin *secretPlugin) newBuilderInternal(spec *api.Volume, podRef *api.ObjectReference) (volume.Builder, error) {
|
||||
return &secretVolume{spec.Name, *podRef, plugin, spec.Secret.SecretName}, nil
|
||||
func (plugin *secretPlugin) newBuilderInternal(spec *api.Volume, podRef *api.ObjectReference, opts volume.VolumeOptions) (volume.Builder, error) {
|
||||
return &secretVolume{spec.Name, *podRef, plugin, spec.Secret.SecretName, &opts}, nil
|
||||
}
|
||||
|
||||
func (plugin *secretPlugin) NewCleaner(volName string, podUID types.UID) (volume.Cleaner, error) {
|
||||
@@ -71,7 +71,7 @@ func (plugin *secretPlugin) NewCleaner(volName string, podUID types.UID) (volume
|
||||
}
|
||||
|
||||
func (plugin *secretPlugin) newCleanerInternal(volName string, podUID types.UID) (volume.Cleaner, error) {
|
||||
return &secretVolume{volName, api.ObjectReference{UID: podUID}, plugin, ""}, nil
|
||||
return &secretVolume{volName, api.ObjectReference{UID: podUID}, plugin, "", nil}, nil
|
||||
}
|
||||
|
||||
// secretVolume handles retrieving secrets from the API server
|
||||
@@ -81,6 +81,7 @@ type secretVolume struct {
|
||||
podRef api.ObjectReference
|
||||
plugin *secretPlugin
|
||||
secretName string
|
||||
opts *volume.VolumeOptions
|
||||
}
|
||||
|
||||
func (sv *secretVolume) SetUp() error {
|
||||
@@ -97,7 +98,7 @@ func (sv *secretVolume) SetUpAt(dir string) error {
|
||||
glog.V(3).Infof("Setting up volume %v for pod %v at %v", sv.volName, sv.podRef.UID, dir)
|
||||
|
||||
// Wrap EmptyDir, let it do the setup.
|
||||
wrapped, err := sv.plugin.host.NewWrapperBuilder(wrappedVolumeSpec, &sv.podRef)
|
||||
wrapped, err := sv.plugin.host.NewWrapperBuilder(wrappedVolumeSpec, &sv.podRef, *sv.opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -126,7 +127,7 @@ func (sv *secretVolume) SetUpAt(dir string) error {
|
||||
for name, data := range secret.Data {
|
||||
hostFilePath := path.Join(dir, name)
|
||||
glog.V(3).Infof("Writing secret data %v/%v/%v (%v bytes) to host file %v", sv.podRef.Namespace, sv.secretName, name, len(data), hostFilePath)
|
||||
err := ioutil.WriteFile(hostFilePath, data, 0777)
|
||||
err := ioutil.WriteFile(hostFilePath, data, 0444)
|
||||
if err != nil {
|
||||
glog.Errorf("Error writing secret data to host path: %v, %v", hostFilePath, err)
|
||||
return err
|
||||
|
@@ -97,7 +97,7 @@ func TestPlugin(t *testing.T) {
|
||||
t.Errorf("Can't find the plugin by name")
|
||||
}
|
||||
|
||||
builder, err := plugin.NewBuilder(volumeSpec, &api.ObjectReference{UID: types.UID(testPodUID)})
|
||||
builder, err := plugin.NewBuilder(volumeSpec, &api.ObjectReference{UID: types.UID(testPodUID)}, volume.VolumeOptions{})
|
||||
if err != nil {
|
||||
t.Errorf("Failed to make a new Builder: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user