Add support in UI for custom S3 endpoints for backups (#1152)
* Support custom S3 endpoint for backups * Log info about AWS S3 endpoint during start up
This commit is contained in:
parent
d658b9672e
commit
e10e0fec9e
|
|
@ -104,6 +104,8 @@ USE_AWS_INSTANCE_PROFILE = (
|
||||||
getenv('USE_AWS_INSTANCE_PROFILE', 'false').lower() != 'false'
|
getenv('USE_AWS_INSTANCE_PROFILE', 'false').lower() != 'false'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
AWS_ENDPOINT = getenv('AWS_ENDPOINT')
|
||||||
|
|
||||||
tokens.configure()
|
tokens.configure()
|
||||||
tokens.manage('read-only')
|
tokens.manage('read-only')
|
||||||
tokens.start()
|
tokens.start()
|
||||||
|
|
@ -1055,6 +1057,7 @@ def main(port, secret_key, debug, clusters: list):
|
||||||
logger.info(f'Tokeninfo URL: {TOKENINFO_URL}')
|
logger.info(f'Tokeninfo URL: {TOKENINFO_URL}')
|
||||||
logger.info(f'Use AWS instance_profile: {USE_AWS_INSTANCE_PROFILE}')
|
logger.info(f'Use AWS instance_profile: {USE_AWS_INSTANCE_PROFILE}')
|
||||||
logger.info(f'WAL-E S3 endpoint: {WALE_S3_ENDPOINT}')
|
logger.info(f'WAL-E S3 endpoint: {WALE_S3_ENDPOINT}')
|
||||||
|
logger.info(f'AWS S3 endpoint: {AWS_ENDPOINT}')
|
||||||
|
|
||||||
if TARGET_NAMESPACE is None:
|
if TARGET_NAMESPACE is None:
|
||||||
@on_exception(
|
@on_exception(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ logger = getLogger(__name__)
|
||||||
|
|
||||||
session = Session()
|
session = Session()
|
||||||
|
|
||||||
|
AWS_ENDPOINT = getenv('AWS_ENDPOINT')
|
||||||
|
|
||||||
OPERATOR_CLUSTER_NAME_LABEL = getenv('OPERATOR_CLUSTER_NAME_LABEL', 'cluster-name')
|
OPERATOR_CLUSTER_NAME_LABEL = getenv('OPERATOR_CLUSTER_NAME_LABEL', 'cluster-name')
|
||||||
|
|
||||||
COMMON_CLUSTER_LABEL = getenv('COMMON_CLUSTER_LABEL', '{"application":"spilo"}')
|
COMMON_CLUSTER_LABEL = getenv('COMMON_CLUSTER_LABEL', '{"application":"spilo"}')
|
||||||
|
|
@ -266,7 +268,7 @@ def read_stored_clusters(bucket, prefix, delimiter='/'):
|
||||||
return [
|
return [
|
||||||
prefix['Prefix'].split('/')[-2]
|
prefix['Prefix'].split('/')[-2]
|
||||||
for prefix in these(
|
for prefix in these(
|
||||||
client('s3').list_objects(
|
client('s3', endpoint_url=AWS_ENDPOINT).list_objects(
|
||||||
Bucket=bucket,
|
Bucket=bucket,
|
||||||
Delimiter=delimiter,
|
Delimiter=delimiter,
|
||||||
Prefix=prefix,
|
Prefix=prefix,
|
||||||
|
|
@ -287,7 +289,7 @@ def read_versions(
|
||||||
return [
|
return [
|
||||||
'base' if uid == 'wal' else uid
|
'base' if uid == 'wal' else uid
|
||||||
for prefix in these(
|
for prefix in these(
|
||||||
client('s3').list_objects(
|
client('s3', endpoint_url=AWS_ENDPOINT).list_objects(
|
||||||
Bucket=bucket,
|
Bucket=bucket,
|
||||||
Delimiter=delimiter,
|
Delimiter=delimiter,
|
||||||
Prefix=prefix + pg_cluster + delimiter,
|
Prefix=prefix + pg_cluster + delimiter,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue