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 the ability to include security contexts in container level for cluster checks runners #1598

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

Conversation

mrdoggopat
Copy link

What this PR does / why we need it:

Which issue this PR fixes

Special notes for your reviewer:

Test plan:
Use the following configuration in your values.yaml:

clusterChecksRunner:
  enabled: true
  containers:
    agent:
      securityContext:
        runAsUser: 100
        readOnlyRootFilesystem: true
        allowPrivilegeEscalation: false
        capabilities:
          drop:
            - ALL
    initContainers:
      securityContext:
        runAsUser: 100
        readOnlyRootFilesystem: true
        allowPrivilegeEscalation: false
        capabilities:
          drop:
            - ALL
  • Run kubectl get pod <cluster check pod> -o jsonpath='{.spec.containers[*].securityContext}' | jq . and double check that the security context are appropriately configured in the agent container.

The result should be:

{
  "allowPrivilegeEscalation": false,
  "capabilities": {
    "drop": [
      "ALL"
    ]
  },
  "readOnlyRootFilesystem": true,
  "runAsUser": 100
}
  • Run kubectl get pod <cluster check pod> -o jsonpath='{.spec.initContainers[*].securityContext}' | jq . and double check that the security context are appropriately configured in the init containers.

The result should be the following for the init-config and init-volume init containers:

{
  "allowPrivilegeEscalation": false,
  "capabilities": {
    "drop": [
      "ALL"
    ]
  },
  "readOnlyRootFilesystem": true,
  "runAsUser": 100
}
{
  "allowPrivilegeEscalation": false,
  "capabilities": {
    "drop": [
      "ALL"
    ]
  },
  "readOnlyRootFilesystem": true,
  "runAsUser": 100
}

Also check if cluster checks work fine, can set the following to see if the KSM core check works fine as a cluster check

datadog:
  kubeStateMetricsCore:
    useClusterCheckRunners: true

...or use an integration check like Openmetrics.

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)

@mrdoggopat mrdoggopat requested a review from a team as a code owner November 4, 2024 20:40
@github-actions github-actions bot added the chart/datadog This issue or pull request is related to the datadog chart label Nov 4, 2024
@mrdoggopat mrdoggopat added the enhancement New feature or request label Nov 4, 2024
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant