Add an OCI annotation for sandbox log directory.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
fbce57903c
commit
9eabcf525e
@ -32,6 +32,15 @@ const (
|
|||||||
// SandboxID is the sandbox ID annotation
|
// SandboxID is the sandbox ID annotation
|
||||||
SandboxID = "io.kubernetes.cri.sandbox-id"
|
SandboxID = "io.kubernetes.cri.sandbox-id"
|
||||||
|
|
||||||
|
// SandboxLogDir is the pod log directory annotation.
|
||||||
|
// If the sandbox needs to generate any log, it will put it into this directory.
|
||||||
|
// Kubelet will be responsible for:
|
||||||
|
// 1) Monitoring the disk usage of the log, and including it as part of the pod
|
||||||
|
// ephemeral storage usage.
|
||||||
|
// 2) Cleaning up the logs when the pod is deleted.
|
||||||
|
// NOTE: Kubelet is not responsible for rotating the logs.
|
||||||
|
SandboxLogDir = "io.kubernetes.cri.sandbox-log-directory"
|
||||||
|
|
||||||
// UntrustedWorkload is the sandbox annotation for untrusted workload. Untrusted
|
// UntrustedWorkload is the sandbox annotation for untrusted workload. Untrusted
|
||||||
// workload can only run on dedicated runtime for untrusted workload.
|
// workload can only run on dedicated runtime for untrusted workload.
|
||||||
UntrustedWorkload = "io.kubernetes.cri.untrusted-workload"
|
UntrustedWorkload = "io.kubernetes.cri.untrusted-workload"
|
||||||
|
@ -454,6 +454,7 @@ func (c *criService) generateSandboxContainerSpec(id string, config *runtime.Pod
|
|||||||
|
|
||||||
g.AddAnnotation(annotations.ContainerType, annotations.ContainerTypeSandbox)
|
g.AddAnnotation(annotations.ContainerType, annotations.ContainerTypeSandbox)
|
||||||
g.AddAnnotation(annotations.SandboxID, id)
|
g.AddAnnotation(annotations.SandboxID, id)
|
||||||
|
g.AddAnnotation(annotations.SandboxLogDir, config.GetLogDirectory())
|
||||||
|
|
||||||
return g.Config, nil
|
return g.Config, nil
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,9 @@ func getRunPodSandboxTestData() (*runtime.PodSandboxConfig, *imagespec.ImageConf
|
|||||||
|
|
||||||
assert.Contains(t, spec.Annotations, annotations.ContainerType)
|
assert.Contains(t, spec.Annotations, annotations.ContainerType)
|
||||||
assert.EqualValues(t, spec.Annotations[annotations.ContainerType], annotations.ContainerTypeSandbox)
|
assert.EqualValues(t, spec.Annotations[annotations.ContainerType], annotations.ContainerTypeSandbox)
|
||||||
|
|
||||||
|
assert.Contains(t, spec.Annotations, annotations.SandboxLogDir)
|
||||||
|
assert.EqualValues(t, spec.Annotations[annotations.SandboxLogDir], "test-log-directory")
|
||||||
}
|
}
|
||||||
return config, imageConfig, specCheck
|
return config, imageConfig, specCheck
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user