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 customizable key to disable checks customization for certain checks #550

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions guides/check_definition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"$ref": "#/definitions/Fact"
}
},
"customizable": {
"type": "boolean"
},
"values": {
"type": "array",
"items": {
Expand Down Expand Up @@ -88,6 +91,9 @@
"name": {
"type": "string"
},
"customizable": {
"type": "boolean"
},
"default": {
"anyOf": [
{
Expand Down
34 changes: 34 additions & 0 deletions guides/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ facts:
gatherer: corosync.conf
argument: totem.token

customizable: true

values:
- name: expected_token_timeout
customizable: true
default: 5000
conditions:
- value: 30000
Expand Down Expand Up @@ -119,6 +122,7 @@ Following are listed the top level properties of a Check definition yaml.
| `severity` | not required | [see more](#severity) |
| `metadata` | not required | [see more](#metadata) |
| `facts` | required | [see more](#facts) |
| `customizable` | not required | [see more](#customizable) |
| `values` | not required | [see more](#values) |
| `expectations` | required | [see more](#expectations) |

Expand Down Expand Up @@ -348,6 +352,21 @@ facts:

Finally, gathered facts, are used in Check's [Expectations](#expectations) to determine whether expected conditions are met for the best practice to be adhered.

## Customizable

Users can modify a check's [expected values](#values) to adapt to specific system and environmental configurations.

Built-in checks are considered **customizable** by **default**, so the `customizable` flag disables customization for a particular check.

The customizability flag can be set globally for a check and|or for [specific values](#customizable-values).
When customization is globally disabled for a check, marked with `customizable: false`, it overrides any value-specific customizability settings. If global customization is not disabled, the customizability of individual values is then considered.

To explicitly mark a check as non-customizable, set the `customizable` key to `false`:

```yaml
customizable: false
```

## Values

Values are named variables that may evaluate differently based on the execution context and are used with Facts for _Contextual_ [Expectations](#expectations) Evaluation.
Expand Down Expand Up @@ -461,6 +480,21 @@ Note that `conditions` is a cascading chain of contextual inspection to determin

All the _resolved_ declared values would be registered in the [`values`](#values-1) namespaced evaluation scope.

### Customizable Values

In addition to the global-level [customizability](#customizable), individual check values are also **customizable** by **default**. To provide finer control, a `boolean` customizable entry can be defined on a per-value basis.

```yaml
values:
- name: non_customizable_check_value
customizable: false
default: 5000
```

Setting **customizable**: `false` for a specific value prevents the modification of the default value.

Note that if global customizability is set to false, it takes precedence over any value-level customizable settings, disabling customizability for all associated values.

## Expectations

Expectations are assertions on the state of a target infrastructure for a given scenario. By using fact and values they are able to determine if a check passes or not.
Expand Down