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

INSIGHTS-159 - use go templating instead of custom function validation #1056

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
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
33 changes: 32 additions & 1 deletion pkg/config/checks/hpaMaxAvailability.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
successMessage: HPA has a valid max and min replica configuration
failureMessage: HPA maxReplicas and minReplicas should be different
category: Reliability
target: autoscaling/HorizontalPodAutoscaler
target: autoscaling/HorizontalPodAutoscaler
schemaString: |
"$schema": http://json-schema.org/draft-07/schema#
type: object
properties:
spec:
type: object
properties:
minReplicas:
type: integer
minimum: 1
maxReplicas:
type: integer
minimum: 1
required:
- maxReplicas
{{- if .spec.minReplicas }}
if:
properties:
minReplicas:
type: integer
maxReplicas:
type: integer
then:
properties:
maxReplicas:
exclusiveMinimum: {{ .spec.minReplicas }}
else:
properties:
maxReplicas:
minimum: 1
{{- end }}
2 changes: 0 additions & 2 deletions pkg/validator/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ func applySchemaCheck(conf *config.Configuration, checkID string, test schemaTes
passes, issues, err = check.CheckContainer(test.Container)
} else if check.Validator.SchemaURI != "" {
passes, issues, err = check.CheckObject(test.Resource.Resource.Object)
} else if customValidators[checkID] != nil {
passes, issues, err = customValidators[checkID](test.Resource.Resource.Object)
} else {
passes, issues, err = true, []jsonschema.ValError{}, nil
}
Expand Down
46 changes: 0 additions & 46 deletions pkg/validator/validations.go

This file was deleted.

Loading