openshift / image-registry

OpenShift cluster image registry
Apache License 2.0
45 stars 75 forks source link

DELETE operation is unsupported #323

Closed roldanx closed 2 years ago

roldanx commented 2 years ago

Using version: image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:71145c39d67b47163c5b9ecace119ee286f30e06fd6645cb07d61dc8f27c96e2

$ oc version
Client Version: 4.10.0-202203170916.p0.g6de42bd.assembly.stream-6de42bd
Server Version: 4.7.44
Kubernetes Version: v1.20.11+e880017
$ oc exec -it -n openshift-image-registry image-registry-86466fdfd7-8t9bf -- cat /config.yml
version: 0.1
log:
  level: info
http:
  addr: :5000
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /registry
  delete:
    enabled: true
auth:
  openshift: {}
openshift:
  version: 1.0
  auth:
    realm: openshift
    # tokenrealm is a base URL to use for the token-granting registry endpoint.
    # If unspecified, the scheme and host for the token redirect are determined from the incoming request.
    # If specified, a scheme and host must be chosen that all registry clients can resolve and access:
    #
    # tokenrealm: https://example.com:5000
  audit:
    enabled: false
  metrics:
    enabled: false
    # secret is used to authenticate to metrics endpoint. It cannot be empty.
    # Attention! A weak secret can lead to the leakage of private data.
    #
    # secret: TopSecretLongToken
  requests:
    # GET and HEAD requests
    read:
      # maxrunning is a limit for the number of in-flight requests. A zero value means there is no limit.
      maxrunning: 0
      # maxinqueue sets the maximum number of requests that can be queued if the limit for the number of in-flight requests is reached.
      maxinqueue: 0
      # maxwaitinqueue is how long a request can wait in the queue. A zero value means it can wait forever.
      maxwaitinqueue: 0
    # PUT, PATCH, POST, DELETE requests and internal mirroring requests
    write:
      # See description of openshift.requests.read.
      maxrunning: 0
      maxinqueue: 0
      maxwaitinqueue: 0
  quota:
    enabled: false
    cachettl: 1m
  cache:
    blobrepositoryttl: 10m
  pullthrough:
    enabled: true
    mirror: true
  compatibility:
    acceptschema2: true

Hi guys,

I am trying to delete an image as documentation states for V2 registries: $ curl -Ik -u <user:password> -H "Accept: application/vnd.docker.distribution.manifest.v2+json" https://<registry>/v2/<image>/manifests/<tag> | awk '$1 == "Docker-Content-Digest:" { print $2 }' | tr -d $'\r' $ curl -k -u <user:password> -X DELETE https://<registry>/v2/<image>/manifests/<digest>

However, I am getting {"errors":[{"code":"UNSUPPORTED","message":"The operation is unsupported."}]}. Please note that the env variable storage.delete.enabled: true is correctly set.

dmage commented 2 years ago

This endpoint deletes only leftovers and is used primarily by the image pruner.

If you want to delete an image, you need to use oc delete imagestreamtag IMAGESTREAM:TAG -n NAMESPACE.