argo-cd/pkg/diff/testdata/smd-deploy2-config.yaml

37 lines
807 B
YAML
Raw Normal View History

fix: Server side diff now works correctly with fields removal (#640) * fix: Server side diff now works correctly with some fields removal Helps with https://github.com/argoproj/argo-cd/issues/20792 Removed and modified sets may only contain the fields that changed, not including key fields like "name". This can cause merge to fail, since it expects those fields to be present if they are present in the predicted live. Fortunately, we can inspect the set and derive the key fields necessary. Then they can be added to the set and used during a merge. Also, have a new test which fails before the fix, but passes now. Failure of the new test before the fix ``` Error: Received unexpected error: error removing non config mutations for resource Deployment/nginx-deployment: error reverting webhook removed fields in predicted live resource: .spec.template.spec.containers: element 0: associative list with keys has an element that omits key field "name" (and doesn't have default value) Test: TestServerSideDiff/will_test_removing_some_field_with_undoing_changes_done_by_webhook ``` Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com> * Use new version of structured merge diff with a new option Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com> * Add DCO Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com> * Try to fix sonar exclusions config Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com> --------- Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
2024-12-11 20:28:47 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: missing
applications.argoproj.io/app-name: nginx
something-else: bla
name: nginx-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
applications.argoproj.io/app-name: nginx
spec:
containers:
- image: 'nginx:1.23.1'
imagePullPolicy: Never
livenessProbe:
exec:
command:
- cat
- non-existent-file
initialDelaySeconds: 5
periodSeconds: 180
name: nginx
ports:
- containerPort: 8081
protocol: UDP
- containerPort: 80
protocol: TCP