Skip to content

Add support for Merge of rule Options #687

@AleksandarSavchev

Description

@AleksandarSavchev

What would you like to be added:
Diki should be able to handle rule options configurations with multiple records of the same rule. This can be accomplished by extending the Options interface with a Merge(opt Option method.

// Option that can be validated in order to ensure
// that configurations are correctly defined
type Option interface {
Validate(fldPath *field.Path) field.ErrorList
}

Ideally there should be a way to configure a merge strategy. There should be 2 such strategies: replace (override) and combine

  • replace would only use the last defined rule option for the specific rule
  • combine will use the Merge() method of the Option

The merge strategy can be configured on ruleset level:

providers:
- id: managedk8s
  name: "Managed Kubernetes"
  rulesets:
  - id: disa-kubernetes-stig
    name: DISA Kubernetes Security Technical Implementation Guide
    version: v2r4
    args:
      mergeStrategy: replace

Why is this needed:
Enhance the user experience of writing diki configs. Provide a way without editing recommended rule options to add on additional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementEnhancement, improvement, extensionpriority/3Priority (lower number equals higher priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions