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

fixed pdbMinAvailableGreaterThanHPAMinReplicas and added validation for pdbMinAvailableEqualToHPAMinReplicas. #1073

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
rename pdbMinAvailableGreaterThanHPAMinReplicas to pdbMinAvailableGre…
…aterThanOrEqualToHPAMinReplicas
  • Loading branch information
YuMuuu committed Oct 3, 2024
commit b93f283acc279b90c7e7a9d8dbbe53b2f8ab9a31
2 changes: 1 addition & 1 deletion docs/checks/reliability.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ key | default | description
`topologySpreadConstraint` | `warning` | Fails when there is no topology spread constraint on the pod
`hpaMaxAvailability` | `warning` | Fails when `maxAvailable` lesser or equal than `minAvailable` (if defined) for a HorizontalPodAutoscaler
`hpaMinAvailability` | `warning` | Fails when `minAvailable` (if defined) lesser or equal to one for a HorizontalPodAutoscaler
`pdbMinAvailableGreaterThanHPAMinReplicas` | `warning` | Fails when PDB `minAvailable` is greater than HPA `minReplicas`
`pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas` | `warning` | Fails when PDB `minAvailable` is greater than HPA `minReplicas`

## Background

2 changes: 1 addition & 1 deletion pkg/config/checks.go
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ var (
"rolebindingClusterAdminRole",
"hpaMaxAvailability",
"hpaMinAvailability",
"pdbMinAvailableGreaterThanHPAMinReplicas",
"pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas",
}

// BuiltInChecks contains the checks that come pre-installed w/ Polaris
2 changes: 1 addition & 1 deletion pkg/config/default.yaml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ checks:
topologySpreadConstraint: warning
hpaMaxAvailability: warning
hpaMinAvailability: warning
pdbMinAvailableGreaterThanHPAMinReplicas: warning
pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas: warning

# efficiency
cpuRequestsMissing: warning
2 changes: 1 addition & 1 deletion pkg/config/examples/config-full.yaml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ checks:
metadataAndInstanceMismatched: warning
hpaMaxAvailability: warning
hpaMinAvailability: warning
pdbMinAvailableGreaterThanHPAMinReplicas: warning
pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas: warning

# efficiency
cpuRequestsMissing: warning
4 changes: 2 additions & 2 deletions pkg/validator/pdb_hpa_validator.go
Original file line number Diff line number Diff line change
@@ -16,10 +16,10 @@ import (
)

func init() {
registerCustomChecks("pdbMinAvailableGreaterThanHPAMinReplicas", pdbMinAvailableGreaterThanHPAMinReplicas)
registerCustomChecks("pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas", pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas)
}

func pdbMinAvailableGreaterThanHPAMinReplicas(test schemaTestCase) (bool, []jsonschema.ValError, error) {
func pdbMinAvailableGreaterThanOrEqualToHPAMinReplicas(test schemaTestCase) (bool, []jsonschema.ValError, error) {
if test.ResourceProvider == nil {
return true, nil, nil
}