-
Notifications
You must be signed in to change notification settings - Fork 258
Description
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-strategysample.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: RollingUpdateExpected behavior
Only app1 should be identifies as violating this linting rule. app2 and app3 are directly equivalent to each other.
Additional context