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

[BUG] no-rolling-update-strategy does not account for the default Strategy being RollingUpdate #824

Open
meganwalker-ibm opened this issue Jul 26, 2024 · 0 comments

Comments

@meganwalker-ibm
Copy link

Describe the bug
The no-rolling-update-strategy rule is looking for a DeploymentLike object to have a strategy.type field matching RollingUpdate|Rolling.

However the default value for this field is RollingUpdate making specifying it redundant: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy

However the rule is useful for ensuring we don't set a type of Recreate.

I think this rule would be better revised to consider a missing value as being a pass.

To Reproduce
Enable no-rolling-update-strategy.
Lint two deploymentLike objects. One that does not set a strategy. One that sets RolllingUpdate explicitly.
They are equivalent in effect, and so should be treated the same.

Sample YAML input
.kube-linter.yaml

checks:
  doNotAutoAddDefaults: true
  include:
    - no-rolling-update-strategy

sample.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app1
spec:
  strategy:
    type: Other
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  name: app2
spec:
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  name: app3
spec:
  strategy:
    type: RollingUpdate

Expected behavior
Only app1 should be identifies as violating this linting rule. app2 and app3 are directly equivalent to each other.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant