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 apiserver additionalconfig for cluster agent #1655

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

aquiladayc
Copy link
Contributor

What this PR does / why we need it:

Wanted to add use_component_status for kubernetes_apiserver check,
https://github.com/DataDog/datadog-agent/blob/847ecc3a52a2a323409ecde41764e42a18eefc00/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver.go#L73
however, config is overwritten by event collection configuration.
https://github.com/DataDog/helm-charts/blob/main/charts/datadog/templates/_kubernetes_apiserver_config.yaml#L2

So when k8s event collection is enabled, apiserver check is not customizable. This PR fixes it.

Which issue this PR fixes

Related to CONS-6941

Special notes for your reviewer:

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Chart Version bumped
  • Documentation has been updated with helm-docs (run: .github/helm-docs.sh)
  • CHANGELOG.md has been updated
  • Variables are documented in the README.md
  • For Datadog Operator chart or value changes update the test baselines (run: make update-test-baselines)

@aquiladayc aquiladayc requested a review from a team as a code owner December 31, 2024 03:50
@github-actions github-actions bot added the chart/datadog This issue or pull request is related to the datadog chart label Dec 31, 2024
@aquiladayc aquiladayc changed the title Aquiladayc/apiserver additionalconfig Add apiserver additionalconfig for cluster agent Dec 31, 2024
@khewonc
Copy link
Contributor

khewonc commented Jan 3, 2025

Instead of additionalConfigs, can you add the field directly? For example, kubernetesApiserverCheck.useComponentStatus

@aquiladayc
Copy link
Contributor Author

@khewonc thanks for feedback. Added clusterAgent.kubernetesApiserverCheck.disableUseComponentStatus because

  • Default value is true and hard coded in source code of DCA
  • IF statements would be simple (No need to use NOT)
    Let me know what you think or point me if i'm doing something wrong. Thanks!

charts/datadog/values.yaml Outdated Show resolved Hide resolved
charts/datadog/values.yaml Outdated Show resolved Hide resolved
charts/datadog/templates/_kubernetes_apiserver_config.yaml Outdated Show resolved Hide resolved
@@ -1,13 +1,19 @@
{{- define "kubernetes_apiserver-config" -}}
{{- if .Values.datadog.collectEvents -}}
{{- if or (.Values.datadog.collectEvents) (.Values.clusterAgent.kubernetesApiserverCheck.disableUseComponentStatus) -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have multiple conditions, I think this could be moved to the helper file similar to how we have need-cluster-agent-confd for the cluster agent confd. The helper could then be used in the change you have for charts/datadog/templates/cluster-agent-deployment.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@khewonc I see, created need-kuberetes-apiserver-check-config in helper and updated both.

aquiladayc and others added 7 commits January 10, 2025 12:37
Co-authored-by: khewonc <39867936+khewonc@users.noreply.github.com>
Co-authored-by: khewonc <39867936+khewonc@users.noreply.github.com>
Co-authored-by: khewonc <39867936+khewonc@users.noreply.github.com>
Comment on lines +1313 to +1315
# clusterAgent.kubernetesApiserverCheck.disableUseComponentStatus -- Set this to true to disable use_component_status for the kubernetes_apiserver check
kubernetesApiserverCheck:
disableUseComponentStatus: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comments need to be set on the option, else it is not taken into account in the README.md

Suggested change
# clusterAgent.kubernetesApiserverCheck.disableUseComponentStatus -- Set this to true to disable use_component_status for the kubernetes_apiserver check
kubernetesApiserverCheck:
disableUseComponentStatus: false
# clusterAgent.kubernetesApiserverCheck -- correspond to options for configuring the kube_apiserver integration.
kubernetesApiserverCheck:
# clusterAgent.kubernetesApiserverCheck.disableUseComponentStatus -- Set this to true to disable use_component_status for the kube_apiserver integration.
disableUseComponentStatus: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chart/datadog This issue or pull request is related to the datadog chart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants