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

Commit

Permalink
fix(CNV-48974): download disk img from vmexport-api
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
codingben committed Sep 26, 2024
1 parent 2ed6484 commit 8bd16be
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o kubevirt-disk-uploader .

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

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

ENTRYPOINT ["/usr/local/bin/kubevirt-disk-uploader"]
2 changes: 1 addition & 1 deletion examples/kubevirt-disk-uploader-tekton.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ spec:
- name: VM_NAME
value: example-vm-tekton
- name: VOLUME_NAME
value: datavolumedisk
value: example-dv-tekton
- name: IMAGE_DESTINATION
value: quay.io/boukhano/example-vm-tekton-exported:latest
- name: PUSH_TIMEOUT
Expand Down
9 changes: 8 additions & 1 deletion kubevirt-disk-uploader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down Expand Up @@ -53,8 +56,12 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: VM_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
command: ["/usr/local/bin/kubevirt-disk-uploader"]
# args: ["--vmname", "example-vm", "--volumename", "datavolumedisk", "--imagedestination", "quay.io/boukhano/example-vm-exported:latest", "--pushtimeout", "120"]
# args: ["--vmname", "example-vm", "--volumename", "example-dv", "--imagedestination", "quay.io/boukhano/example-vm-exported:latest", "--pushtimeout", "120"]
resources:
requests:
memory: 3Gi
Expand Down
Loading

0 comments on commit 8bd16be

Please sign in to comment.