-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
store snapshot of config files on create #824
Conversation
Files can be reused when container needs to be booted again. Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
79701a5
to
40121c6
Compare
@tonistiigi I prefer use single one ConfigMap if we could multi ConfigMap. Example
If still keep multiple ConfigMaps, need to add label in ConfigMaps, and List by label before delete For single one ConfigMap. could be: configFiles := []struct {
name string
absPath string
}{}
d.Spec.Template.Spec.Containers[0].VolumeMounts = make([]corev1.VolumeMount, len(configFiles))
d.Spec.Template.Spec.Volumes = make([]corev1.Volume, len(configFiles))
for i, cf := range configFiles {
d.Spec.Template.Spec.Containers[0].VolumeMounts[i] = corev1.VolumeMount{
Name: "config-" + cf.name,
MountPath: cf.name,
SubPath: filepath.Base(cf.absPath),
}
d.Spec.Template.Spec.Volumes[i] = corev1.Volume{
Name: "config-" + cf.name,
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: "config", // from same ConfigMap
},
Items: []corev1.KeyToPath{
{
Key: cf.name,
Path: filepath.Base(cf.absPath),
},
},
},
}}
} Which one do you prefer ? |
I'd like to keep the file structure the same as container driver(+rest in future) and reuse the same code. I didn't quite get in what case the second release with config and no certs can happen. Also not sure how they remain mounted if they are removed from container spec. On deletion cleanup by id should still work. I added incrementing numbers to names. |
If you think deletion by a label is safer feel free to add commit for that. |
@tonistiigi |
@tonistiigi Could the spec be a map where we also define the base dir. So instead of: {
"Nodes": [
{
"Files": {
"buildkitd.toml": "...",
"certs/docker.io/cert.pem": "...",
"certs/docker.io/key.pem": "...",
"certs/docker.io/myca.pem": "..."
}
}
],
} we have: {
"Nodes": [
{
"Files": [
{
"/etc/buildkit": {
"buildkitd.toml": "...",
"certs/docker.io/cert.pem": "...",
"certs/docker.io/key.pem": "...",
"certs/docker.io/myca.pem": "..."
}
}
]
}
]
} to be able to handle other use cases in the future outside buildkitd config? |
@crazy-max It could be though that we want to change the etc dir in the future. Eg. Rootless could be one case |
Files can be reused when container needs to be booted again.
The second commit enables config files for k8s. @morlay PTAL. If something is wrong we can remove the second commit or you can push a fix to this PR.
Signed-off-by: Tonis Tiigi [email protected]