Skip to content

Commit

Permalink
INSIGHTS-156 - Fix typo and improve failure message (#1055)
Browse files Browse the repository at this point in the history
* fix typo

* fix failure message

* fix changelog

* fix missingPodDisruptionBudget validation

* Update failure.empty-labels.yaml

* Update failure.no-metadata.yaml

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

* use go templating instead of custom function validation

* fix changelog
  • Loading branch information
vitorvezani authored Jun 27, 2024
1 parent 8b236c2 commit 61e0d34
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ meta:

---

## unreleased
## 9.1.1
* Fix `hpaMinAvailability` failure message
* Fix `missingPodDisruptionBudget` typo
* Rewrite `hpaMaxAvailability` check to use go-template

## 9.1.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/checks/hpaMinAvailability.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
successMessage: HPA has a valid min replica configuration
failureMessage: HPA maxReplicas should be greater than minReplicas
failureMessage: HPA minReplicas should be 2 or more
category: Reliability
target: autoscaling/HorizontalPodAutoscaler
schema:
Expand Down
14 changes: 11 additions & 3 deletions pkg/config/checks/missingPodDisruptionBudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ category: Reliability
target: Controller
controllers:
include:
- Deployment
- Deployment
schema:
'$schema': http://json-schema.org/draft-07/schema
"$schema": http://json-schema.org/draft-07/schema#
type: object
properties:
spec:
type: object
properties:
template:
type: object
properites:
properties:
metadata:
type: object
properties:
labels:
type: object
minProperties: 1
required:
- labels
required:
- metadata
required:
- template
required:
- spec
additionalSchemaStrings:
policy/PodDisruptionBudget: |
type: object
Expand Down
22 changes: 22 additions & 0 deletions test/checks/missingPodDisruptionBudget/failure.empty-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper
spec:
template:
metadata:
labels: {} # empty labels
spec:
containers:
- name: zookeeper
image: zookeeper
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: zookeeper-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app.kubernetes.io/name: zookeeper
21 changes: 21 additions & 0 deletions test/checks/missingPodDisruptionBudget/failure.no-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper
spec:
template:
metadata: {} # missing labels
spec:
containers:
- name: zookeeper
image: zookeeper
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: zookeeper-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app.kubernetes.io/name: zookeeper
20 changes: 20 additions & 0 deletions test/checks/missingPodDisruptionBudget/failure.no-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper
spec:
template: # missing metadata
spec:
containers:
- name: zookeeper
image: zookeeper
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: zookeeper-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app.kubernetes.io/name: zookeeper

0 comments on commit 61e0d34

Please sign in to comment.