Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale up operation should not crash the charm #24

Closed
gatici opened this issue Aug 17, 2023 · 0 comments · Fixed by canonical/tls-certificates-interface#70 or #31
Closed

Scale up operation should not crash the charm #24

gatici opened this issue Aug 17, 2023 · 0 comments · Fixed by canonical/tls-certificates-interface#70 or #31

Comments

@gatici
Copy link
Contributor

gatici commented Aug 17, 2023

Hello,

If we scale up self-signed-certificates operator, charm crashes with error "ops.model.ModelError: ERROR permission denied".
Although scaling operation is not implemented yet (needs to be implemented), this charm shouldn't crash when we try to do so. Non-leader unit should simply do nothing.
This problem needs to be fixed.

gatici@gaticipc:~/.ssh$ juju status
Model  Controller          Cloud/Region        Version  SLA          Timestamp
core   microk8s-localhost  microk8s/localhost  3.1.5    unsupported  01:25:01+03:00

SAAS        Status  Store               URL
loki        active  microk8s-localhost  admin/cos.loki
prometheus  active  microk8s-localhost  admin/cos.prometheus

App                       Version  Status   Scale  Charm                     Channel        Rev  Address         Exposed  Message
amf                                active       1  sdcore-amf                edge            21  10.152.183.39   no       
ausf                               active       1  sdcore-ausf               edge            14  10.152.183.202  no       
gnbsim                             active       1  sdcore-gnbsim             edge            17  10.152.183.159  no       
grafana-agent-k8s         0.32.1   active       1  grafana-agent-k8s         latest/stable   38  10.152.183.253  no       
mongodb-k8s                        active       1  mongodb-k8s               5/edge          35  10.152.183.250  no       
nrf                                active       1  sdcore-nrf                edge            31  10.152.183.201  no       
nssf                               active       1  sdcore-nssf               edge            16  10.152.183.19   no       
pcf                                active       1  sdcore-pcf                edge             7  10.152.183.119  no       
router                             active       1  sdcore-router             edge            11  10.152.183.207  no       
self-signed-certificates           waiting      3  self-signed-certificates  edge            17  10.152.183.40   no       installing agent
smf                                active       1  sdcore-smf                edge            17  10.152.183.22   no       
udm                                active       1  sdcore-udm                edge            13  10.152.183.158  no       
udr                                active       1  sdcore-udr                edge            15  10.152.183.71   no       
upf                                active       1  sdcore-upf                                 0  10.152.183.109  no       
webui                              active       1  sdcore-webui              edge             8  10.152.183.197  no       

Unit                         Workload  Agent  Address      Ports  Message
amf/0*                       active    idle   10.1.146.13         
ausf/0*                      active    idle   10.1.146.62         
gnbsim/0*                    active    idle   10.1.146.10         
grafana-agent-k8s/0*         active    idle   10.1.146.54         
mongodb-k8s/0*               active    idle   10.1.146.61         
nrf/0*                       active    idle   10.1.146.45         
nssf/0*                      active    idle   10.1.146.26         
pcf/0*                       active    idle   10.1.146.42         
router/0*                    active    idle   10.1.146.5          
self-signed-certificates/0*  active    idle   10.1.146.12         
self-signed-certificates/1   error     idle   10.1.146.57         hook failed: "certificates-relation-changed"
self-signed-certificates/2   error     idle   10.1.146.32         hook failed: "certificates-relation-changed"
smf/0*                       active    idle   10.1.146.46         
udm/0*                       active    idle   10.1.146.19         
udr/0*                       active    idle   10.1.146.38         
upf/0*                       active    idle   10.1.146.2          
webui/0*                     active    idle   10.1.146.3  

Juju debug log output:

unit-self-signed-certificates-1: 01:21:06 INFO juju.worker.uniter.operation ran "certificates-relation-created" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:06 INFO juju.worker.uniter.operation ran "certificates-relation-created" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-0: 01:21:07 INFO unit.self-signed-certificates/0.juju-log certificates:6: Generated certificate for relation 6
unit-self-signed-certificates-1: 01:21:07 INFO juju.worker.uniter.operation ran "leader-settings-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-0: 01:21:07 INFO juju.worker.uniter.operation ran "certificates-relation-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:07 INFO juju.worker.uniter.operation ran "leader-settings-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:08 INFO juju.worker.uniter.operation ran "config-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:08 INFO juju.worker.uniter found queued "start" hook
unit-self-signed-certificates-0: 01:21:08 INFO juju.worker.uniter.operation ran "secret-remove" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:08 INFO juju.worker.uniter.operation ran "config-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:08 INFO juju.worker.uniter found queued "start" hook
unit-self-signed-certificates-1: 01:21:08 INFO unit.self-signed-certificates/1.juju-log Running legacy hooks/start.
unit-self-signed-certificates-2: 01:21:08 INFO unit.self-signed-certificates/2.juju-log Running legacy hooks/start.
unit-ausf-0: 01:21:08 INFO juju.worker.uniter.operation ran "certificates-relation-changed" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:08 INFO juju.worker.uniter.operation ran "start" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:09 INFO juju.worker.uniter.operation ran "start" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:09 INFO juju.worker.uniter.operation ran "certificates-relation-joined" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:09 INFO juju.worker.uniter.operation ran "certificates-relation-joined" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:10 INFO juju.worker.uniter.operation ran "certificates-relation-joined" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:10 INFO juju.worker.uniter.operation ran "certificates-relation-joined" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-1: 01:21:10 INFO juju.worker.uniter.operation ran "certificates-relation-joined" hook (via hook dispatching script: dispatch)
unit-self-signed-certificates-2: 01:21:10 ERROR unit.self-signed-certificates/2.juju-log certificates:17: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 2723, in _run
    result = subprocess.run(args, **kwargs)  # type: ignore
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('/var/lib/juju/tools/unit-self-signed-certificates-2/relation-get', '-r', '17', '-', 'self-signed-certificates', '--app', '--format=json')' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/./src/charm.py", line 221, in <module>
    main(SelfSignedCertificatesCharm)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/main.py", line 441, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/main.py", line 149, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/framework.py", line 344, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/framework.py", line 841, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/framework.py", line 930, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/lib/charms/tls_certificates_interface/v2/tls_certificates.py", line 1106, in _on_relation_changed
    provider_relation_data = _load_relation_data(event.relation.data[self.charm.app])
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/lib/charms/tls_certificates_interface/v2/tls_certificates.py", line 604, in _load_relation_data
    for key in raw_relation_data:
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 679, in __iter__
    return iter(self._data)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 666, in _data
    data = self._lazy_data = self._load()
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 1397, in _load
    return self._backend.relation_get(self.relation.id, self._entity.name, self._is_app)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 2804, in relation_get
    raw_data_content = self._run(*args, return_output=True, use_json=True)
  File "/var/lib/juju/agents/unit-self-signed-certificates-2/charm/venv/ops/model.py", line 2725, in _run
    raise ModelError(e.stderr)
ops.model.ModelError: ERROR permission denied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant