canonical / landscape-client-charm

Apache License 2.0
1 stars 3 forks source link

Landscape client cannot connect to the landscape behind proxy #12

Open Barteus opened 11 months ago

Barteus commented 11 months ago

I deploy landscape on top of MAAS. The environment is behind proxy and I cannot access local resources when using proxy (this behaviour cannot be changed)

Versions MAAS - 3.4/candidate landscape - latest/stable juju - 3.1.6

JUJU model config is:

default-space: oam-space
      default-series: jammy
      apt-http-proxy: ""
      apt-https-proxy: ""
      juju-http-proxy: ""
      juju-https-proxy: ""
      snap-http-proxy: ""
      snap-https-proxy: ""
      http-proxy: http://proxy
      https-proxy: http://proxy
      no-proxy: <huge list of IPs including the landscape server>

I used bundle to deploy (the grafana issue is expected, but landscape-client issue is not expected):

series: jammy
machines:
  '0': {constraints:  "tags=landscapeha"}
  '1': {constraints:  "tags=landscape"}
  '2': {constraints:  "tags=landscape"}
  '3': {constraints:  "tags=landscape"}
  '4': {constraints:  "tags=landscapeamqp"}
  '5': {constraints:  "tags=landscapeamqp"}
  '6': {constraints:  "tags=landscapeamqp"}
  '7': {constraints:  "tags=landscapesql"}
  '8': {constraints:  "tags=landscapesql"}
  '9': {constraints:  "tags=landscapesql"}
applications:
  haproxy:
    charm: ch:haproxy
    channel: latest/edge
    num_units: 1
    options:
      default_timeouts: queue 60000, connect 5000, client 120000, server 120000
      global_default_bind_options: no-tlsv10
      services: ""
      ssl_cert: include-base64://../tls/landscape/landscape.crt
      ssl_key: include-base64://../tls/landscape/landscape.key
    to:
    - '0'

  landscape-server:
    charm: ch:landscape-server
    channel: latest/stable
    options:
      admin_email: admin@localhost.localdomain
      admin_name: admin
      admin_password: include-file://../secrets/landscape-password.txt
      registration_key: include-file://../secrets/landscape-key.txt
      landscape_ppa: "ppa:landscape/self-hosted-23.03"
      license_file: include-base64://../secrets/landscape-license.txt
    num_units: 3
    to:
    - '1'
    - '2'
    - '3'

  rabbitmq-server:
    charm: ch:rabbitmq-server
    channel: 3.9/stable
    num_units: 3
    options:
      min-cluster-size: 3
    to:
    - '4'
    - '5'
    - '6'

  postgresql:
    charm: ch:postgresql
    channel: 14/stable
    num_units: 3
    to:
    - '7'
    - '8'
    - '9'

  grafana-agent:
    charm: grafana-agent
    channel: latest/edge
  landscape-client:
    charm: landscape-client
    options:
      account-name: standalone
      computer-title: landscape
      registration-key: include-file://../secrets/landscape-key.txt
      ping-url: http://landscapeha-1.local/ping
      url: https://landscapeha-1.local/message-system
      # echo -n "base64:" && cat tls/landscape/landscape.crt | openssl base64 -e
      http-proxy: ""
      https-proxy: ""
      ssl-public-key: |
        base64:REDACTED
  logrotated:
    charm: logrotated
    options:
      logrotate-retention: 60
  ntp:
    charm: ntp
    options:
      source: "<source IP>"
      verify_ntp_servers: true

#saas:
#  cos-loki:
#    url: foundations-maas:admin/cos.loki
#  cos-prometheus:
#    url: foundations-maas:admin/cos.prometheus

relations:
  - ["landscape-server", "rabbitmq-server"]
  - ["landscape-server", "haproxy"]
  - ["landscape-server:db", "postgresql:db-admin"]
#  - ["grafana-agent:logging-consumer", "cos-loki:logging"]
#  - ["grafana-agent:send-remote-write", "cos-prometheus:receive-remote-write"]
  - ["grafana-agent:juju-info", "landscape-server:juju-info"]
  - ["logrotated:juju-info", "landscape-server:juju-info"]
  - ["ntp:juju-info", "landscape-server:juju-info"]
  - ["landscape-client", "landscape-server"]

The result for the landscape-client is "Registration failed!".

unit-landscape-client-0: 14:21:15 CRITICAL unit.landscape-client/0.juju-log 
We were unable to contact the server.
Your internet connection may be down. The landscape client will continue to try and contact the server periodically.

When I change the landscape-client configuration file by removing the HTTP and HTTPS proxy settings, restart the service and it works correctly. Unfortunately, charms override this configuration on every check, and I get Registration failed again.

I need a way to use charms and juju to deploy the bundle and have the landscape clients register properly in "proxy" environment.

silverdrake11 commented 9 months ago

It seems like juju is not changing the config file because the setting is blank and it thinks there's no value there. I would suggest both steps in this order until this bug is fixed:

1) Change the juju config in landscape client to remove the proxy settings 2) Change the file manually

Since the juju proxy config is zeroed out, there will be nothing for the charm override in landscape client.

silverdrake11 commented 9 months ago

Actually here's a better solution use " " instead of "". It'll force juju to ovewrite the landscape config since " " evaluates to True. In order to actually fix this bug, we need to differentiate between "keep defaults" (don't override anything) and yes override with "". So I think that checking if None vs. "" will suffice for the actual bugfix, but for right now as a workaround use " "

Barteus commented 8 months ago

I have computers registered in Landscape, but the juju status of landscape clients is still broken.

Do we have an estimated time when this bug will be fixed?