apiVersion: troubleshoot.sh/v1beta2
kind: Collector
metadata:
  name: my-application-name
spec:
  collectors:
  - clusterInfo:
      collectorName: my-cluster-info
  - clusterResources:
      collectorName: my-cluster-resources
  - http:
      name: healthz
      get:
        url: http://api:3000/healthz
  - data:
      collectorName: my-password-dump
      name: data
      data: |
        my super secret password is abc123
        another redaction will go here
  - data:
      collectorName: yaml-data.yaml
      name: data
      data: |
        abc:
          xyz:
          - hello
          - world: "these are removed"
        bcd:
          abc:
            xyz:
              - these
              - remain
---
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
  name: my-application-name
spec:
  redactors:
  - name: replace password # names are not used internally, but are useful for recordkeeping
    fileSelector:
      file: data/my-password-dump # this targets a single file
    removals:
      values:
      - abc123 # this is a very good password, and I don't want it to be exposed
  - name: all files # as no file is specified, this redactor will run against all files
    removals:
      regex:
      - redactor: (another)(?P<mask>.*)(here) # this will replace anything between the strings `another` and `here` with `***HIDDEN***`
      - selector: 'S3_ENDPOINT' # remove the value in lines following those that contain the string S3_ENDPOINT
        redactor: '("value": ").*(")'
      yamlPath:
      - "abc.xyz.*" # redact all items in the array at key xyz within key abc in yaml documents
