crossplane-contrib / crossplane-contrib/provider-openstack

Bug: ImageV2 creation fails with permission denied

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
68
Forks
18
PR merge metrics
No merged PRs in 30d

Description

### Description

When creating an `ImageV2` resource using the imageSourceUrl parameter, the provider-openstack controller fails with a permission error. The provider attempts to download the image to a default cache directory before uploading it to OpenStack. The process fails because it tries to create a directory in the the filesystem (//.terraform), and seems it is not writable. This leads to a permission denied error.

### Steps to Reproduce

- Apply the following ImageV2 manifest:

```
apiVersion: images.openstack.crossplane.io/v1alpha1
kind: ImageV2
metadata:
annotations:
meta.upbound.io/example-id: images/v1alpha1/imagev2
labels:
testing.upbound.io/example-name: rancheros
name: rancheros
spec:
forProvider:
containerFormat: bare
diskFormat: qcow2
imageSourceUrl: https://releases.rancher.com/os/latest/rancheros-openstack.img
name: RancherOS
properties:
key: value
```

- The following error is reported

```
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CreatedExternalResource 9s managed/images.openstack.crossplane.io/v1alpha1, kind=imagev2 Successfully requested creation of external resource
Warning CannotUpdateExternalResource 3s managed/images.openstack.crossplane.io/v1alpha1, kind=imagev2 async create failed: failed to create the resource: [{0 Error opening file for Image: unable to create dir //.terraform/image_cache: mkdir //.terraform: permission denied []}]
```

### Workaround

A temporary workaround is to explicitly set the `imageCachePath` to `/tmp`:

```
apiVersion: images.openstack.crossplane.io/v1alpha1
kind: ImageV2
metadata:
annotations:
meta.upbound.io/example-id: images/v1alpha1/imagev2
labels:
testing.upbound.io/example-name: rancheros
name: rancheros
spec:
forProvider:
imageCachePath: /tmp
containerFormat: bare
diskFormat: qcow2
imageSourceUrl: https://releases.rancher.com/os/latest/rancheros-openstack.img
name: RancherOS
properties:
key: value
```

### Environment

- Crossplane version: 1.20.0
- Provider Openstack Version: 0.7.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.