Skip to content

Commit f0b6604

Browse files
init
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
1 parent 4ab65bc commit f0b6604

File tree

43 files changed

+3006
-14
lines changed

Some content is hidden

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

43 files changed

+3006
-14
lines changed

Taskfile.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ tasks:
165165
"ports": [ { "containerPort": 2345, "name": "dlv" } ],
166166
"readinessProbe": null,
167167
"livenessProbe": null,
168-
"command": null,
169-
"args": []
168+
"command": null
170169
},
171170
{
172171
"name": "proxy",
@@ -215,8 +214,7 @@ tasks:
215214
"ports": [ { "containerPort": 2345, "name": "dlv" } ],
216215
"readinessProbe": null,
217216
"livenessProbe": null,
218-
"command": null,
219-
"args": []
217+
"command": null
220218
},
221219
{
222220
"name": "proxy",
@@ -265,8 +263,7 @@ tasks:
265263
"ports": [ { "containerPort": 2345, "name": "dlv" } ],
266264
"readinessProbe": null,
267265
"livenessProbe": null,
268-
"command": null,
269-
"args": []
266+
"command": null
270267
},
271268
{
272269
"name": "proxy",
@@ -285,3 +282,37 @@ tasks:
285282
}'
286283
kubectl -n d8-virtualization port-forward deploy/vit-api 2345:2345
287284
EOF
285+
286+
dlv:virtualization-dra-plugin:build:
287+
desc: "Build image virtualization-dra-plugin with dlv"
288+
cmds:
289+
- docker build --build-arg BRANCH=$BRANCH -f ./images/virtualization-dra-plugin/debug/dlv.Dockerfile -t "{{ .DLV_IMAGE }}" --platform linux/amd64 .
290+
291+
dlv:virtualization-dra-plugin:build-push:
292+
desc: "Build and Push image virtualization-dra-plugin with dlv"
293+
cmds:
294+
- task: dlv:virtualization-dra-plugin:build
295+
- docker push "{{ .DLV_IMAGE }}"
296+
- task: dlv:virtualization-dra-plugin:print
297+
298+
dlv:virtualization-dra-plugin:print:
299+
desc: "Print commands for debug"
300+
env:
301+
IMAGE: "{{ .DLV_IMAGE }}"
302+
cmd: |
303+
cat <<EOF
304+
kubectl -n d8-virtualization patch ds virtualization-dra --type='strategic' -p '{
305+
"spec": {
306+
"template": {
307+
"spec": {
308+
"containers": [ {
309+
"name": "virtualization-dra",
310+
"image": "${IMAGE}",
311+
"ports": [ { "containerPort": 2345, "name": "dlv" } ]
312+
}]
313+
}
314+
}
315+
}
316+
}'
317+
kubectl -n d8-virtualization port-forward deploy/virtualization-dra 2345:2345
318+
EOF

build/components/versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ firmware:
33
libvirt: v10.9.0
44
edk2: stable202411
55
core:
6-
3p-kubevirt: v1.6.2-v12n.newversionXII
6+
3p-kubevirt: feat/add-dra-usb-support # v1.6.2-v12n.newversionXII
77
3p-containerized-data-importer: v1.60.3-v12n.12
88
distribution: 2.8.3
99
package:

crds/embedded/virtualmachineinstances.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,6 @@ spec:
16511651
via config drive
16521652
type: string
16531653
required:
1654-
- deviceName
16551654
- name
16561655
type: object
16571656
type: array
@@ -3632,6 +3631,7 @@ spec:
36323631
description: PCIAddress is the PCIe bus address
36333632
of the allocated device
36343633
type: string
3634+
type: object
36353635
type: object
36363636
name:
36373637
description: Name is the name of actual device on the
@@ -3674,6 +3674,22 @@ spec:
36743674
description: PCIAddress is the PCIe bus address
36753675
of the allocated device
36763676
type: string
3677+
usbAddress:
3678+
description: USBAddress is the USB bus address
3679+
of the allocated device
3680+
properties:
3681+
bus:
3682+
description: Bus is the bus of the allocated device
3683+
format: int64
3684+
type: integer
3685+
deviceNumber:
3686+
description: DeviceNumber is the device number of the allocated device
3687+
format: int64
3688+
type: integer
3689+
required:
3690+
- bus
3691+
- deviceNumber
3692+
type: object
36773693
type: object
36783694
name:
36793695
description: Name is the name of actual device on the

crds/embedded/virtualmachines.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,6 @@ spec:
24312431
to the guest via config drive
24322432
type: string
24332433
required:
2434-
- deviceName
24352434
- name
24362435
type: object
24372436
type: array

images/virt-artifact/werf.inc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
image: {{ .ModuleNamePrefix }}{{ .ImageName }}-src-artifact
1010
final: false
1111
fromImage: builder/src
12+
fromCacheVersion: "0002" # TODO: remove this
1213
secrets:
1314
- id: SOURCE_REPO
1415
value: {{ $.SOURCE_REPO }}

images/virt-controller/debug/dlv.Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM golang:1.22.7 AS builder
1+
FROM golang:1.23.0 AS builder
22

33
RUN go install github.com/go-delve/delve/cmd/dlv@latest
44

