io

package
v0.0.0-...-c4b3c64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPodFromFile

func LoadPodFromFile(filePath string) (*api.Pod, error)

LoadPodFromFile will read, decode, and return a Pod from a file.

func SavePodToFile

func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error

SavePodToFile will encode and save a pod to a given path & permissions

Types

type NsenterWriter

type NsenterWriter struct {
}

Alternative implementation of Writer interface that allows writing data to file using nsenter command. If a program (e.g. kubelet) runs in a container it may want to write data to a mounted device. Since in Docker, mount propagation mode is set to private, it will not see the mounted device in its own namespace. To work around this limitaion one has to first enter hosts namespace (by using 'nsenter') and only then write data.

func (*NsenterWriter) WriteFile

func (writer *NsenterWriter) WriteFile(filename string, data []byte, perm os.FileMode) error

TODO: should take a writer, not []byte

type StdWriter

type StdWriter struct {
}

StdWriter implements Writer interface and uses standard libraries for writing data to files.

func (*StdWriter) WriteFile

func (writer *StdWriter) WriteFile(filename string, data []byte, perm os.FileMode) error

type Writer

type Writer interface {
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

Writer is an interface which allows to write data to a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL