Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate a cloud image for Azure #104

Open
VishalKulshrestha opened this issue Oct 25, 2023 · 0 comments
Open

Unable to generate a cloud image for Azure #104

VishalKulshrestha opened this issue Oct 25, 2023 · 0 comments

Comments

@VishalKulshrestha
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant