1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Commit Graph

44 Commits

Author SHA1 Message Date
OpenShift Cherrypick Robot
a6776d940c [redhat-3.9] storage: adding maximum_chunk_size_gb storage option (PROJQUAY-2679) (#2191)
Adding maximum_chunk_size_gb S3 storage option

---------

Co-authored-by: bcaton <bcaton@redhat.com>
2023-08-30 17:02:11 -04:00
OpenShift Cherrypick Robot
313a95444b [redhat-3.9] storage: make cloudfront_distribution_org_overrides optional (PROJQUAY-5788) (#2009)
* 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

* fix black formatting

* fix tests

* fix black formatting

* fix tests

* fix tests

---------

Co-authored-by: Syed <syed@apache.org>
2023-07-11 23:39:13 +02: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
Flavian Missi
fe4d66b030 feat: pull-thru proxy cache (#1053)
introduces the possibility to pull images from external registries
through Quay, storing them locally for faster subsequent pulls.

Closes PROJQUAY-3030 and PROJQUAY-3033
2022-03-23 17:20:00 +01:00
Kenny Lee Sin Cheong
13a9f8f44e storage: Add cn-northwest-1 to s3_region northwest (PROJQUAY-3082) (#1137)
Missed cn-northwest-1 in ca17eb43. Currently cn-north-1 and
cn-northwest-1 are valid.
2022-02-28 11:01:18 -05:00
Kenny Lee Sin Cheong
ca17eb4312 storage: handle cn-north-1 region (PROJQUAY-3082) (#1129)
Handle S3 cn-north-1's endpoint, which has a com.cn TLD.
2022-02-21 11:58:26 -05:00
Syed Mushtaq Ahmed
30ab139ea9 builders: Remove ServerSideEncryption param from presigned URL (PROJQUAY-3180) (#1105)
This parameter causes signature validation errors on the client side.
We don't store encrypted blobs so we don't really need this param.
2022-02-09 16:06:26 -05:00
Kenny Lee Sin Cheong
f6f7b05a06 storage: allow configuration of storage region for cloud storage (PROJQUAY-3082) (#1081)
Boto3 behaves unexpectedly when the resource client is not set to use
the correct region. Boto3 can't seem to correctly set the
X-Amz-Credential header when generating presigned urls if the region
name is not explicitly set, and will always fall back to us-east-1.
To reproduce this:
- Create a bucket in a different region from us-east-1 (e.g
eu-north-1)
- Create a boto3 client/resource without specifying the region
- Generate a presigned url

This seems to be a DNS issue with AWS that only happens shortly after
a bucket has been created, and resolves itself eventually.
Ref:
- https://github.com/boto/boto3/issues/2989
- https://stackoverflow.com/questions/56517156/s3-presigned-url-works-90-minutes-after-bucket-creation

To workaround this, one can specify the bucket endpoint, either
explicitly via endpoint_url, or by setting s3_region, which will be
used to generate the bucket's virtual address.
2022-02-03 14:49:02 -05:00
Brandon Caton
22282dae09 blobuploadcleanupworker: Add cleanup for orphaned blobs (PROJQUAY-2313) (#967)
Currently blobs leftover in the uploads directory during cancelled uploads do not get cleaned up since they are no longer tracked. This change cleans up the uploads storage directory directly.
2021-11-17 15:55:33 -05:00
mosen
fca67e7729 feat: mypy type annotations (PROJQUAY-740) (#455)
* Add dev dependencies mypy and typing

* Add makefile target `types-test`, not yet included in `test` target.

* Generate stubs for imported modules to avoid mypy complaining about missing types.

* Remove generated stubs as there are way too many and they cause tons of mess in the repo. Switched to ignoring untyped modules for now, to concentrate on Quay-only type checking.

* mypy config changed to ignore missing imports

* ignore property decorator as it is not supported by mypy

* mypy annotations for many configuration variables

* re-generate mypy_stubs directory as its necessary in some classes for base classes to prevent mypy errors

* util/registry/queuefile referred to non existent definition of Empty class in multiprocessing.queues

* ignore type checking for things like monkey patching and exported/re-imported objects that 
mypy does not allow.

* Adjust mypy config to warn us about unreachable return paths and useless expressions.

* Add the __annotations__ property to INTERNAL_ONLY_PROPERTIES so that it is not part of the config schema testing

* Remove redundant dependencies `typing` and `typing-extensions` which are NOOP after Python 3.5

* Remove mypy-extensions which only provides a TypedDict implementation but has not been updated since 2019.

* updated mypy to 0.910 which requires all types packages to be installed manually.

* exclude local-dev from type checking until core team can suggest an outcome for __init__.py duplicate packages

* re-add typing dependency which will be needed until Python 3.9

* ignore .mypy_cache

* add mypy stub for features module to replace inline definitions

* import annotations eager evaluation in billing.py as it was required to reference a class declared later in the module.

* remove the type definition of V1ProtocolSteps/V2ProtocolSteps to make tox happy
2021-10-25 09:56:26 +02:00
thomasmckay
fd2746827a storage: fix us-east-2 S3 direct pull (#714)
PROJQUAY-1803
2021-04-06 13:27:47 -04:00
Kenny Lee Sin Cheong
0722e6ee5e format: remove extra comma from s3 connect_kwargs (#709)
The way it was formatted (with the top-level parentheses), the extra
comma was causing the connection parameters to be passed as a 1-tuple
instead of a string.
2021-03-26 11:13:33 -04:00
Kenny Lee Sin Cheong
e0d39fe9f2 storage: abort unfinished mpu when no bytes were written (#705)
Explicitly call abort on a mpu if no bytes were written.
Noobaa and Rados will not clean the artifacts, resulting in empty
files being stuck in an "uploading" state.
2021-03-24 17:43:44 -04:00
Kenny Lee Sin Cheong
8d9fa22c26 deps: Update boto2 to boto3 (#479)
Migrate from using boto2 to boto3. Changes include:
- Removes explicit bucket addressing style: Boto3 will initially try virtual-style addressing first then fallback to path-style addressing (https://github.com/boto/boto3/blob/develop/docs/source/guide/configuration.rst)
- GCS workarounds to use boto3:
  - Handles CORS config
  - Update signed url access key parameter name
  - Uses ListBucket V1 API
- On client-side chunks join, copy using non-multipart api: Use copy_from instead of copy when joining chunks client-side. This is because copy assumes multipart upload should be used which GCS and Rados are not compatible with (S3's version. They have their own parallel upload api)
- Update RDS healthcheck to use boto3
2021-03-18 15:08:02 -04:00
Kenny Lee Sin Cheong
5e80e064c7 Fix Swift assertion for chunked upload (#675)
- Add Werkzeug's LimitedStream + Any binary stream (IOBase) to Swift's type assertion
- Allow LimitingStream from util.registry.filelike to seek backward, since it is required by the Swift client in order to retry operations, if it is configured to do so
- Update use of _pyio to io (io is implemented in C instead of pure Python) in Swift's implementation
2021-02-17 14:07:06 -05:00
Jonathan King
da9968c4b2 PROJQUAY-1391 (#637) 2021-01-05 09:34:19 -05:00
Kurtis Mullins
bd7252c536 [PROJQUAY-1021] task: Update "Black" to version 20.8b1 2020-11-30 18:48:19 -05:00
Kenny Lee Sin Cheong
4865572ba8 Allow existing blobs to be overwritten in azure (#531) 2020-08-24 13:40:54 -04:00
Kenny Lee Sin Cheong
18bf4dcb29 Update azure client to v12 (#524)
- Updates the Azure client to use the recent v12, which provides better
support for large file uploads and access to newer api versions from Azure.
- Increase chunk size when iterating over chunks' streams (for some
reason, read() calls are slower in Python 3 than in Python
2, which caused timeouts on larger layers. Increasing the amount read
from 4096 per iteration is a workaround to get performance similar to
Python 2).
2020-08-19 10:09:48 -04:00
Arunprasad Rajkumar
4672db1df7 fix: Missing storage argument and type error when calling file.write (#514)
* fix: Missing storage argument and type error when calling file.write

* Use binary mode in file ops
2020-08-12 12:04:41 -04:00
Kenny Lee Sin Cheong
6556899b4e Initialize the swift retry count correctly so that it is never None (#508) 2020-08-07 16:08:53 -04:00
Kurtis Mullins
38be6d05d0 Python 3 (#153)
* Convert all Python2 to Python3 syntax.

* Removes oauth2lib dependency

* Replace mockredis with fakeredis

* byte/str conversions

* Removes nonexisting __nonzero__ in Python3

* Python3 Dockerfile and related

* [PROJQUAY-98] Replace resumablehashlib with rehash

* PROJQUAY-123 - replace gpgme with python3-gpg

* [PROJQUAY-135] Fix unhashable class error

* Update external dependencies for Python 3

- Move github.com/app-registry/appr to github.com/quay/appr
- github.com/coderanger/supervisor-stdout
- github.com/DevTable/container-cloud-config
- Update to latest mockldap with changes applied from coreos/mockldap
- Update dependencies in requirements.txt and requirements-dev.txt

* Default FLOAT_REPR function to str in json encoder and removes keyword assignment

True, False, and str were not keywords in Python2...

* [PROJQUAY-165] Replace package `bencode` with `bencode.py`

- Bencode is not compatible with Python 3.x and is no longer
  maintained. Bencode.py appears to be a drop-in replacement/fork
  that is compatible with Python 3.

* Make sure monkey.patch is called before anything else (

* Removes anunidecode dependency and replaces it with text_unidecode

* Base64 encode/decode pickle dumps/loads when storing value in DB

Base64 encodes/decodes the serialized values when storing them in the
DB. Also make sure to return a Python3 string instead of a Bytes when
coercing for db, otherwise, Postgres' TEXT field will convert it into
a hex representation when storing the value.

* Implement __hash__ on Digest class

In Python 3, if a class defines __eq__() but not __hash__(), its
instances will not be usable as items in hashable collections (e.g sets).

* Remove basestring check

* Fix expected message in credentials tests

* Fix usage of Cryptography.Fernet for Python3 (#219)

- Specifically, this addresses the issue where Byte<->String
  conversions weren't being applied correctly.

* Fix utils

- tar+stream layer format utils
- filelike util

* Fix storage tests

* Fix endpoint tests

* Fix workers tests

* Fix docker's empty layer bytes

* Fix registry tests

* Appr

* Enable CI for Python 3.6

* Skip buildman tests

Skip buildman tests while it's being rewritten to allow ci to pass.

* Install swig for CI

* Update expected exception type in redis validation test

* Fix gpg signing calls

Fix gpg calls for updated gpg wrapper, and add signing tests.

* Convert / to // for Python3 integer division

* WIP: Update buildman to use asyncio instead of trollius.

This dependency is considered deprecated/abandoned and was only
used as an implementation/backport of asyncio on Python 2.x
This is a work in progress, and is included in the PR just to get the
rest of the tests passing. The builder is actually being rewritten.

* Target Python 3.8

* Removes unused files

- Removes unused files that were added accidentally while rebasing
- Small fixes/cleanup
- TODO tasks comments

* Add TODO to verify rehash backward compat with resumablehashlib

* Revert "[PROJQUAY-135] Fix unhashable class error" and implements __hash__ instead.

This reverts commit 735e38e3c1d072bf50ea864bc7e119a55d3a8976.
Instead, defines __hash__ for encryped fields class, using the parent
field's implementation.

* Remove some unused files ad imports

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
Co-authored-by: Tom McKay <thomasmckay@redhat.com>
2020-06-05 16:50:13 -04:00
Joseph Schorr
3449acca8c Have Azure copy blob use the destination credentials (#301)
We were incorrectly using the source blob service

Fixes https://issues.redhat.com/browse/PROJQUAY-540
2020-04-17 13:04:34 -04:00
alecmerdler
3dd5f045ff fix all the docstrings 2020-02-05 19:55:07 -08:00
Jimmy Zelinskie
5b3db536ef util/metrics: remove metricqueue abstraction
This change replaces the metricqueue library with a native Prometheus
client implementation with the intention to aggregated results with the
Prometheus PushGateway.

This change also adds instrumentation for greenlet context switches.
2019-12-05 12:05:43 -05:00
Tom McKay
e6ae94db8b 'make black' results 2019-12-02 12:23:08 -05:00
Jimmy Zelinskie
9c0dd3b722 initial import for Open Source 🎉 2019-11-12 11:09:47 -05:00