5-
ARG BRANCH="1.3.1-virtualization"
6-
ENV VERSION="1.3.1"
7-
ENV GOVERSION="1.22.7"
5+
ARG BRANCH="1.6.2-virtualization"
6+
ENV VERSION="1.6.2"
7+
ENV GOVERSION="1.23.0"
88

99
# Copy the git commits for rebuilding the image if the branch changes
1010
ADD "https://api.github.com/repos/deckhouse/3p-kubevirt/commits/$BRANCH" /.git-commit-hash.tmp
@@ -14,7 +14,7 @@ WORKDIR /kubevirt
1414
RUN go mod edit -go=$GOVERSION && \
1515
go mod download
1616

17-
RUN go mod vendor
17+
RUN go work vendor
1818

1919
ENV GO111MODULE=on
2020
ENV GOOS=linux
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Copyright 2025 Flant JSC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package logger
18+
19+
import (
20+
"github.com/deckhouse/deckhouse/pkg/log"
21+
"github.com/spf13/pflag"
22+
)
23+
24+
type Options struct {
25+
Level string
26+
Output string
27+
DebugVerbosity int
28+
}
29+
30+
func (o *Options) AddFlags(fs *pflag.FlagSet) {
31+
fs.StringVar(&o.Level, "log-level", o.Level, "Log level")
32+
fs.StringVar(&o.Output, "log-output", o.Output, "Log output")
33+
fs.IntVar(&o.DebugVerbosity, "log-debug-verbosity", o.DebugVerbosity, "Log debug verbosity")
34+
}
35+
36+
func (o *Options) Complete() *log.Logger {
37+
return NewLogger(o.Level, o.Output, o.DebugVerbosity)
38+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM golang:1.24.7-bookworm@sha256:2c5f7a0c252a17cf6aa30ddee15caa0f485ee29410a6ea64cddb62eea2b07bdf AS builder
2+
ARG TARGETOS
3+
ARG TARGETARCH
4+
5+
WORKDIR /app/images/virtualization-dra
6+
RUN go install github.com/go-delve/delve/cmd/dlv@latest
7+
8+
COPY ./images/virtualization-dra/go.mod /app/images/virtualization-dra/
9+
COPY ./images/virtualization-dra/go.sum /app/images/virtualization-dra/
10+
11+
RUN go mod download
12+
13+
COPY ./images/virtualization-dra/cmd /app/images/virtualization-dra/cmd
14+
COPY ./images/virtualization-dra/internal /app/images/virtualization-dra/internal
15+
COPY ./images/virtualization-dra/pkg /app/images/virtualization-dra/pkg
16+
17+
ENV GO111MODULE=on
18+
ENV GOOS=${TARGETOS:-linux}
19+
ENV GOARCH=${TARGETARCH:-amd64}
20+
ENV CGO_ENABLED=0
21+
22+
RUN go build -tags EE -gcflags "all=-N -l" -a -o virtualization-dra-plugin ./cmd/virtualization-dra-plugin
23+
24+
FROM busybox:1.36.1-glibc
25+
26+
WORKDIR /app
27+
COPY --from=builder /go/bin/dlv /app/dlv
28+
COPY --from=builder /app/images/virtualization-dra/virtualization-dra-plugin /app/virtualization-dra-plugin
29+
USER 65532:65532
30+
31+
ENTRYPOINT ["./dlv", "--listen=:2345", "--headless=true", "--continue", "--log=true", "--log-output=debugger,debuglineerr,gdbwire,lldbout,rpc", "--accept-multiclient", "--api-version=2", "exec", "./virtualization-dra-plugin", "--"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# A list of pre-created mount points for containerd strict mode.
2+
3+
dirs:
4+
- /var/run/dbus
5+
- /var/run/cdi
6+
# - /sys/bus/usb/devices
7+
- /var/lib/kubelet/plugins_registry
8+
- /var/lib/kubelet/plugins
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
image: {{ .ModuleNamePrefix }}{{ .ImageName }}
3+
fromImage: {{ .ModuleNamePrefix }}distroless
4+
git:
5+
{{- include "image mount points" . }}
6+
import:
7+
- image: {{ .ModuleNamePrefix }}virtualization-dra-builder
8+
add: /out/virtualization-dra-plugin
9+
to: /app/virtualization-dra-plugin
10+
after: install
11+
{{- if eq $.DEBUG_COMPONENT "delve/virtualization-dra-plugin" }}
12+
- image: debugger
13+
add: /app/dlv
14+
to: /app/dlv
15+
after: install
16+
{{- end }}
17+
imageSpec:
18+
config:
19+
user: 64535
20+
workingDir: "/app"
21+
{{- if eq $.DEBUG_COMPONENT "delve/virtualization-dra-plugin" }}
22+
env:
23+
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/dlv"
24+
XDG_CONFIG_HOME: "/tmp"
25+
entrypoint: ["/app/dlv", "--listen=:2345", "--headless=true", "--continue", "--log=true", "--log-output=debugger,debuglineerr,gdbwire,lldbout,rpc", "--accept-multiclient", "--api-version=2", "exec", "/app/virtualization-dra-plugin", "--", "--leader-election=false"]
26+
{{- else }}
27+
entrypoint: ["/app/virtualization-dra-plugin"]
28+
{{- end }}

0 commit comments

Comments
 (0)