Skip to content

Unable to generate a cloud image for Azure #104

Open
@VishalKulshrestha

Description

@VishalKulshrestha

Unable to generate a cloud image for Azure

There is no Azure image generated when trying to build using the below definition.

kind: OSArtifact
apiVersion: build.kairos.io/v1alpha2
metadata:
  name: azure-hello-kairos-cloud
spec:
  imageName: "quay.io/kairos/core-opensuse-leap:latest"
  azureImage: true
  bundles:
    # Bundles available at: https://packages.kairos.io/Kairos/
    - quay.io/kairos/packages:helm-utils-3.13.0
  cloudConfigRef:
    name: cloud-config
    key: userdata
  exporters:
    - template:
        spec:
          restartPolicy: Never
          containers:
            - name: upload
              image: quay.io/kairos/osbuilder-tools:latest
              command:
                - bash
              args:
                - -c
                - |
                  for f in $(ls /artifacts)
                  do
                    curl -T /artifacts/$f http://osartifactbuilder-operator-osbuilder-nginx/upload/$f
                  done
              volumeMounts:
                - name: artifacts
                  mountPath: /artifacts

Analysis and rootcause

The OSArtifact pod runs multiple containers to build the image but the container to build Azure image fails as it expects a raw image as an input argument which it fails to find as there is no container running to build a raw image.

build-azure-cloud-image container logs:

+ /azure.sh /artifacts/azure-hello-kairos-cloud.raw /artifacts/azure-hello-kairos-cloud.vhd
cp: cannot stat '/artifacts/azure-hello-kairos-cloud.raw': No such file or directory
qemu-img: Could not open '/artifacts/azure-hello-kairos-cloud.raw': Could not open '/artifacts/azure-hello-kairos-cloud.raw': No such file or directory
Resizing raw image to 0
qemu-img: Could not open '/artifacts/azure-hello-kairos-cloud.vhd.work': Could not open '/artifacts/azure-hello-kairos-cloud.vhd.work': No such file or directory
Converting /artifacts/azure-hello-kairos-cloud.raw to /artifacts/azure-hello-kairos-cloud.vhd
qemu-img: Could not open '/artifacts/azure-hello-kairos-cloud.vhd.work': Could not open '/artifacts/azure-hello-kairos-cloud.vhd.work': No such file or directory
Done

Containers in pod

  initContainers:
    - name: pull-image-baseimage
      image: quay.io/kairos/osbuilder-tools:v0.7.0
      ...
    - name: pull-image-0
      image: quay.io/kairos/osbuilder-tools:v0.7.0
    ...
  containers:
    - name: build-azure-cloud-image
      image: quay.io/kairos/osbuilder-tools:v0.7.0
      command:
        - /bin/bash
        - '-cxe'
      args:
        - >-
          /azure.sh /artifacts/azure-hello-kairos-cloud.raw
          /artifacts/azure-hello-kairos-cloud.vhd
    - name: create-image
      image: quay.io/kairos/osbuilder-tools:v0.7.0
      command:
        - /bin/bash
        - '-cxe'
      args:
        - >-
          tar -czvpf test.tar -C /rootfs . && luet util pack
          quay.io/kairos/core-opensuse-leap:latest test.tar
          azure-hello-kairos-cloud.tar && chmod +r azure-hello-kairos-cloud.tar
          && mv azure-hello-kairos-cloud.tar /artifacts

Possible solution

The build-azure-cloud-image container could include the script(raw-images.sh) to build the raw image and thus provide input for the azure.sh to create the vhd.

I expect the same issue to happen for gce image build process as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions