Repository navigation
Closed
Labels
kind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bug
Description
Describe the bug
monitor-agents failed to install after upgraded to v1.0.0-rc.1.
HelmRelease event decoded:
Warning InstallFailed 5s (x6 over 53s) helm-controller Helm install failed for release cozy-monitoring/monitoring-agents with chart [email protected]+1b5894e823dc: template: cozy-monitoring-agents/charts/fluent-bit/templates/daemonset.yaml:37:28: executing "cozy-monitoring-agents/charts/fluent-bit/templates/daemonset.yaml" at <include (print $.Template.BasePath "/configmap.yaml")>: error calling include: template: cozy-monitoring-agents/charts/fluent-bit/templates/configmap.yaml:16:9: executing "cozy-monitoring-agents/charts/fluent-bit/templates/configmap.yaml" at <tpl .Values.config.outputs .>: error calling tpl: error during tpl function execution for "[OUTPUT]
Name http
Match kube.*
Host vlogs-generic.{{ .Values.global.target }}.svc.{{ (index .Values._cluster \"cluster-domain\") | default \"cluster.local\" }}
Port 9428
compress gzip
uri /insert/jsonline?_stream_fields=log_source,stream,kubernetes_pod_name,kubernetes_container_name,kubernetes_namespace_name&msg_field=log&time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
[OUTPUT]
Name http
Match events.*
Host vlogs-generic.{{ .Values.global.target }}.svc.{{ (index .Values._cluster \"cluster-domain\") | default \"cluster.local\" }}
Port 9428
compress gzip
uri /insert/jsonline?_stream_fields=log_source,reason,metadata_namespace,metadata_name&msg_field=message&time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
[OUTPUT]
Name http
Match audit.*
Host vlogs-generic.{{ .Values.global.target }}.svc.{{ (index .Values._cluster \"cluster-domain\") | default \"cluster.local\" }}
Port 9428
compress gzip
uri /insert/jsonline?_stream_fields=log_source,stage,user_username,verb,requestUri&msg_field=requestURI&time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
": template: gotpl:4:59: executing "gotpl" at <index .Values._cluster "cluster-domain">: error calling index: index of untyped nil
Environment
- Cozystack version: v1.0.0-rc.1
- Provider: k3s v1.34.3+k3s3
To Reproduce
Steps to reproduce the behavior:
- Running cozystack v1.0.0-beta.6
- Apply
cozystack-operator-generic.yamlof v1.0.0-rc.1.
Expected behaviour
Upgrade succeeds.
Actual behaviour
monitor-agents failed to install
Logs
Paste any relevant logs here. Please redact tokens, passwords, private keys.
Screenshots
If applicable, add screenshots to help explain the problem.
Additional context
related to 0738fae
Checklist
- I have checked the documentation
- I have searched for similar issues
- I have included all required information
- I have provided clear steps to reproduce
- I have included relevant logs
Reacted by dosubot
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bug
Activity
dosubot commentedon Feb 23, 2026
Hi Robin Lee (@cheese)! I'm Dosu and I’m helping the cozystack team.
This error is caused by the
_clustervalues not being populated when the monitoring-agents chart is rendered. The commit you referenced (0738fae56d5610f9871b937b37699f11e21c3f5d) introduced FQDN resolution for tenant workload clusters, and while it uses a nil-safe pattern(index .Values._cluster "cluster-domain") | default "cluster.local", the_clustervalues need to be present.The
_clustervalues are populated via a Secret namedcozystack-valuesin thecozy-systemnamespace, created by the platform package. During upgrade from v1.0.0-beta.6 to v1.0.0-rc.1, this could fail to populate due to:Configuration migration issues - v1.0.0-rc.1 migrated from ConfigMap-based configuration to Platform Package CRD. Do not use
--reuse-valueswhen upgrading the Cozystack operator—pass custom values explicitly with--set.Package dependency ordering - The monitoring-agents package now depends on
cozystack.metrics-server, and if dependencies aren't properly ordered during upgrade,_clustervalues might not be available yet.Could you check if the
cozystack-valuesSecret exists in thecozy-systemnamespace and verify it contains the_clusterconfiguration?To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
cheese commentedon Feb 23, 2026
# (@dosu) Yes, the cozystack-values Secret exists in the cozy-system namespace and contains the _cluster configuration.
dosubot commentedon Feb 23, 2026
Thanks for confirming! The Secret exists in
cozy-system, but that's actually only half the picture.Cozystack uses a Secret replication mechanism - the
cozystack-valuesSecret fromcozy-systemgets automatically replicated to namespaces labeled withcozystack.io/system=true. The monitoring-agents HelmRelease incozy-monitoringreferences the Secret from its own namespace (not cross-namespace).Could you check:
cozystack-valuesSecret also exist in thecozy-monitoringnamespace?cozy-monitoringhave the required label?If the Secret isn't being replicated to
cozy-monitoring, that would explain the "index of untyped nil" error - the HelmRelease can't access the_clustervalues because the local copy of the Secret doesn't exist.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
cheese commentedon Feb 23, 2026
# (@dosu) Yes, the cozystack-values Secret also exist in the cozy-monitoring namespace, which has the required label.
dosubot commentedon Feb 23, 2026
This is interesting - commit 0738fae56d5610f9871b937b37699f11e21c3f5d from PR #2075 is confirmed to be included in v1.0.0-rc.1, and that PR introduced the safe nil-handling pattern
(index .Values._cluster "cluster-domain") | default "cluster.local".However, looking at the error message you posted, the template is using that exact pattern but still failing with "index of untyped nil". This suggests the
_clusterkey might be completely missing from the values (not just the nestedcluster-domainkey), which would causeindexto fail before thedefaultcan kick in.Could you check what's actually in the
cozystack-valuesSecret incozy-monitoring?If
_clusteris missing or malformed in that Secret, it would explain why the nil-safe pattern is still failing. The replicator copies the Secret, but if the source Secret incozy-systemdoesn't have_clusterproperly structured, the replicated Secret won't either.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
cheese commentedon Feb 23, 2026
# (@dosu) Output of
kubectl get secret cozystack-values -n cozy-monitoring -o jsonpath='{.data.values\.yaml}' | base64 -d | grep -A5 "_cluster"isThe template file
packages/system/monitoring-agents/charts/fluent-bit/templates/configmap.yamlat line 16 actually trigger the error. Can nested helm chart access the_clusterconfig in cozystack-values secret?dosubot commentedon Feb 23, 2026
Found it! The issue is that your
_clusterconfig is missing thecluster-domainkey. Your Secret contains:But the fluent-bit outputs template expects
_cluster.cluster-domain:Host vlogs-generic.{{ .Values.global.target }}.svc.{{ (index .Values._cluster "cluster-domain") | default "cluster.local" }}The
tplfunction at line 16 passes the root context ($), so the subchart should have access to_cluster. The problem is that whencluster-domainis missing, theindexfunction returns nil correctly, but somewhere in the template chain it's not falling through to thedefaultproperly.This looks like it could be a bug where the
cozystack-valuesSecret incozy-system(the source) doesn't includecluster-domainin the_clustersection. The platform package should be populating this fromnetworking.clusterDomain.Can you check what's in the source Secret in
cozy-system?If
cluster-domainis also missing there, that's the root cause - the platform configuration isn't setting it properly during upgrade.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
cheese commentedon Feb 23, 2026
# (@dosu) The
_clusterconfig contains thecluster-domainkey. You told me to filter the full text withgrep -A5 "_cluster", so what I pasted was only a partial content.dosubot commentedon Feb 23, 2026
Apologies for the confusion with the grep command!
Since
_clusterexists withcluster-domainin the Secret, this is puzzling. The error"index of untyped nil"indicates that.Values._clusteris nil at the time thetplfunction executes, even though the Secret contains the data.This could be a timing/injection issue where the
valuesFrominjection from the Secret hasn't been properly applied to the HelmRelease. Can you check the actual HelmRelease to see if it has thevaluesFromconfiguration?If
valuesFromis missing or not referencingcozystack-values, that would explain why the Secret data isn't making it into the template context - the HelmRelease would be rendering without the_clustervalues even though the Secret exists.Also, could you share the full HelmRelease status to see if there are any other clues?
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
kvaps commentedon Feb 23, 2026
Hey Robin Lee (@cheese) thanks for report, we'll fix this soon
fix(monitoring-agents): use global.clusterDomain for FQDN resolution
fix(monitoring-agents): revert _cluster FQDN and use cluster-domain i…
kvaps commentedon Feb 23, 2026
This is regression introduced by #2075 and should be fixed by #2086
fix(monitoring-agents): use global.clusterDomain for FQDN resolution (#…