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

[Xray] can't enable loggers: can't evaluate field Values in type interface {} #1827

Closed
nu12 opened this issue Oct 6, 2023 · 3 comments
Closed
Assignees

Comments

@nu12
Copy link

nu12 commented Oct 6, 2023

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

Version of Helm and Kubernetes:
Helm v3.12.0
Kubernetes 1.27.3

Which chart:
xray version 103.82.11

What happened:
When the field loggers is not empty, helm gives the error below when compiling the manifests:

Error: template: xray/templates/xray-statefulset.yaml:1123:22: executing "xray/templates/xray-statefulset.yaml" at <.Values.containerSecurityContext.enabled>: can't evaluate field Values in type interface {}
helm.go:84: [debug] template: xray/templates/xray-statefulset.yaml:1123:22: executing "xray/templates/xray-statefulset.yaml" at <.Values.containerSecurityContext.enabled>: can't evaluate field Values in type interface {}

What you expected to happen:
Successful compilation of the manifests when running helm install/upgrade/template.

How to reproduce it (as minimally and precisely as possible):

Create a minimal values.yaml with loggers commented:

xray:
  jfrogUrl: "any"
  loggers: []
  # - router-request.log

Run helm template to compile the manifests:

$ helm template jfrog/xray --version 103.82.11 --values values.yaml 
coalesce.go:175: warning: skipped value for rabbitmq.initContainers: Not a table.
---
# Source: xray/templates/xray-resourcequota.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
  labels:
    app: xray
    chart: xray-103.82.11
    release: "release-name"
    heritage: "Helm"
  name: release-name-xray
spec:
  hard:
    count/jobs.batch: 100
---
# Source: xray/charts/rabbitmq/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
(...)

We see above that the manifests were compiled.

Now, remove the brackets and uncomment the logger (it doesn't matter how many, one suffies for this test). New values.yaml is:

xray:
  jfrogUrl: "any"
  loggers:
  - router-request.log

Run the same command as before:

$ helm template jfrog/xray --version 103.82.11 --values values.yaml --debug
install.go:200: [debug] Original chart version: "103.82.11"
install.go:217: [debug] CHART PATH: /home/my-user/.cache/helm/repository/xray-103.82.11.tgz

coalesce.go:175: warning: skipped value for rabbitmq.initContainers: Not a table.

Error: template: xray/templates/xray-statefulset.yaml:1123:22: executing "xray/templates/xray-statefulset.yaml" at <.Values.containerSecurityContext.enabled>: can't evaluate field Values in type interface {}
helm.go:84: [debug] template: xray/templates/xray-statefulset.yaml:1123:22: executing "xray/templates/xray-statefulset.yaml" at <.Values.containerSecurityContext.enabled>: can't evaluate field Values in type interface {}

The error appears.

I'm using helm template command for this demonstration but the same error happens with helm install and helm upgrade.

Cheers.

@eldada
Copy link
Contributor

eldada commented Oct 7, 2023

Looks like a bug that should be fixed. @chukka - can you take it?

While this is looked at, I recommend moving to a smarter, more efficient logging with a single sidecar for all logs.
Look at https://github.com/jfrog/charts/tree/master/examples/artifactory/logging for an example of a more advanced way that is actually used by us (JFrog). For Xray, it should be a similar solution in common.customSidecarContainers.
A single fluent-bit based sidecar that tails the logs you want and spits them out as json, which can easily be consumed or just tailed.

@rahulsadanandan
Copy link
Collaborator

@nu12 Thanks for reporting this.
We've created an internal ticket to track and address this issue, and it will be fixed in one of the upcoming releases.

@rahulsadanandan
Copy link
Collaborator

@nu12 The fix will be available from 3.86.x versions of xray. For a more streamlined logging approach, refer to this example at https://github.com/jfrog/charts/tree/master/examples/xray/logging, utilizing the fluent-bit sidecar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants