zalando / spilo

Highly available elephant herd: HA PostgreSQL cluster using Docker
Apache License 2.0
1.51k stars 371 forks source link

S3 upload logs script doesn't support IRSA #994

Open v-novytskyi opened 2 months ago

v-novytskyi commented 2 months ago

boto library does not support IRSA authentication, logs are not loaded into the bucket:

Traceback (most recent call last):
  File "/scripts/upload_pg_log_to_s3.py", line 111, in <module>
    main()
  File "/scripts/upload_pg_log_to_s3.py", line 102, in main
    if upload_to_s3(compressed_log):
  File "/scripts/upload_pg_log_to_s3.py", line 43, in upload_to_s3
    conn = boto.connect_s3(host=os.getenv('LOG_AWS_HOST'))
  File "/usr/lib/python3/dist-packages/boto/__init__.py", line 141, in connect_s3
    return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
  File "/usr/lib/python3/dist-packages/boto/s3/connection.py", line 188, in __init__
    super(S3Connection, self).__init__(host,
  File "/usr/lib/python3/dist-packages/boto/connection.py", line 568, in __init__
    self._auth_handler = auth.get_auth_handler(
  File "/usr/lib/python3/dist-packages/boto/auth.py", line 1018, in get_auth_handler
    raise boto.exception.NoAuthHandlerFound(
boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials

After upgrade script for using boto3 library script started to work. Can you update the script for using the boto3?

v-novytskyi commented 2 months ago

Okay, after deploying last version with boto3 script works but only manually. It not upload log automatically