deckhouse/k8s-image-availability-exporter

unsupported MediaType error for images from quay.io repository

yuripastushenko opened this issue · 6 comments

Hello!
We installed k8s-image-availability-exporter in our cluster.
For some images, that can be successfully pulled from registry, the application throws errors like:

time="2020-07-13T12:27:05Z" level=error msg="unsupported MediaType: \"application/vnd.docker.distribution.manifest.v1+prettyjws\", see https://github.com/google/go-containerregistry/issues/377" availability_mode=registry_v1_api_not_supported image_name="quay.io/thanos/thanos:v0.8.1"

From related issue - seems this is a problem in interaction between go-containerregistry library and quay.io
Can you suggest any workaround for this problem?

If the problem can't be fixed on k8s-image-availability-exporter side, can we add some configurable options to application that can exclude some registries from querying?
Or better - add label repository in metrics.
In our case it value will be quay.io for quay.io/thanos/thanos:v0.8.1.
If the metrics will have this label - users will be able to create queries, that exclude alerts from particular registries in prometheus rules for alert manager.

I found a workaround.
In prometheus rule you can exclude from alerts images starting with quay.io using regexp in expression like:

max by (namespace, cronjob, container, image) (
          k8s_image_availability_exporter_cronjob_available{image!~"quay.io.*"} == 0
        )

@yuripastushenko
Are you using the latest v0.1.13 image? This has been fixed for a long time.

We are using image flant/k8s-image-availability-exporter:v0.1.5.
I will try to update.

This still happens when pulling from quay-io with old images, i.e. a 3 year old container https://quay.io/repository/ratpoison/oregano-test-ubuntu/build/a0c3d2fe-3873-4fab-8f37-caf8cf77a7e3 yields the error, a recently created does not.

The problem is somewhere in the underlying lib we are using - go-containerregistry. This likely happens because of the outdated version of the image manifest, e.g., v1. If there is someone still facing the problem, could you ping me?