Documentation ¶
Index ¶
- Constants
- Variables
- func APIEnvVarsToMap(envs []api.EnvVar) map[string]string
- func AddToEnvList(env []string, key string, value string, overwrite bool) []string
- func CopyFile(src, dst string) error
- func EnsureFileExists(name string) error
- func EnsureProg(prog, downloadURL, minVersion, versionArg string) (string, error)
- func EnvironToAPIEnvVar(envs []string) []api.EnvVar
- func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []api.EnvVar) (command []string)
- func FindPortByName(unit *api.Unit, portName string) (int, error)
- func GetNameFromString(n string) string
- func GetNamespaceFromString(n string) string
- func GetNumberOfFreeAndAvailableBlocks(path string) (uint64, uint64, error)
- func GetRepoCreds(server string, allCreds map[string]api.RegistryCredentials) (string, string)
- func InstallProg(url, path string) error
- func IsEmptyDir(name string) (bool, error)
- func LookupUser(userspec string, lookup UserLookup) (uint32, uint32, string, error)
- func MapDiff(spec, status map[string]interface{}) ([]string, []string, []string)
- func Minint64(a, b int64) int64
- func ParseImageSpec(image string) (string, string)
- func RandStr(t *testing.T, n int) string
- func RunProg(prog string, outputLimit, maxRetries int, args ...string) error
- func SetOOMScore(pid, score int) error
- func SplitNamespaceAndName(n string) (string, string)
- func TailFile(path string, lines int, maxBytes int64) (string, error)
- func TranslateProbePorts(unit *api.Unit, probe *api.Probe) *api.Probe
- func Version() string
- func WithNamespace(ns, name string) string
- type FakeUserLookup
- type OsUserLookup
- type PasswdUserLookup
- type UserLookup
Constants ¶
const (
NamespaceSeparator = '_'
)
Variables ¶
var ( // VERSION is set during the build from the file at itzo/version VERSION string = "" // GIT_REVISION and GIT_DIRTY are set during build. GIT_REVISION string = "" GIT_DIRTY string = "" )
var (
MaxBufferSize int64 = 1024 * 1024 * 10 // 10MB
)
Functions ¶
func APIEnvVarsToMap ¶
V1EnvVarsToMap constructs a map of environment name to value from a slice of env vars.
func AddToEnvList ¶
Add an entry to the list of environment variables. Also removes duplicate entries, only keeping the last one.
func EnsureFileExists ¶ added in v1.2.0
func EnsureProg ¶
func EnvironToAPIEnvVar ¶
func ExpandContainerCommandOnlyStatic ¶
func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []api.EnvVar) (command []string)
ExpandContainerCommandOnlyStatic substitutes only static environment variable values from the container environment definitions. This does *not* include valueFrom substitutions. TODO: callers should use ExpandContainerCommandAndArgs with a fully resolved list of environment.
func FindPortByName ¶ added in v1.2.0
findPortByName is a helper function to look up a port in a container by name.
func GetNameFromString ¶
func GetNamespaceFromString ¶
func GetRepoCreds ¶ added in v1.2.0
Dockerhub can go by several names that the user can specify in their image spec. .docker/config.json uses index.docker.io but an empty server should also map to that. We have used registry-1.docker.io internally and users might also just say "docker.io". Try to find the server that shows up in the credentials sent over from kip.
func InstallProg ¶
func IsEmptyDir ¶ added in v1.2.0
func LookupUser ¶
func ParseImageSpec ¶
Parse the image spec and extract the registry server and the repo name. Example image specs:
ECS: ACCOUNT.dkr.ecr.REGION.amazonaws.com/imagename:tag Docker Hub: imagename:tag or owner/imagename:tag
func SetOOMScore ¶
We disable the OOM Killer for Itzo in the itzo startup script but we want to reenable it for user processes that itzo spawns
func SplitNamespaceAndName ¶
func TranslateProbePorts ¶ added in v1.2.0
Our probes can reference unit ports by the name given to them in the unit. However, where the probes are actually used (inside unit.go) we don't have access to the full unit structure. Here we make a copy of an httpget probe and update it to use only port numbers. If we can't look up a probe's name, we don't fail the unit, instead we pass along the unmodified port and it'll fail in the probe. That matches the behavior of the kubelet. Note that we can't change a probe in-place since that messes up the diffs we do on pods during UpdatePod and would cause us to delete and recreate pods.
func WithNamespace ¶
Types ¶
type FakeUserLookup ¶
type FakeUserLookup struct { Uid uint32 UidGid uint32 UidErr error Gid uint32 GidErr error Homedir string }
func (*FakeUserLookup) Lookup ¶
func (ful *FakeUserLookup) Lookup(username string) (*user.User, error)
func (*FakeUserLookup) LookupGroup ¶
func (ful *FakeUserLookup) LookupGroup(name string) (*user.Group, error)
func (*FakeUserLookup) LookupGroupId ¶
func (ful *FakeUserLookup) LookupGroupId(name string) (*user.Group, error)
type OsUserLookup ¶
type OsUserLookup struct{}
func (*OsUserLookup) LookupGroup ¶
func (oul *OsUserLookup) LookupGroup(name string) (*user.Group, error)
func (*OsUserLookup) LookupGroupId ¶
func (oul *OsUserLookup) LookupGroupId(name string) (*user.Group, error)
type PasswdUserLookup ¶
type PasswdUserLookup struct { RootFs string // contains filtered or unexported fields }
func NewPasswdUserLookup ¶
func NewPasswdUserLookup(path string) (*PasswdUserLookup, error)
func (*PasswdUserLookup) Lookup ¶
func (l *PasswdUserLookup) Lookup(username string) (*user.User, error)
func (*PasswdUserLookup) LookupGroup ¶
func (l *PasswdUserLookup) LookupGroup(name string) (*user.Group, error)
func (*PasswdUserLookup) LookupGroupId ¶
func (l *PasswdUserLookup) LookupGroupId(name string) (*user.Group, error)