Skip to content

Commit 6a151e6

Browse files
YuryLysovdiafouruniversal-itengineer
committed
chore(module): add pre-created mount points to images
Images with pre-created mount points: - cdi-apiserver - cdi-cloner - cdi-controller - cdi-importer - cdi-operator - dvcr - dvcr-importer - dvcr-uploader - kube-api-rewriter - virt-api - virt-controller - virt-handler - virt-launcher - virt-operator - virtualization-api - virtualization-audit - virtualization-controller - hp pods Some notes: - Create /var/run subdirectories in /run, as /var/run is a symlink to ../run. - Add /var, /run and symlink /var/run -> ../run in 'distroless' base image. - Pre-create /var, /run and symlink /var/run -> ../run in kube-api-rewriter image. - Remove unused extraheaders settings in dvcr-importer and dvcr-uploader. Signed-off-by: YuryLysov <[email protected]> Co-authored-by: Ivan Mikheykin <[email protected]> Co-authored-by: Nikita Korolev <[email protected]> Signed-off-by: Nikita Korolev <[email protected]> Signed-off-by: Ivan Mikheykin <[email protected]>
1 parent 4737ea0 commit 6a151e6

File tree

46 files changed

+272
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+272
-57
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
**/*.git
22
**/.svn
33
**/.hg
4+
images/**/mount-points.yaml
45
**/werf*.yaml
56
**/werf*.yml
67
.werf/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/*
2+
3+
Template to bake mount points in the image. These static mount points
4+
are required so containerd can start a container with image integrity check.
5+
6+
Problem: each directory specified in volumeMounts items should exist
7+
in image, containerd is unable to create mount point for us when
8+
integrity check is enabled.
9+
10+
Solution: define all possible mount points in mount-points.yaml file and
11+
include this template in git section of the werf.inc.yaml.
12+
13+
*/}}
14+
{{/* NOTE: Keep in sync with version in Deckhouse CSE */}}
15+
{{- define "image mount points" }}
16+
{{- $mountPoints := ($.Files.Get (printf "images/%s/mount-points.yaml" $.ImageName) | fromYaml) }}
17+
{{- $context := . }}
18+
{{- range $v := $mountPoints.dirs }}
19+
- add: /tools/mounts/mountdir
20+
to: {{ $v | trimSuffix "/" }}
21+
stageDependencies:
22+
install:
23+
- "**/*"
24+
{{- end }}
25+
{{- range $v := $mountPoints.files }}
26+
- add: /tools/mounts/mountfile
27+
to: {{ $v }}
28+
stageDependencies:
29+
install:
30+
- "**/*"
31+
{{- end }}
32+
{{- end }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# A list of pre-created mount points for containerd strict mode.
2+
3+
dirs:
4+
# Create dirs in /run, as /var/run is a symlink to /run.
5+
- /run/certs/cdi-apiserver-signer-bundle
6+
- /run/certs/cdi-apiserver-server-cert
7+
- /kubeconfig.local

images/cdi-apiserver/werf.inc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
33
fromImage: {{ .ModuleNamePrefix }}distroless
4+
git:
5+
{{- include "image mount points" . }}
46
import:
57
- image: {{ .ModuleNamePrefix }}cdi-artifact
68
add: /cdi-binaries
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# A list of pre-created mount points for containerd strict mode.
2+
#
3+
# See https://github.com/deckhouse/3p-containerized-data-importer/blob/80d763d788e06b3decaf22e4762076cec64582b3/pkg/controller/clone-controller.go#L699
4+
5+
dirs:
6+
# Create dirs in /run, as /var/run is a symlink to /run.
7+
- /run/cdi/clone/source

images/cdi-cloner/werf.inc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
33
fromImage: {{ .ModuleNamePrefix }}distroless
4+
git:
5+
{{- include "image mount points" . }}
46
import:
57
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-bins
68
add: /relocate
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# A list of pre-created mount points for containerd strict mode.
2+
#
3+
# Some volume mounts are ignored:
4+
# - /tmp - already in the 'distroless' base image.
5+
6+
dirs:
7+
# Create dirs in /run, as /var/run is a symlink to /run.
8+
- /run/cdi/token/keys
9+
- /run/certs/cdi-uploadserver-signer
10+
- /run/certs/cdi-uploadserver-client-signer
11+
- /run/ca-bundle/cdi-uploadserver-signer-bundle
12+
- /run/ca-bundle/cdi-uploadserver-client-signer-bundle
13+
- /kubeconfig.local

images/cdi-controller/werf.inc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
33
fromImage: {{ .ModuleNamePrefix }}distroless
4+
git:
5+
{{- include "image mount points" . }}
46
import:
57
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-bins
68
add: /relocate
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# A list of pre-created mount points for containerd strict mode.
2+
#
3+
# See https://github.com/deckhouse/3p-containerized-data-importer/blob/d5fa5124b8a645521843814fffecdf385b74b379/pkg/controller/import-controller.go#L962
4+
#
5+
# Some volume mounts are ignored:
6+
# - /extraheaders - Etra headers not implemented in virtualization-controller.
7+
# - /google - No support for GCS data source in VirtualImage.
8+
# - /tmp - already in the 'distroless' base image.
9+
10+
dirs:
11+
- /certs
12+
- /data
13+
- /opt
14+
- /proxycerts
15+
- /scratch
16+
- /shared
17+

images/cdi-importer/werf.inc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
33
fromImage: {{ .ModuleNamePrefix }}distroless
4+
git:
5+
{{- include "image mount points" . }}
46
import:
57
- image: {{ .ModuleNamePrefix }}{{ .ImageName }}-bins
68
add: /relocate

0 commit comments

Comments
 (0)