canonical / s3-integrator

An integrator charm for handling s3 credentials
https://charmhub.io/s3-integrator
Apache License 2.0
1 stars 1 forks source link

Error in debug-log: Invalid type for parameter CreateBucketConfiguration.LocationConstraint, value: None, type: <class 'NoneType'>, valid types: <class 'str'> #37

Closed taurus-forever closed 1 month ago

taurus-forever commented 1 month ago

Steps to reproduce

I cannot isolate STRs at the moment, reporting here a placeholder.

TL;DR: deploy COS + deploy test bundle and relate all bits: juju deploy bundle # https://pastebin.canonical.com/p/sM4yXG4RPH/

Expected behavior

No errors in juju debug-log

Actual behavior

Error in debug-log:

unit-cos-pgb-int-1: 22:26:49 DEBUG unit.cos-pgb-int/1.juju-log cos-agent:22: Reading alert rule from src/prometheus_alert_rules/memory.rules                                                                                                                                                                                                                                                                                 
unit-pg-0: 22:26:49 DEBUG unit.pg/0.juju-log s3-parameters:18: Selecting from endpoint provider's list of auth schemes: "sigv4". User selected auth scheme is: "None"                                                                                                                                                                                                                                                        
unit-pg-0: 22:26:49 DEBUG unit.pg/0.juju-log s3-parameters:18: Selected auth type "v4" as "v4" with signing context params: {'region': 'us-east-1', 'signing_name': 's3', 'disableDoubleEncoding': True}                                                                                                                                                                                                                     
unit-pg-0: 22:26:49 ERROR unit.pg/0.juju-log s3-parameters:18: Uncaught exception while in charm code:                                                                                                                                                                                                                                                                                                                       
Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                                                                           
  File "/var/lib/juju/agents/unit-pg-0/charm/./src/charm.py", line 1497, in <module>                                                                                                                                                                                                                                                                                                                                         
    main(PostgresqlOperatorCharm)                                                                                                                                                                                                                                                                                                                                                                                            
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/main.py", line 436, in main                                                                                                                                                                                                                                                                                                                                            
    _emit_charm_event(charm, dispatcher.event_name)                                                                                                                                                                                                                                                                                                                                                                          
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/main.py", line 144, in _emit_charm_event                                                                                                                                                                                                                                                                                                                               
    event_to_emit.emit(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                                                                      
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 351, in emit                                                                                                                                                                                                                                                                                                                                       
    framework._emit(event)                                                                                                                                                                                                                                                                                                                                                                                                   
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 853, in _emit                                                                                                                                                                                                                                                                                                                                      
    self._reemit(event_path)                                                                                                                                                                                                                                                                                                                                                                                                 
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 942, in _reemit                                                                                                                                                                                                                                                                                                                                    
    custom_handler(event)                                                                                                                                                                                                                                                                                                                                                                                                    
  File "/var/lib/juju/agents/unit-pg-0/charm/lib/charms/data_platform_libs/v0/s3.py", line 745, in _on_relation_changed                                                                                                                                                                                                                                                                                                      
    getattr(self.on, "credentials_changed").emit(                                                                                                                                                                                                                                                                                                                                                                            
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 351, in emit                                                                                                                                                                                                                                                                                                                                       
    framework._emit(event)                                                                                                                                                                                                                                                                                                                                                                                                   
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 853, in _emit                                                                                                                                                                                                                                                                                                                                      
    self._reemit(event_path)                                                                                                                                                                                                                                                                                                                                                                                                 
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/ops/framework.py", line 942, in _reemit                                                                                                                                                                                                                                                                                                                                    
    custom_handler(event)                                                                                                                                                                                                                                                                                                                                                                                                    
  File "/var/lib/juju/agents/unit-pg-0/charm/src/backups.py", line 477, in _on_s3_credential_changed                                                                                                                                                                                                                                                                                                                         
    self._create_bucket_if_not_exists()                                                                                                                                                                                                                                                                                                                                                                                      
  File "/var/lib/juju/agents/unit-pg-0/charm/src/backups.py", line 239, in _create_bucket_if_not_exists                                                                                                                                                                                                                                                                                                                      
    bucket.create(CreateBucketConfiguration={"LocationConstraint": region})                                                                                                                                                                                                                                                                                                                                                  
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/boto3/resources/factory.py", line 581, in do_action                                                                                                                                                                                                                                                                                                                        
    response = action(self, *args, **kwargs)                                                                                                                                                                                                                                                                                                                                                                                 
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/boto3/resources/action.py", line 88, in __call__                                                                                                                                                                                                                                                                                                                           
    response = getattr(parent.meta.client, operation_name)(*args, **params)                                                                                                                                                                                                                                                                                                                                                  
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/botocore/client.py", line 553, in _api_call                                                                                                                                                                                                                                                                                                                                
    return self._make_api_call(operation_name, kwargs)                                                                                                                                                                                                                                                                                                                                                                       
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/botocore/client.py", line 962, in _make_api_call                                                                                                                                                                                                                                                                                                                           
    request_dict = self._convert_to_request_dict(                                                                                                                                                                                                                                                                                                                                                                            
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/botocore/client.py", line 1036, in _convert_to_request_dict                                                                                                                                                                                                                                                                                                                
    request_dict = self._serializer.serialize_to_request(                                                                                                                                                                                                                                                                                                                                                                    
  File "/var/lib/juju/agents/unit-pg-0/charm/venv/botocore/validate.py", line 381, in serialize_to_request                                                                                                                                                                                                                                                                                                                   
    raise ParamValidationError(report=report.generate_report())                                                                                                                                                                                                                                                                                                                                                              
botocore.exceptions.ParamValidationError: Parameter validation failed:                                                                                                                                                                                                                                                                                                                                                       
Invalid type for parameter CreateBucketConfiguration.LocationConstraint, value: None, type: <class 'NoneType'>, valid types: <class 'str'>            

Versions

Operating system: Ubuntu 22.03 Juju CLI: 3.4.2 Juju agent: 3.4.2 Charm revision:

App          Version  Status  Scale  Charm                     Channel        Rev  Exposed  Message
app-ext               active      3  data-integrator           latest/stable   26  no       
app-int               active      2  postgresql-test-app       latest/stable  119  no       received database credentials of the first database
cos-pg                active      3  grafana-agent             latest/edge    150  no       
cos-pgb-ext           active      3  grafana-agent             latest/edge    150  no       
cos-pgb-int           active      2  grafana-agent             latest/edge    150  no       
pg           14.10    active      3  postgresql                14/stable      363  no       
pgb-ext      1.21.0   active      3  pgbouncer                 1/stable       174  no       
pgb-int      1.21.0   active      2  pgbouncer                 1/stable       174  no       
s3                    active      1  s3-integrator             latest/stable   17  no       
tls                   active      1  self-signed-certificates  latest/stable   72  no       
ubuntu-pro            active      3  ubuntu-advantage          latest/stable   79  no       Attached (esm-apps,esm-infra)

Log output

Juju debug log: see above.

Additional context

buntu@juju342:~$ juju status --relations
Model           Controller  Cloud/Region         Version  SLA          Timestamp
test1716838756  lxd342      localhost/localhost  3.4.2    unsupported  22:31:20+02:00

SAAS        Status  Store  URL
grafana     active  mk8s2  admin/cos.grafana
loki        active  mk8s2  admin/cos.loki
prometheus  active  mk8s2  admin/cos.prometheus

App          Version  Status  Scale  Charm                     Channel        Rev  Exposed  Message
app-ext               active      3  data-integrator           latest/stable   26  no       
app-int               active      2  postgresql-test-app       latest/stable  119  no       received database credentials of the first database
cos-pg                active      3  grafana-agent             latest/edge    150  no       
cos-pgb-ext           active      3  grafana-agent             latest/edge    150  no       
cos-pgb-int           active      2  grafana-agent             latest/edge    150  no       
pg           14.10    active      3  postgresql                14/stable      363  no       
pgb-ext      1.21.0   active      3  pgbouncer                 1/stable       174  no       
pgb-int      1.21.0   active      2  pgbouncer                 1/stable       174  no       
s3                    active      1  s3-integrator             latest/stable   17  no       
tls                   active      1  self-signed-certificates  latest/stable   72  no       
ubuntu-pro            active      3  ubuntu-advantage          latest/stable   79  no       Attached (esm-apps,esm-infra)

Unit              Workload  Agent  Machine  Public address  Ports     Message
app-ext/0         active    idle   4        10.239.209.148            
  cos-pgb-ext/2   active    idle            10.239.209.148            
  pgb-ext/2       active    idle            10.239.209.148            
app-ext/1         active    idle   5        10.239.209.70             
  cos-pgb-ext/1   active    idle            10.239.209.70             
  pgb-ext/1       active    idle            10.239.209.70             
app-ext/2*        active    idle   6        10.239.209.123            
  cos-pgb-ext/0*  active    idle            10.239.209.123            
  pgb-ext/0*      active    idle            10.239.209.123  6432/tcp  
app-int/0*        active    idle   3        10.239.209.171            received database credentials of the first database
  cos-pgb-int/0*  active    idle            10.239.209.171            
  pgb-int/0*      active    idle            10.239.209.171            
app-int/1         active    idle   7        10.239.209.134            received database credentials of the first database
  cos-pgb-int/1   active    idle            10.239.209.134            
  pgb-int/1       active    idle            10.239.209.134            
pg/0*             error     idle   0        10.239.209.89   5432/tcp  hook failed: "s3-parameters-relation-changed" for s3:s3-credentials
  cos-pg/1        active    idle            10.239.209.89             
  ubuntu-pro/1    active    idle            10.239.209.89             Attached (esm-apps,esm-infra)
pg/1              waiting   idle   1        10.239.209.180  5432/tcp  awaiting for cluster to start
  cos-pg/0*       active    idle            10.239.209.180            
  ubuntu-pro/0*   active    idle            10.239.209.180            Attached (esm-apps,esm-infra)
pg/2              waiting   idle   2        10.239.209.154  5432/tcp  awaiting for cluster to start
  cos-pg/2        active    idle            10.239.209.154            
  ubuntu-pro/2    active    idle            10.239.209.154            Attached (esm-apps,esm-infra)
s3/0*             active    idle   3        10.239.209.171            
tls/0*            active    idle   3        10.239.209.171            

Machine  State    Address         Inst id        Base          AZ  Message
0        started  10.239.209.89   juju-9bc6a9-0  ubuntu@22.04      Running
1        started  10.239.209.180  juju-9bc6a9-1  ubuntu@22.04      Running
2        started  10.239.209.154  juju-9bc6a9-2  ubuntu@22.04      Running
3        started  10.239.209.171  juju-9bc6a9-3  ubuntu@22.04      Running
4        started  10.239.209.148  juju-9bc6a9-4  ubuntu@22.04      Running
5        started  10.239.209.70   juju-9bc6a9-5  ubuntu@22.04      Running
6        started  10.239.209.123  juju-9bc6a9-6  ubuntu@22.04      Running
7        started  10.239.209.134  juju-9bc6a9-7  ubuntu@22.04      Running

Integration provider                     Requirer                       Interface                Type         Message
app-ext:data-integrator-peers            app-ext:data-integrator-peers  data-integrator-peers    peer         
app-ext:juju-info                        cos-pgb-ext:juju-info          juju-info                subordinate  
app-int:juju-info                        cos-pgb-int:juju-info          juju-info                subordinate  
app-int:postgresql-test-peers            app-int:postgresql-test-peers  postgresql-test-peers    peer         
cos-pg:grafana-dashboards-provider       grafana:grafana-dashboard      grafana_dashboard        regular      
cos-pg:peers                             cos-pg:peers                   grafana_agent_replica    peer         
cos-pgb-ext:grafana-dashboards-provider  grafana:grafana-dashboard      grafana_dashboard        regular      
cos-pgb-ext:peers                        cos-pgb-ext:peers              grafana_agent_replica    peer         
cos-pgb-int:grafana-dashboards-provider  grafana:grafana-dashboard      grafana_dashboard        regular      
cos-pgb-int:peers                        cos-pgb-int:peers              grafana_agent_replica    peer         
loki:logging                             cos-pg:logging-consumer        loki_push_api            regular      
loki:logging                             cos-pgb-ext:logging-consumer   loki_push_api            regular      
loki:logging                             cos-pgb-int:logging-consumer   loki_push_api            regular      
pg:cos-agent                             cos-pg:cos-agent               cos_agent                subordinate  
pg:database                              pgb-ext:backend-database       postgresql_client        regular      
pg:database                              pgb-int:backend-database       postgresql_client        regular      
pg:database-peers                        pg:database-peers              postgresql_peers         peer         
pg:juju-info                             ubuntu-pro:juju-info           juju-info                subordinate  
pg:restart                               pg:restart                     rolling_op               peer         
pg:upgrade                               pg:upgrade                     upgrade                  peer         
pgb-ext:cos-agent                        cos-pgb-ext:cos-agent          cos_agent                subordinate  
pgb-ext:database                         app-ext:postgresql             postgresql_client        subordinate  
pgb-ext:pgb-peers                        pgb-ext:pgb-peers              pgb_peers                peer         
pgb-ext:upgrade                          pgb-ext:upgrade                upgrade                  peer         
pgb-int:cos-agent                        cos-pgb-int:cos-agent          cos_agent                subordinate  
pgb-int:database                         app-int:first-database         postgresql_client        subordinate  
pgb-int:pgb-peers                        pgb-int:pgb-peers              pgb_peers                peer         
pgb-int:upgrade                          pgb-int:upgrade                upgrade                  peer         
prometheus:receive-remote-write          cos-pg:send-remote-write       prometheus_remote_write  regular      
prometheus:receive-remote-write          cos-pgb-ext:send-remote-write  prometheus_remote_write  regular      
prometheus:receive-remote-write          cos-pgb-int:send-remote-write  prometheus_remote_write  regular      
s3:s3-credentials                        pg:s3-parameters               s3                       regular      
s3:s3-integrator-peers                   s3:s3-integrator-peers         s3-integrator-peers      peer         
tls:certificates                         pg:certificates                tls-certificates         regular      
tls:certificates                         pgb-ext:certificates           tls-certificates         regular      
tls:certificates                         pgb-int:certificates           tls-certificates         regular      
ubuntu@juju342:~$ 
github-actions[bot] commented 1 month ago

https://warthogs.atlassian.net/browse/DPE-4444

taurus-forever commented 1 month ago

@marceloneppel should this be moved to postgresql vm charm?

marceloneppel commented 1 month ago

@marceloneppel should this be moved to postgresql vm charm?

I think so. I also think the issue happens when the region field is not specified.

taurus-forever commented 1 month ago

Moved to https://github.com/canonical/postgresql-operator/issues/477