Skip to content

Conversation

@0sewa0
Copy link
Contributor

@0sewa0 0sewa0 commented Jan 26, 2026

Description

https://dt-rnd.atlassian.net/browse/DAQ-18391

Creates a new builtin:kubernetes.security-posture-management Settings object in case KSPM is turned on.

The following scenarios have to be covered:

  • Settings object for the cluster already exists:
    • Don’t do anything
  • KSPM and kubemon are disabled
    • Don't do anything
  • KSPM is enabled
    • Create the KSPM settings object, set configurationDatasetPipelineEnabled to true
  • KSPM is disabled, but kubernetes monitoring is turned on
    • (I am challenging this, reason for being in draft) Reasons were given in comment on the ticket
    • Create the KSPM settings object, but set configurationDatasetPipelineEnabled to false

How can this be tested?

Deploy a DK with KSPM enabled or just Kubernetes Monitoring

Example:

apiVersion: dynatrace.com/v1beta6
kind: DynaKube
metadata:
  name: kspm-test
  namespace: dynatrace
spec:
  apiUrl: https://tenant.dev.dynatracelabs.com/api
  kspm: {}
  activeGate:
    capabilities:
      - kubernetes-monitoring
  templates:
       kspmNodeConfigurationCollector:
         imageRef:
           repository: public.ecr.aws/dynatrace/dynatrace-k8s-node-config-collector
           tag: "1.5.2"
         tolerations:
          - effect: NoSchedule
            key: kubernetes.io/arch
            value: arm64
          - effect: NoSchedule
            key: node-role.kubernetes.io/master
            operator: Exists
          - effect: NoSchedule
            key: node-role.kubernetes.io/control-plane
            operator: Exists

Warning

The settings API requires settings:objects:write and settings:objects:read. Please don’t forget to check for them.

In addition the securityProblems.write is currently required. This requirement will be lifted in the future. For this PR you can just add this permission to your token and assume the requirement will be dropped later.

Currently on some dev tenants it is not possible to create a token with the securityProblem.write permission in the UI. In this case you need to use the apiToken-API: check ticket for details

How to create an API token with securityProblems.write scope:

  1. Create an API token with apiTokens.write in the Access Tokens UI (yeah, don't know how else, maybe personal access tokens 🤷 )
  2. Use the following curl to create a token with this extra permission:
curl -X 'POST' \
  'https://<YOUR TENANT>dev.dynatracelabs.com/api/v2/apiTokens' \
  -H 'accept: application/json; charset=utf-8' \
  -H 'Authorization: Api-Token <INSERT YOUR TOKEN FROM STEP 1.>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{
  "name": "kspm-test",
  "personalAccessToken": false,
  "scopes": [
    "activeGateTokenManagement.create",
    "entities.read",
    "settings.read",
    "settings.write",
    "DataExport",
    "InstallerDownload",
    "securityProblems.write"
  ]
}'

@0sewa0 0sewa0 added the kspm Changes related to the KSPM (Kubernetes Security Posture Management) feature label Jan 26, 2026
@0sewa0 0sewa0 marked this pull request as ready for review January 26, 2026 14:42
@0sewa0 0sewa0 requested a review from a team as a code owner January 26, 2026 14:42
@avorima avorima self-assigned this Jan 27, 2026
@0sewa0 0sewa0 requested a review from avorima January 27, 2026 14:02
Copy link
Contributor

@avorima avorima left a comment

Choose a reason for hiding this comment

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

👨‍🍳

@0sewa0 0sewa0 enabled auto-merge January 28, 2026 07:31
@0sewa0 0sewa0 added this pull request to the merge queue Jan 28, 2026
@chrismuellner chrismuellner removed this pull request from the merge queue due to the queue being cleared Jan 28, 2026
@0sewa0 0sewa0 merged commit 59c2684 into main Jan 28, 2026
20 checks passed
@0sewa0 0sewa0 deleted the feature/kspm-settings branch January 28, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kspm Changes related to the KSPM (Kubernetes Security Posture Management) feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants