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

Add logging options to Helm chart #1691

Merged
merged 12 commits into from
Oct 7, 2024
Merged

Conversation

Baarsgaard
Copy link
Contributor

@Baarsgaard Baarsgaard commented Sep 24, 2024

Expose available logging options in the Helm chart.
Useful for people who use structured logging solutions.
I found #1659 and thought it would be a quick fix.

I also found some securityContext options that were not replicated to/from the kustomize configuration, those were aligned along with the logging args.

Replication steps:

# Prepare kind cluster
export KUBECONFIG=~/.kube/kind-grafana-operator
make kind-start

# Install Helm chart with no modifications
helm upgrade -i grafana-operator ./deploy/helm/grafana-operator --version v5.13.0

# Verify default configurations
kubectl get deployments.apps grafana-operator -o yaml | grep -A 10 containers:
# Verify standard/default log output
kubectl logs deployments/grafana-operator

# Install helm chart with overwritten logging values
helm upgrade -i grafana-operator ./deploy/helm/grafana-operator --version v5.13.0 \
  --set logging.encoder=json --set logging.level=debug --set logging.time=rfc3339

# Verify arg changes in deployment
kubectl get deployments.apps grafana-operator -o yaml | grep -A 10 containers:
# Verify level, encoding, and time format have changed in the logs
kubectl logs deployments/grafana-operator

@Baarsgaard Baarsgaard marked this pull request as ready for review September 24, 2024 17:43
Copy link
Collaborator

@weisdd weisdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Configuration for logging is certainly useful, and nice catch around missing options securityContext in kustomize.

I certainly did not expect to leave so many comments on a simple PR, but since you've made many changes in various places (not necessarily related to the initial idea behind the PR), there are more things to point at.

deploy/kustomize/base/deployment.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/templates/deployment.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
deploy/helm/grafana-operator/values.yaml Outdated Show resolved Hide resolved
@Baarsgaard
Copy link
Contributor Author

Baarsgaard commented Oct 6, 2024

@weisdd Thanks for the thorough review! I've applied your suggestions.
On your first comment with regards to the Kustomize options and documenting them.
I was not sure which direction to take with that?
Were you thinking adding an example jsonpatch similar to the argocd patches?

patches:
  - target:
      apiVersion: apps/v1
      kind: Deployment
      name: grafana-operator-controller-manager
    patches: |-
      - op: add
        path: /spec/template/spec/containers/0/args/-
        value: -zap-encoder=json

@Baarsgaard Baarsgaard requested a review from weisdd October 6, 2024 15:54
@weisdd
Copy link
Collaborator

weisdd commented Oct 7, 2024

@Baarsgaard In my view, the way you did it (commented-out section) is good enough for now. In future, it would be handy to just have a separate page in docs where we would list all available configuration options like logging flags or whatever else. It doesn't have to be ArgoCD-specific - in the end, people who use it know enough to patch resources themselves, they just need to know which arguments to pass.

Copy link
Collaborator

@weisdd weisdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During today's meeting, we (maintainers) discussed this PR.

  • It was decided to remove references to zap logging flags from Kustomize (done). @theSuess will prepare documentation instead;
  • I've noticed that the default setting for time did not match the previous format (rfc3339, which is made the default through operator-sdk), that is fixed now.

For the rest, the PR should be good to merge. Thanks for your contribution!

@weisdd weisdd added this pull request to the merge queue Oct 7, 2024
Merged via the queue into grafana:master with commit 5e8bee1 Oct 7, 2024
14 checks passed
@Baarsgaard Baarsgaard deleted the helm_log_options branch October 7, 2024 11:38
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

Successfully merging this pull request may close these issues.

2 participants