ssa/jsondiff: honor ignored fields before dry-run validation
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Start in ssa/jsondiff/unstructured.go, in Unstructured(), where the live object is fetched and the desired object is dry-run applied before ignored paths are removed. Read the existing tests for the ignore-path filtering, then decide how live values at ignored paths should be copied into a temporary desired object, including the missing-path and array cases. Done means a regression test where a validating webhook rejects a decrease of an ignored field now passes the dry-run, unrelated drift is still reported, and the error still returns without the rule. The semantics need maintainer agreement first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
jsondiff.Unstructured() applies ignored paths only after its server-side dry-run succeeds. An ignored field can therefore cause admission validation to reject the dry-run before the ignore rules take effect.
Reported downstream in https://github.com/fluxcd/helm-controller/issues/1613 with helm-controller v1.4.5 and a StackGres SGShardedCluster. The same ordering is present in ssa/v0.80.0.
Example
The downstream reporter ignores these fields because an in-cluster controller updates them after installation:
/spec/coordinator/pods/persistentVolume/size/spec/shards/pods/persistentVolume/size/spec/shards/overrides
When the live volume size is larger than the value in the Helm release manifest, the dry-run submits the smaller manifest value. The validating webhook rejects the attempted shrink, even though that field is ignored for drift detection. This prevents comparison and correction of unrelated fields on the resource.
This example comes from the downstream report; I have traced the code but have not independently reproduced it against StackGres.
Code path
Unstructured() first fetches the live resource, then copies the desired object and submits it with client.Apply and client.DryRunAll:
https://github.com/fluxcd/pkg/blob/ssa/v0.80.0/ssa/jsondiff/unstructured.go#L158-L166
Only after that succeeds does it remove ignored paths from the dry-run result and the live object before calculating the diff:
https://github.com/fluxcd/pkg/blob/ssa/v0.80.0/ssa/jsondiff/unstructured.go#L176-L186
The ordering has existed since the introduction of jsondiff in #657. The ApplyOptions.DriftIgnoreRules work in #1157 is a separate path; helm-controller calls jsondiff.UnstructuredList() directly.
Expected behavior / proposed approach
For existing resources, consider preserving live values at matching ignored paths in a temporary copy of the desired object before submitting the dry-run. Keep the existing post-dry-run filtering so ignored fields do not appear in the correction patch. The original desired object should remain unchanged, and missing resources should retain the full desired manifest for creation.
The semantics for paths missing from either object, array paths, and overlapping paths need to be defined and tested. Simply deleting ignored fields before server-side apply may affect required fields or field ownership, so it is not necessarily equivalent to preserving live values.
A regression test should use validation that rejects a decrease of an ignored field, verify that the dry-run succeeds with the rule, and verify that unrelated drift remains detectable and correctable. Without the rule, the validation error should still be returned.
Workaround
The downstream reporter disables drift detection for the entire resource with helm.toolkit.fluxcd.io/driftDetection: disabled, losing drift detection for its other fields.
- Ngôn ngữ chính
- Go
- Star
- 63
- Fork
- 162
- Merge trung bình
- 9 giờ 54 phút
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fluxcd/pkg
-
ssa: wait errors drop the kstatus message, so health check failures don't say whyCó thể đã có người làm @schdief đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Improve `make release` to support major version bumpsCó thể đã có người làm @Iam-Karan-Suresh đã nhận 175 ngày trước. Đang mởarea/ci
fluxcd/pkg#1172 · 3 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: `runtime/client.(*Impersonator).CanImpersonate` does not take kubeconfig into accountCó thể làm lại được @yuminn-k đã nhận 16 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 49/100
fluxcd/pkg#959 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Pin and verify Security Insights schema in lintinsights targetCó thể đã có người làm @imshubham22apr-gif đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gemaraproj/gemara#618 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
a2aproject/a2a-go#597 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 4 ngày
-
scopes: GetAllowedTopics, GetProtectedTopics, and GetScopedTopics include empty topic names and do not trim whitespace charactersCó thể đã có người làm @patelshivani2283-lab đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/networking kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
siderolabs/talos#14972 ·
Maintainer thường phản hồi trong vòng 1 ngày