truecharts / public

Community Helm Chart Repository
https://truecharts.org
GNU Affero General Public License v3.0
1.14k stars 617 forks source link

Error upgrading Home-Assistant - Cluster_cidr is undefined #7742

Closed M07ak closed 1 year ago

M07ak commented 1 year ago

App Name

Home-Assistant

SCALE Version

22.02.3

App Version

2022.12.7_18.0.19

Application Events

https://imgur.com/a/1v2YWIS

Application Logs

Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 411, in run
    await self.future
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 446, in __run_body
    rv = await self.method(*([self] + args))
  File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1272, in nf
    return await func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/schema.py", line 1140, in nf
    res = await f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/upgrade.py", line 116, in upgrade
    await self.upgrade_chart_release(job, release, options)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/upgrade.py", line 299, in upgrade_chart_release
    await self.middleware.call('chart.release.helm_action', release_name, chart_path, config, 'upgrade')
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1345, in call
    return await self._call(
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1305, in _call
    return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1206, in run_in_executor
    return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/chart_releases_linux/helm.py", line 44, in helm_action
    raise CallError(f'Failed to {tn_action} chart release: {stderr.decode()}')
middlewared.service_exception.CallError: [EFAULT] Failed to upgrade chart release: Error: UPGRADE FAILED: template: home-assistant/templates/common.yaml:5:3: executing "home-assistant/templates/common.yaml" at <include "tc.common.loader.apply" .>: error calling include: template: home-assistant/charts/common/templates/loader/_apply.tpl:20:5: executing "tc.common.loader.apply" at <include "tc.common.spawner.configmap" .>: error calling include: template: home-assistant/charts/common/templates/spawner/_configmap.tpl:16:10: executing "tc.common.spawner.configmap" at <include "tc.common.class.configmap" $>: error calling include: template: home-assistant/charts/common/templates/class/_configmap.tpl:33:6: executing "tc.common.class.configmap" at <tpl (toYaml .) $>: error calling tpl: error during tpl function execution for "configuration.yaml.default: |-\n  # Configure a default setup of Home Assistant (frontend, api, etc)\n  default_config:\n\n  # Text to speech\n  tts:\n    - platform: google_translate\n\n  group: !include groups.yaml\n  automation: !include automations.yaml\n  script: !include scripts.yaml\n  scene: !include scenes.yaml\nhttp.default: |2-\n\n  http:\n    use_x_forwarded_for: true\n    trusted_proxies:\n      {{- if hasKey .Values \"ixChartContext\" }}\n      - {{ .Values.ixChartContext.kubernetes_config.cluster_cidr }}\n      {{- else }}\n        {{- range .Values.homeassistant.trusted_proxies }}\n      - {{ . }}\n        {{- end }}\n      {{- end }}\ninit.sh: |-\n  #!/bin/sh\n  if test -f \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml exists.\"\n    if grep -q recorder: \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml already contains recorder\"\n    else\n    cat /config/init/recorder.default >> /config/configuration.yaml\n    fi\n    if grep -q http: \"/config/configuration.yaml\"; then\n    echo \"configuration.yaml already contains http section\"\n    else\n    cat /config/init/http.default >> /config/configuration.yaml\n    fi\n  else\n  echo \"configuration.yaml does NOT exist.\"\n  cp /config/init/configuration.yaml.default /config/configuration.yaml\n  cat /config/init/recorder.default >> /config/configuration.yaml\n  cat /config/init/http.default >> /config/configuration.yaml\n  fi\n\n  echo \"Creating include files...\"\n  for include_file in groups.yaml automations.yaml scripts.yaml scenes.yaml; do\n    if test -f \"/config/$include_file\"; then\n    echo \"$include_file exists.\"\n    else\n    echo \"$include_file does NOT exist.\"\n    touch \"/config/$include_file\"\n    fi\n  done\n\n  cd \"/config\" || echo \"Could not change path to /config\"\n  echo \"Creating custom_components directory...\"\n  mkdir \"/config/custom_components\" || echo \"custom_components directory already exists\"\n\n  echo \"Changing to the custom_components directory...\"\n  cd \"/config/custom_components\" || echo \"Could not change path to /config/custom_components\"\n\n  echo \"Downloading HACS\"\n  wget \"https://github.com/hacs/integration/releases/latest/download/hacs.zip\" || exit 0\n\n  if [ -d \"/config/custom_components/hacs\" ]; then\n      echo \"HACS directory already exist, cleaning up...\"\n      rm -R \"/config/custom_components/hacs\"\n  fi\n\n  echo \"Creating HACS directory...\"\n  mkdir \"/config/custom_components/hacs\"\n\n  echo \"Unpacking HACS...\"\n  unzip \"/config/custom_components/hacs.zip\" -d \"/config/custom_components/hacs\" >/dev/null 2>&1\n\n  echo \"Removing HACS zip file...\"\n  rm \"/config/custom_components/hacs.zip\"\n  echo \"Installation complete.\"\nrecorder.default: |2-\n\n  recorder:\n    purge_keep_days: 30\n    commit_interval: 3\n    db_url: {{ ( printf \"%s?client_encoding=utf8\" ( .Values.postgresql.url.complete | trimAll \"\\\"\" ) ) | quote }}": template: home-assistant/templates/common.yaml:19:18: executing "home-assistant/templates/common.yaml" at <.Values.ixChartContext.kubernetes_config.cluster_cidr>: nil pointer evaluating interface {}.cluster_cidr

Application Configuration

Truenas: TrueNAS-SCALE-22.02.4 Home-assistant app: 2022.12.7_18.0.19

Describe the bug

Error upgrading Home-assistant 18.0.19 to 18.0.20 or higher, because of cluster_cidr missing.

In the ix_values.yaml file, line 144, the if condition check for "ixChartContext", and use cluster_cidr if true. In my case ".Values.ixChartContext.kubernetes_config.cluster_cidr" is nill and the upgrade process crash.

To Reproduce

Without cluster_cidr value defined, the upgrade process is impossible, if the ixChartContext is defined.

Expected Behavior

Check the value of value of Values.ixChartContext.kubernetes_config.cluster_cidr, and fallback to trusted_proxies if not.

Screenshots

No screenshots required

Additional Context

All the context was given

I've read and agree with the following

StevenMcElligott commented 1 year ago

WE don't support installs on TrueNAS SCALE version 22.02.4 anymore, please update to 22.12 or later to file bug reports

truecharts-admin commented 1 year ago

This issue is locked to prevent necro-posting on closed issues. Please create a new issue or contact staff on discord of the problem persists