diff --git a/docs/changelog.md b/docs/changelog.md index 12c75575d..69c9ce000 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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 diff --git a/pkg/config/checks/hpaMinAvailability.yaml b/pkg/config/checks/hpaMinAvailability.yaml index 5bc00104e..b57eecc9a 100644 --- a/pkg/config/checks/hpaMinAvailability.yaml +++ b/pkg/config/checks/hpaMinAvailability.yaml @@ -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: diff --git a/pkg/config/checks/missingPodDisruptionBudget.yaml b/pkg/config/checks/missingPodDisruptionBudget.yaml index 9741544c8..1ff42ad85 100644 --- a/pkg/config/checks/missingPodDisruptionBudget.yaml +++ b/pkg/config/checks/missingPodDisruptionBudget.yaml @@ -4,9 +4,9 @@ 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: @@ -14,13 +14,21 @@ schema: 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 diff --git a/test/checks/missingPodDisruptionBudget/failure.empty-labels.yaml b/test/checks/missingPodDisruptionBudget/failure.empty-labels.yaml new file mode 100644 index 000000000..338e962f0 --- /dev/null +++ b/test/checks/missingPodDisruptionBudget/failure.empty-labels.yaml @@ -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 diff --git a/test/checks/missingPodDisruptionBudget/failure.no-labels.yaml b/test/checks/missingPodDisruptionBudget/failure.no-labels.yaml new file mode 100644 index 000000000..c65d6924f --- /dev/null +++ b/test/checks/missingPodDisruptionBudget/failure.no-labels.yaml @@ -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 diff --git a/test/checks/missingPodDisruptionBudget/failure.no-metadata.yaml b/test/checks/missingPodDisruptionBudget/failure.no-metadata.yaml new file mode 100644 index 000000000..e4803b03b --- /dev/null +++ b/test/checks/missingPodDisruptionBudget/failure.no-metadata.yaml @@ -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