kubernetes-ingress icon indicating copy to clipboard operation
kubernetes-ingress copied to clipboard

Access logs settings get overridden if using a Global Custom Resource

Open apalmatier opened this issue 2 years ago • 5 comments

While normally you can set access logs via either the config section, or the dedicated logging section in the values files such as

controller:
  config:
    syslog-server: "address:stdout, format: raw, facility:local0"

or

controller:
  logging:
    traffic:
      address: stdout
      format: raw
      facility: local0

if you happen to try using the Global Custom Resource, the access logs will mysteriously vanish. Only to return if you happen to read through the CRD and realize there's a secret log_targets field that you must include additionally, such as

apiVersion: "core.haproxy.org/v1alpha2"
kind: Global
metadata:
  name: global
spec:
  log_targets:
  - address: stdout
    format: raw
    facility: local0
    level: debug

This isn't documented anywhere, and can be fixed with a bunch of ways such as

  • documenting it in the values file logging section
  • documenting it in the Global Custom Resource docs
  • not having the Custom resource overwrite the other settings
  • removing from either the Global CRD or the values file

apalmatier avatar Mar 19 '24 14:03 apalmatier

Hi @apalmatier, as discussed on Slack we'll make the documentation more explicit in its dedicated section but the CRD will take precedance over any annotations. More precisely, if it exists then annotations are not considered anymore.

ivanmatmati avatar Mar 26 '24 14:03 ivanmatmati

Sounds good! That last clarifying point is the one that got me. If that's somewhere I think it's much more obvious 👍

if it exists then annotations are not considered anymore

apalmatier avatar Mar 26 '24 14:03 apalmatier

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '24 00:04 stale[bot]

Hello, Bug is still here as documentation has not been updated yet :)

odoucet avatar Apr 26 '24 07:04 odoucet

Can you please point to where we should make modifications on source code to make log_targets config option appear in https://www.haproxy.com/documentation/kubernetes-ingress/community/configuration-reference/global-crd/#anonkey-version-v1-11 ? I tried to modify crs/definition/ingress.v1.haproxy.org_globals.yaml but my work disappeared when I launched ./crs/code-generator.sh, meaning this yaml file is built automatically (by the way, you should add a comment on top of this file, stating it is generated automatically).

odoucet avatar May 09 '24 08:05 odoucet

to me, this is not exactly "fixed" : the workaround was to document this behaviour in helm chart values.yaml but this very bug is about documenting entry log_targets on global CRD documentation.

odoucet avatar May 24 '24 15:05 odoucet