kube-score icon indicating copy to clipboard operation
kube-score copied to clipboard

idea: automatically inject improvements

Open zegl opened this issue 6 years ago • 3 comments

Many tests could easily modify the input object to add the improvements automatically.

For example the "X-has-host-podantiaffinity" tests:

With an input like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: foobar
spec:
  replicas: 10
  template:
    metadata:
      labels:
        app: foo
    spec:
      containers:
      - name: foobar
        image: foo:bar

The following affinity rule could be added fairly easily:

      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: foo
                topologyKey: kubernetes.io/hostname

The hardest part with this, is to preserve as much of the original YAML (comments etc) as possible. I don't know at the moment if there are any tools that will make this easier.

zegl avatar Jan 13 '19 14:01 zegl

@zegl lets work on this feature together ?

smsufyian avatar Mar 02 '20 16:03 smsufyian

@s-m-sufyian Sure, do you have any ideas for how to solve this in a reasonable way?

zegl avatar Apr 12 '20 15:04 zegl

@zegl I think , best practices are more subjective , There should be some common practices which any company should be able to override , lets call this policies/rules . Rules and policies which will not be overridden , will be taken from the base policy or standard .

smsufyian avatar Apr 12 '20 20:04 smsufyian