Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 8bd16be

Browse files
committed
fix(CNV-48974): download disk img from vmexport-api
- Install missing nbdkit-curl-plugin pkg - Fix wrong volume names - Fix wrong logs - Create secret (and get export token) - Get and create certificate file - Cleanup deployed resources Secret is used by VMExport and is needed to set a new generated token. This token is used by the VMExport API to accept calls to the endpoints. Certificate is provided by VMExport and is needed to be used by the client in order to make HTTPs client requests. Signed-off-by: Ben Oukhanov <boukhanov@redhat.com>
1 parent 2ed6484 commit 8bd16be

File tree

5 files changed

+228
-56
lines changed

5 files changed

+228
-56
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o kubevirt-disk-uploader .
88

99
FROM quay.io/fedora/fedora-minimal:39
1010

11-
RUN microdnf install -y nbdkit qemu-img && microdnf clean all -y
11+
RUN microdnf install -y nbdkit nbdkit-curl-plugin qemu-img && microdnf clean all -y
1212
COPY --from=builder /app/kubevirt-disk-uploader /usr/local/bin/kubevirt-disk-uploader
1313

1414
ENTRYPOINT ["/usr/local/bin/kubevirt-disk-uploader"]

examples/kubevirt-disk-uploader-tekton.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ spec:
252252
- name: VM_NAME
253253
value: example-vm-tekton
254254
- name: VOLUME_NAME
255-
value: datavolumedisk
255+
value: example-dv-tekton
256256
- name: IMAGE_DESTINATION
257257
value: quay.io/boukhano/example-vm-tekton-exported:latest
258258
- name: PUSH_TIMEOUT

kubevirt-disk-uploader.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ rules:
1515
- apiGroups: [""]
1616
resources: ["secrets"]
1717
verbs: ["get", "create"]
18+
- apiGroups: [""]
19+
resources: ["pods"]
20+
verbs: ["get"]
1821
---
1922
apiVersion: rbac.authorization.k8s.io/v1
2023
kind: RoleBinding
@@ -53,8 +56,12 @@ spec:
5356
valueFrom:
5457
fieldRef:
5558
fieldPath: metadata.namespace
59+
- name: VM_NAME
60+
valueFrom:
61+
fieldRef:
62+
fieldPath: metadata.name
5663
command: ["/usr/local/bin/kubevirt-disk-uploader"]
57-
# args: ["--vmname", "example-vm", "--volumename", "datavolumedisk", "--imagedestination", "quay.io/boukhano/example-vm-exported:latest", "--pushtimeout", "120"]
64+
# args: ["--vmname", "example-vm", "--volumename", "example-dv", "--imagedestination", "quay.io/boukhano/example-vm-exported:latest", "--pushtimeout", "120"]
5865
resources:
5966
requests:
6067
memory: 3Gi

0 commit comments

Comments
 (0)