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

PodDisruptionBudget template isn't parsed correctly #618

Closed
daaain opened this issue Aug 27, 2021 · 1 comment
Closed

PodDisruptionBudget template isn't parsed correctly #618

daaain opened this issue Aug 27, 2021 · 1 comment
Labels
stale Marked as stale by stalebot

Comments

@daaain
Copy link

daaain commented Aug 27, 2021

Steps to Reproduce

Create a test.yaml file with the following contents:

apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: "test-pdb"
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: test

Then run it through the latest Polaris CLI:

cat test.yaml | docker run --rm -i quay.io/fairwinds/polaris:4.0.8 polaris audit --only-show-failed-tests --set-exit-code-on-danger --set-exit-code-below-score 85 --audit-path -

Expected Behavior

To get no errors.

Actual Behavior

Instead I get disruptionsAllowed is not greater than zero despite having a correct maxUnavailable setting:

{
  "PolarisOutputVersion": "1.0",
  "AuditTime": "2021-08-27T17:17:15Z",
  "SourceType": "Path",
  "SourceName": "-",
  "DisplayName": "-",
  "ClusterInfo": {
    "Version": "unknown",
    "Nodes": 0,
    "Pods": 0,
    "Namespaces": 0,
    "Controllers": 0
  },
  "Results": [
    {
      "Name": "test-pdb",
      "Namespace": "",
      "Kind": "PodDisruptionBudget",
      "Results": {
        "pdbDisruptionsIsZero": {
          "ID": "pdbDisruptionsIsZero",
          "Message": "disruptionsAllowed is not greater than zero",
          "Details": null,
          "Success": false,
          "Severity": "warning",
          "Category": "Reliability"
        }
      },
      "PodResult": null,
      "CreatedTime": "0001-01-01T00:00:00Z"
    }
  ],
  "Score": 0
}

Additional Context

Looking at one of the tests in the source code I think the issue is that it is looking for the status entry which only gets generated cluster runtime?

References

Couldn't find any, so I opened this new issue.

@rbren
Copy link
Contributor

rbren commented Aug 30, 2021

Good catch! The way were were implementing it (by checking status) worked well for testing resources live in the cluster, but poorly for IaC.

I have a PR here that will make it more robust

@github-actions github-actions bot added the stale Marked as stale by stalebot label Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Marked as stale by stalebot
Projects
None yet
Development

No branches or pull requests

2 participants