1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Commit Graph

74 Commits

Author SHA1 Message Date
Jordi Piriz
747d1694cd revert: tracing improving otlp handling (PROJQUAY-8902) (#4438)
Revert "tracing: improving otlp handling (PROJQUAY-8902) (#4198)"

This reverts commit 89e758846f.
2025-11-03 16:17:32 +01:00
Michaela Lang
89e758846f tracing: improving otlp handling (PROJQUAY-8902) (#4198)
improve OpenTelemetry implementation
2025-10-23 12:20:34 -04:00
Ivan Bazulic
9be679eb58 mirror: Add job timeout to mirror configurations (PROJQUAY-7249) (#3723)
* mirror: Add job timeout to mirror configurations (PROJQUAY-7249)
Previous global job timeout of 5 minutes was inadequate for big images. The timeout should now be configurable in much the same way as sync is. Minimum job length is 300 seconds/5 minutes.

The PR is still work in progress.

* Fix init db, remove reference to user data in logs

* Fix tests, change repo mirror configuration

* Fix tests, make mirroring cancellable through UI

* Add cancel mirror test, change HTML document to reflect mirror timeout

* Flake8 doesn't like when '==' is used with 'None'

* Fix mirror registry tests

* Add new cypress data to fix cypress tests

* Added ability to define upload chunk size to RADOS driver, small changes to repo mirror HTML page

* Fix database migration to follow HEAD

* Upload new database data for Cypress tests

* Make skopeo_timeout_interval mandatory on API calls

---------

Co-authored-by: Ivan Bazulic <ibazulic@redhat.com>
2025-06-12 19:09:51 +02:00
Emmanuel Ferdman
bf82e26c56 fix: migrate to logging.warning (PROJQUAY-8996) (#3976)
fix: migrate to logging.warning

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-06-10 13:50:53 -04:00
Ivan Bazulic
d9d5ed9cc4 storage: Increase proxy JWT expiry to 10 minutes (PROJQUAY-8894) (#3865)
* storage: Increase proxy JWT expiry to 10 minutes (PROJQUAY-8894)
The current JWT expiry time of 30 seconds is sometimes inadequate, especially for scanning purposes when download is not as quick as one expects. This will increase the expiry time to 10 minutes allowing downloading of layers even in slower environments.

* Set expiry to 600 seconds
2025-05-06 19:23:55 +02:00
Ivan Bazulic
a6713a669d storage: Enable multipart upload for Google Cloud Storage (PROJQUAY-6862) (#3748)
* storage: Enable multipart upload for Google Cloud Storage (PROJQUAY-6862)
This PR removes the `_stream_write_internal` function override that caused excessive memory consumption and defaults to the old one which chunks uploads. Server assembly is still not suppored by GCS, so we have to assemble everything locally. However, GCS does support the copy function, so a reupload is not needed.

~~~
REPOSITORY                                        TAG         IMAGE ID      CREATED      SIZE
registry.fedoraproject.org/fedora                 latest      ecd9f7ee77f4  2 days ago   165 MB
quay.skynet/ibazulic/big-mirror-test              size138gb   8e6ba9ff13c0  3 days ago   148 GB
quay.skynet/quay-mirror/big-mirror-test           size138gb   8e6ba9ff13c0  3 days ago   148 GB
quay.skynet/ibazulic/mfs-image-test               latest      ab14f2230dd9  7 days ago   5.96 GB
quay.skynet/ibazulic/azure-storage-big-file-test  latest      ede194b926e0  7 days ago   16.1 GB
quay.skynet/ibazulic/minio/minio                  latest      76ed5b96833a  6 weeks ago  532 B

Getting image source signatures
Copying blob 9d9c3d76c421 done   |
Copying blob fce7cf3b093c skipped: already exists
Copying config 8e6ba9ff13 done   |
Writing manifest to image destination
~~~

For uploading extremely big layers, 5 MiB as the default chunk size is not enough. The PR also enables support for user-defined chunk sizes via `minimum_chunk_size_mb` and `maximum_chunk_size_mb` which default to 5 Mib and 100 MiB respectively.

* Remove maximum_chunk_size_mb as it's not needed
2025-04-04 10:16:12 -04:00
Mathieu Bouchard
acbe6c2278 [Feature] storage: Modify the STS S3 implementation of the storage backend to use Web Identity Tokens when available (PROJQUAY-8576) (#3670)
When deploying Quay in a Secure AWS environment, we can't use IAM Access Keys or Secrets since these credentials are often blocked for multiple reasons (credentials are long-lived, can be shared / stolen, etc.). So the preferred deployment method is to use an alternative method, like the Web Identity Token files that are automatically created in a Kubernetes cluster that has a federation link with IAM using the OIDC provider federation.

The current code of Quay force the use of an IAM account that is then used to assume another role that has S3 access to store the image files. The current pull request removes the need to use that IAM account and allows to directly assume the correct role using Web Identity Tokens while retaining compatibility with the old method of using IAM credentials.

The code relies on the automatic detection of the correct configurations using environment variables where possible. The code has been tested on an OpenShift cluster deployed using manual mode with AWS STS.
2025-03-13 14:44:24 -04:00
Kenny Lee Sin Cheong
d1d675a499 healthcheck: add option to check preferred storage during instance check (PROJQUAY-5074) (#2854) 2025-03-06 09:29:07 -05:00
Sunandadadi
ad3423e223 storage: fix format error (PROJQUAY-8610) (#3697) 2025-03-05 11:34:45 -05:00
Michaela Lang
e2dbce0439 storage(cloudfront): fixed presign uri for multi-region (PROJQUAY-8532) (#3666)
Fixed super initialize to include region_name in CloudFrontedS3Storage.
2025-02-26 13:22:42 -05:00
Harish Govindarajulu
c85221771c storage: Redirect in network request to return s3 signed URL (PROJQUAY-8489) (#3590)
* storage: Redirect in network request to return s3 signed URL(PROJQUAY-8489)

* Fix tests

* Modify assert to mitigate error from code scanning tool

---------

Signed-off-by: harishsurf <hgovinda@redhat.com>
2025-01-29 12:30:01 -05:00
Syed Ahmed
2cb83bc71c storage: Add akamai storage provider (PROJQUAY-7238) (#2898)
* storage: Add akamai storage provider (PROJQUAY-7238)

Adds Akamai as another S3 backed storage provider
for CDN redundency

* fix formatting

* debug logs

* remove debug logs

* add tests for akamai storage provider class

---------

Co-authored-by: Sunandadadi <Sunandadadi@users.noreply.github.com>
Co-authored-by: Sunandadadi <sunanda.3094@gmail.com>
2024-11-19 11:53:38 -05:00
Marcus Kok
4bd036b6c5 storage: add namespace filter to direct download responses (PROJQUAY-8147) (#3363)
* add namespace filter to direct download responses
2024-10-28 13:09:54 -04:00
Michaela Lang
6a7beacb92 storage(StorageClasses): Presign v2/v4 stsfix (PROJQUAY-7689) (#3154)
fixing the error seen with signature_v2/v4 patch #3041 when using STSS3Storage. The STSS3Storage Class is using the connect_kwargs dictionary to initialze the S3Storage Class where all other use that dict for the connection parameters which is misleading and I did not catch that when submitting the patch for the signature v2/v4
2024-08-27 09:39:55 -04:00
Michaela Lang
0b894199cd storage(StorageClasses): support changing signature version for pre-signed URL (PROJQUAY-7491) (#3041)
Pre-signed URL's are only on the S3Storage Class configured vor s3v4 (hard coded). This adds the attribute signature_version to all StorageClass definitions to be configured individually. The behavior when not set defaults back to v2 for all StorageClasses except S3Storage which defaults to s3v4.
2024-07-24 09:12:20 -04:00
Michaela Lang
27ebc40c91 storage(RadosGWStorage): add Region to RadosGWStorage for multi-zone setups (PROJQUAY-7300) (#2928)
add Region to RadosGWStorage for multi-zone setups
2024-07-04 11:21:20 +02:00
Syed Ahmed
c348df705f storage: use managed copy for single chunk uploads (PROJQUAY-7328) (#2959)
* storage: use managed copy for single chunk uploads (PROJQUAY-7328)

We do a multi-part copy from the staging location to the
final blob location in 5GB chunks sequentially. For large
layers this is extremely slow. Use managed `copy` to
move the blob to the final location faster
2024-06-20 16:31:08 -04:00
Syed Ahmed
a8e6a6406d storage: Add min chunk size for S3 storage for multipart upload (PROJQUAY-7328) (#2949)
* storage: Add min chunk size for S3 storage for multipart upload (PROJQUAY-7328)

Adds an option for min_chunk_size to the S3 storage provider
2024-06-14 14:01:55 -04:00
Syed Ahmed
ec2ee2f98e storage: Add S3 optimization for CloudFlare provider (PROJQUAY-7267) (#2913)
This adds the optimization in CloudFlare where if a request is from the primary region then instead of redirecting to the CDN, we return the S3 URL to save egress cost
2024-06-06 14:13:14 -04:00
Marcus Kok
e28d0837df storage: add repo_name to direct download url parameter (PROJQUAY-7020) (#2826)
add repo_name to direct download url parameter
2024-04-22 10:09:21 -04:00
Ivan Bazulic
0da709019b storage: Increase GCP timeout (PROJQUAY-6819) (#2729)
* storage: Increase GCP timeout (PROJQUAY-6819)
Currently, Boto GCP timeout is set to 60 seconds which causes a problem in pushing big layers. This will increase boto timeout to 10 minutes to be more aligned with our other S3 engines. Result:

~~~
root@cyberdyne:~# time { docker push quay.skynet/ibazulic/gcp-test; }
Using default tag: latest
The push refers to repository [quay.skynet/ibazulic/gcp-test]
4335316598de: Pushed
d101c9453715: Pushed
latest: digest: sha256:c6ffbd16c2ef43496ff13c130e31be84ceccdb5408e4f0d3b0f06ae94d378ff9 size: 744

real	7m9.881s
user	0m0.204s
sys	0m0.077s
root@cyberdyne:~#
~~~

* Fix isort sorting

* Made `boto_timeout` configurable, defaults to 60

* Made `boto_timeout` configurable, fix isort issues

* Remove reference to `self.boto_timeout`
2024-03-06 17:17:10 -05:00
Jonathan King
233c128849 sts: Add STS support for S3 (PROJQUAY-6362) (#2632)
- Add STS authentication to s3
- Add STS validation to config tool
- PR automatically refreshes token on expiry
2024-02-22 10:50:54 -05:00
Syed Ahmed
93c816b2b7 cdn: add namespace and username to CDN redirect for usage calculation (PROJQUAY-5939) (#2616)
* cdn: add namespace and username to CDN redirect for usage calculation (PROJQUAY-5939)

We use the referer header to infer the namespace but that
is not always reliable as some clients don't add that header
when sending the request to the CDN
2024-01-18 10:39:18 -05:00
Ivan Bazulic
e243d233f1 storage: Fix big layer uploads for Ceph/RADOS driver (PROJQUAY-6586) (#2601)
* storage: Fix big layer uploads for Ceph/RADOS driver (PROJQUAY-6586)
Current uploads of large images usually fail on Ceph/RADOS compatible implementations (including Noobaa) because during the last assembly, copy is done all at once. For large layers, this takes a long while and Boto times out. With this patch, we limit the size of the used chunk to 32 MB so the final copy is done in parts of up to 32 MB each. The size can be overridden by specifying the parameter `maximum_chunk_size_mb` in the driver settings. For backwards compatibility, an additional parameter was added: if `server_side_assembly: true` then we force server side assembly and the final blob push in chunks, if `server_side_assembly: false` we fall back to default client side assembly (we increase the boto timeout in this case to still support large layer upload):

~~~
DISTRIBUTED_STORAGE_CONFIG:
    default:
        - RadosGWStorage
        - ...
           maximum_chunk_size_mb: 100
           server_side_assembly: true
~~~

* Fix formatting

* Added backward compatiblity switch and increased boto timeout

* Changed name of variable in config

* Small fixes to if statements
2024-01-16 12:44:14 -05:00
Brandon Caton
9f0e60e468 storage: adding IBM COS storage option (PROJQUAY-2679) (#2470)
Adding IBM COS storage option.
2023-11-13 09:53:33 -05:00
Syed Ahmed
ad0d979c48 storage: pass S3 region to S3Storage init (PROJQUAY-6375) (#2459)
storage: pass S3 region to S3Storage init (PROJQUAY-6375)

This is needed for correctly signing URLs for CloudFlare
2023-11-07 10:15:11 -05:00
Brandon Caton
3e9cff6cf3 storage: adding maximum_chunk_size_gb storage option (PROJQUAY-2679) (#2186)
Adds the `maximum_chunk_size_gb` option to s3 storage to reduce chunk size and increase performance. Also removes redundant storage copy call.
2023-08-30 13:48:23 -04:00
Kenny Lee Sin Cheong
5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00
Syed Ahmed
af97203ec7 storage: Check for request context before getting host header (PROJQUAY-5860) (#2024)
The download_url function is also used by the security worker which doesn't have an app context when it calls.
2023-07-20 10:46:27 -04:00
Syed Ahmed
8cacdf19b2 storage: make cloudfront_distribution_org_overrides optional (PROJQUAY-5788) (#2004)
* storage: make cloudfront_distribution_org_overrides optional (PROJQUAY-5788)

This is causing issues with config editor where it
configure CloudFront provider because of the required
override param
2023-07-11 10:54:27 -04:00
Marcus Kok
c49077cff6 storage: Do nothing when completing chunked upload if chunk list is empty (PROJQUAY-5489) (#2005)
When completing a chunked upload, if the chunk list is empty do not attempt to assemble anything.

Using oras to copy an artifact from an outside registry to quay results in a 5XX error. This is because at some point the upload chunk list is empty and attempting to complete the chunked upload causes an exception. Not trying to write to storage if there are no chunks allows the copy operation to successfully complete.
2023-07-06 15:45:20 -04:00
Syed Ahmed
a985bb6c28 storage: Add Host header matching for multi CDN storage (PROJQUAY-5415) (#1969)
* storage: Add Host header matching for multi CDN storage (PROJQUAY-5415)
2023-06-22 14:23:47 -04:00
Kenny Lee Sin Cheong
2e5f25726a storagereplication: sleep on unexpected exception for retry (PROJQUAY-4792) (#1792) 2023-03-27 12:06:10 -04:00
Kenny Lee Sin Cheong
6388837981 storage: add option to validate all configured storages (PROJQUAY-5074) (#1752)
Add config option to validate all configured storages, and not just
the first preferred one during healthcheck.
2023-02-15 15:55:06 -05:00
Syed Ahmed
0ae31c6ebc storage: Add MultiCDN storage provider (PROJQUAY-5048) (#1747)
* storage: Add MultiCDN storage provider (PROJQUAY-5048)

This storage provider can route to different underlying sub-providers
based on a critiera. Currently supported filters are source_ip and
namespace.

Example Config:

- MultiCDNStorage
- providers:
    TargetName1:
        - ProviderName1
        - porviderConfig1
    Targetname2:
        - ProviderName2
        - ProviderConfig2
  default_provider: TargetName1
  rules:
  - namespace: test
    continent: APAC
    target: TargetName2
2023-02-13 09:59:30 -05:00
Ivan Bazulic
e4e00f706a Revert "chore: Add server side assembly of chunked metadata for RADOSGW driver (PROJQUAY-4592) (#1557)" (#1642)
This reverts commit cdb52ed023.
Noobaa has issues assembling big blobs from keys so this needs to be reverted and more testing is required.
2022-11-23 16:17:55 -05:00
Syed Ahmed
705ea386d2 Add S3 Region to CloudFlare URL (PROJQUAY-3512) (#1630)
This will be used by the CloudFlare worker to redirect
to the correct S3 origin bucket
2022-11-21 11:59:21 -05:00
kwestpharedhat
dcf5a377a9 Quay: Cloudfront multi domain (PROJQUAY-4506) (#1598)
Multi domain support for Quay. CLOUDFRONT ONLY
2022-11-02 13:05:14 -05:00
Syed Ahmed
f4d9dda27d storage: Add **kwargs to get_direct_download_url for CloudFlare storage (PROJQUAY-3512) (#1594)
We are passing extra params like `username` which need to be accepted by
the CloudFlare storage provider
2022-10-25 14:45:25 -04:00
Syed Ahmed
407355691b storage: Add Cloudflare as a CDN provider for an S3 backed storage (PROJQUAY-3699) (#1294)
storage: Add Cloudflare as a CDN provider for an S3 backed storage (PROJQUAY-3699)

This adds CloudFlare as a CDN provider for quay for any storage backed
by S3. This requires a worker script that needs to be setup seperately
on CloudFlare. More details on the worker at
https://github.com/quay/quay-cloudflare-cdn-worker
2022-10-13 10:17:34 -04:00
Ivan Bazulic
cdb52ed023 chore: Add server side assembly of chunked metadata for RADOSGW driver (PROJQUAY-4592) (#1557)
* chore: Add server side assembly of chunked metadata for RADOSGW driver (PROJQUAY-0000)
RadosGW did not support multipart copying from keys so we needed to do a local join and reupload of the whole blob. This creates issues for blobs which are fairly big.
Since the issue was fixed in 2015. on the Rados side, we no longer need this part of legacy code.

See [here](https://github.com/ceph/ceph/pull/5139) for more information.

* Fixed linting with black
2022-10-12 09:30:28 -04:00
Flavian Missi
4756469007 storage: handle KeyError we sometimes get from aws (#1543) 2022-09-27 18:11:29 +02:00
Syed Mushtaq Ahmed
a101553cb1 storage: return S3 url only for ip ranges in the same region (PROJQUAY-4498) (#1539)
This optimization ensures that we return the direct S3 URL for
CloudFront storage only for requests from the same region. This
ensures we don't get charged for cross-region traffic to S3
2022-09-22 10:13:02 -04:00
Syed Mushtaq Ahmed
e6be9fc43a storage: Add username field to requests on CloudFront (PROJQUAY-3511) (#1486)
* storage: Add username field to requests on CloudFront (PROJQUAY-3511)

This is to corelate the a user with CDN traffic in CloudFront logs
2022-08-22 10:24:48 -04:00
Dave O'Connor
db225c3293 Bump PyJWT (#1465) 2022-08-08 11:02:09 -04:00
Oleg Bulatov
366be31896 Update type hints (#1409)
* Update peewee types

Also remove tools/sharedimagestorage.py as it doesn't work anymore.

    tools/sharedimagestorage.py:3: error: "ModelSelect[ImageStorage]" has no attribute "annotate"

* Remove endpoints/api/test/test_security.py from exclude list

* Format storage/test/test_azure.py
2022-06-27 17:52:29 +02:00
Kenny Lee Sin Cheong
56b16b70cc storage: optimize large azure chunked upload (PROJQUAY-3753) (#1387)
- Increase nginx send timeout on blobs endpoints
- Reduce Azure blob block size

TODO: Spread block uploads over multiple worker threads.
2022-06-21 09:48:38 -04:00
Oleg Bulatov
5eaf0584db chore: Run mypy as CI job (#1363)
* Run mypy as CI job

* Fix peewee.pyi and configure pyright
2022-06-13 11:01:17 +02:00
Kenny Lee Sin Cheong
c9c9133914 storage: allow arbitrary endpoint url for azure storage (#1071) 2022-04-19 09:45:15 -04:00
Brandon Caton
ef91c57c23 format: Updating black to resolve click dependency issue (PROJQUAY-3487) (#1209)
Currently the CI breaks due to a dependency of black, `click`, breaking with it's latest release with `ImportError: cannot import name '_unicodefun' from 'click'`. Since black does not pin it's version of click it pulls in the latest version containing the breaking change and fails the CI check. This updates black with the patch. [See the original issue here.](https://github.com/psf/black/issues/2964) The rest of the changes are format updates introduced with the latest version of black.
2022-03-29 15:34:57 -04:00