fluxcd / flux2

Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.
https://fluxcd.io
Apache License 2.0
6.56k stars 607 forks source link

issue in Drift Detection #4960

Closed cyberjpb1 closed 2 months ago

cyberjpb1 commented 2 months ago

Describe the bug

The Drift detection/correction seems to work well and if I try to change for example the replicas in the Deployment manifest directly in the cluster, FluxCD will put back the original value contained in the Git repo.

But in case I add a new container by changing Deployment manifest directly in the cluster, FluxCD/Helm does not seem to detect it.

Steps to reproduce

Add this YAML code to de Deployment manifest directly in the cluster :

        - name: not-evil
          image: 'registry.io/alpine:3.16.0'
          command:
            - sh
            - '-c'
            - echo "I am not evil" ; sleep infinity
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent

Expected behavior

Flux should detect the addition of the new container in the deployment manifest and remove it since it does not exist in the Helm Chart deployment manifest under the Git repository.

Screenshots and recordings

No response

OS / Distro

Ubuntu 20.04

Flux version

v2.3.0

Flux check

N/A

Git provider

Azure DevOps Git

Container Registry provider

Azure Container Registry

Additional context

No response

Code of Conduct

stefanprodan commented 2 months ago

This would break every service mesh and sidecar-based injection. Drift correction in Flux helm-controller is about rolling back changes made to fields specified in source aka the chart. A sidecar is an addition, so it doesn't get removed.

cyberjpb1 commented 2 months ago

Okay, thanks for the quick reply.