Commit Graph

39 Commits

Author SHA1 Message Date
Alexander Zielenski 13e927c892 guard against modification of test inputs in TestNoOpChanges
Kubernetes-commit: 14b67bece4a9bb33adc23dcbbddd76a5cfe0c152
2021-11-09 11:39:46 -08:00
Andrea Nodari 2ec597ed01 Add "subresource" field to ManagedFieldEntry
This field is useful to namespace the managed field entries of a
subresource and differentiate them from the ones of the main resource.

Kubernetes-commit: 862d256195adf3be5475b1a6935e5feb78f884a5
2021-02-27 17:16:46 +01:00
Kevin Delgado ea32c4f47f Chain the field manager creation calls in newDefaultFieldManager and test
Kubernetes-commit: d37461180a1e5a52aeb85cf5853e000acfeb852d
2021-04-13 16:15:25 +00:00
Antoine Pelisse 49b6ebdaae fieldmanager: Strip managedfields BEFORE we update the timestamp
Kubernetes-commit: c8be9651ce0de1eee3fa785882fe01dee4b15d37
2021-03-09 12:46:07 -08:00
Danil-Grigorev de3d390777 Make selectors atomic
Ensure that all label selectors are treated as atomic values,
to exclude situations when selectors are being corrupted by
different actors attempting to apply their overlapping definition
for this field with server-side-apply.

Kubernetes-commit: d8a7764b6396b90313ae7bd50a845f4da4705d67
2021-01-12 18:29:56 +01:00
Kevin Delgado 86db6c67fb Server-Side Apply: Status Wiping/Reset Fields
Adds and implements ResetFieldsProvder interface in order to ensure that
the fieldmanager no longer owns fields that get reset before the object
is persisted.

Co-authored-by: Kevin Wiesmueller <kwiesmul@redhat.com>
Co-authored-by: Kevin Delgado <kevindelgado@google.com>

Kubernetes-commit: a1fac8cbd9289d95db4831a83239292ed56ce59d
2021-03-09 23:54:55 +00:00
chymy f5152b019f Fix static failures for vendor/k8s.io/apiserver/pkg/endpoints/handlers
Kubernetes-commit: 04515b9c0a8634ddbb48883cdceb1c265ae97015
2021-02-26 21:01:55 -05:00
Ken Sipe 92af261bb8 fix SA2006 value of err not used
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: a549d0a75e3a09d26f3a316982ff3711be4ed1d2
2020-06-25 17:23:37 -05:00
Jefftree c13cd1f0d3 Make versionconverter functions private
Kubernetes-commit: 1f986cc69d8ac5b579ccc2e6817fd0a07903692b
2020-10-22 13:21:38 -07:00
Jefftree ce4c2eff1a Reuse SSA type converter for resources in the same API Group
Kubernetes-commit: 7182d84b109bb1c928bd5bf92d8c175432b9eeae
2020-10-20 11:16:51 -07:00
Andrea Nodari 99200040ed Do not allow manual changes to manageFields via subresources
If a request tries to change managedFields, the response returns the
managedField of the live object.

Kubernetes-commit: c522ee08a3d248ec1097e3673119ffa7a4e1ef7b
2020-07-14 17:42:54 +02:00
Julian V. Modesto dea021183c Add tests for managed fields tracking.
- Test that client-side apply users don't encounter a conflict with
server-side apply for objects that previously didn't track managedFields
- Test that we stop tracking managed fields with `managedFields: []`
- Test that we stop tracking managed fields when the feature is disabled

Kubernetes-commit: f2deb2417a6c542c54606ab17376b26ef1552b87
2020-07-16 17:14:35 -04:00
Antoine Pelisse c4c20f4f7d Update SMD to v4.0.1 and kube-openapi
Kubernetes-commit: f4c145511a0bb62ea7ee1f2154945c84c17ffcd5
2020-08-10 13:02:25 -07:00
Julian V. Modesto fac7ebd95f Implement server-side apply upgrade & downgrade.
- Allow client-side to server-side apply upgrade.

  Ensure that a user can change management of an object from client-side apply to
  server-side apply without conflicts.

- Allow server-side apply to client-side downgrade.

  For an object managed with client-side apply, a user may upgrade to
  managing the object with server-side apply, then decide to downgrade.

  We can support this downgrade by keeping the last-applied-configuration
  annotation for client-side apply updated with server-side apply.

Kubernetes-commit: e4368eb67e363d3d03f81214a8929268d2fe88ff
2019-10-02 11:13:40 -04:00
Antoine Pelisse 3b7411b225 FieldManager: Reset if we receive nil or a list with one empty item
Kubernetes-commit: ed2cf6ef2cc4f4d358eee038d2d87387614bbf45
2020-05-21 13:23:30 -07:00
Antoine Pelisse 2ff45c3592 fieldmanager: Add failing test for no-op apply actually writing to etcd
Kubernetes-commit: 7120abe6989afff0d4ad879a4590a960f4ab19f0
2020-03-05 10:09:08 -08:00
Antoine Pelisse 5de3b6339e fieldmanager: Move ManagedFields update logic into its own class
Kubernetes-commit: 39681aa5800492b8e4b4ff5fb82e034376864a37
2020-03-05 10:01:37 -08:00
Joe Betz dced5f29d8 Bump to latest SMD to pick up performance optimizations
Kubernetes-commit: d9faaca64738a50455f38dd88845e8b4b5ca37e2
2020-02-06 15:10:25 -08:00
Antoine Pelisse 977fdf9f57 Add UpdateTwice and UpdateApply benchmarks for fieldmanager
I've also moved the deserialization of the object outside the benchmark
since we're not trying to benchmark the yaml parser.

Kubernetes-commit: a52776fbfb305374d87bb553739f712e055b2206
2020-02-06 09:25:52 -08:00
Kevin Wiesmüller 41bde5b991 change Apply signature and move decoding into handlers
Kubernetes-commit: ddf0d4b8034697a8dca23a3c8bc5620629bd691b
2020-01-09 22:34:33 +01:00
jennybuckley 49914e3423 Refactor fieldmanager to be more modular
Kubernetes-commit: d72260b9dad186d96aa621dc8594ca9bd6088937
2019-09-19 13:14:36 -07:00
Antoine Pelisse 81b54ad46e Add tests and benchmarks for endpoints and node
Kubernetes-commit: 0b7ea8bb0e9cc10335044f9ef75920d59462a4ca
2019-09-20 13:32:06 -07:00
Antoine Pelisse db9f1ff5ea Improve fieldmanager tests and benchmarks
Kubernetes-commit: fae9d0ee2136d3443cdd87b1a26a06d7857b01ee
2019-09-10 14:06:08 -07:00
jennybuckley 6c75819b84 Split fieldmanager with interface
Kubernetes-commit: 2c67bf47db8557b6481a5181bdae924e91665988
2019-09-12 10:57:21 -07:00
Antoine Pelisse 912f3b47b9 Refactor FieldManager tests to make them simpler
This is the first step on this, but there are a few improvements that
I'd like to do here.

Kubernetes-commit: b10ad55119a155b776b272a7139dfbed604b05d6
2019-09-10 15:05:26 -07:00
Ted Yu a50931ba7e Move Update Apply conflict test to field manager test
Kubernetes-commit: 9828f986afd4db79a10c78bee1cc2e449faee3a6
2019-08-30 14:47:39 -07:00
Kubernetes Prow Robot c229c2ca0a Merge pull request #81453 from joshmsamuels/master
Apply will fail with managed fields + tests

Kubernetes-commit: 64718f678695884c93d6d3df8f5799614746bea2
2019-09-13 08:22:53 +00:00
jennybuckley b1cbdafe99 Use CRD validation field in server-side apply
Kubernetes-commit: c0617933d4bec5b00dbbfcd24edb7d7e7fc5509d
2019-08-28 15:28:49 -07:00
jennybuckley 263df041f9 Add tests
Kubernetes-commit: 3279c73945553e211ddb7812e07b3c9d46b5e96a
2019-08-22 13:27:38 -07:00
jennybuckley 350fef76f5 Only update managedFields on update if it already exists
Kubernetes-commit: 9a12e37a6dc28fd1d209eb84c210eb0723e6e38f
2019-06-05 14:09:08 -07:00
Antoine Pelisse 2f450e5e39 Add benchmarks for FieldManager handling
We don't have a lot of data on allocations and how much time it takes to
run apply or update on objects, so adding some benchmark will help us
investigate possible improvements.

Kubernetes-commit: 92cf3764f979e63317c8f483d8e841e0358599f4
2019-07-09 14:00:21 -07:00
Aaron Prindle a595f8c602 Added version check between patch and live object in server side apply
What is the problem being solved?
https://github.com/kubernetes/kubernetes/pull/75135
Currently version compatibility is not being checked in server side apply between the patch object and the live object.  This is causing a merge that will error to be run and the apiserver returns a 500 error.  The request should fail if the apiVersion provided in the object is different from the apiVersion in the url, but it should fail before trying to merge, and be a 4xx error. Probably a bad request error.

Why is this the best approach?
The approach of serializing the patch byte array and then checking for version equality with the already serialized live object is the simplest and most straightforward solution.

Kubernetes-commit: d5bd17cda0c134e5ef5c03c3eac79a9ce4e18003
2019-03-07 16:52:26 -08:00
Antoine Pelisse 46d98f52ff Add "fieldManager" to flag to PATCH/CREATE/UPDATE
And add a corresponding flag in kubectl (for apply), even though the
value is defaulted in kubectl with "kubectl".

The flag is required for Apply patch-type, and optional for other PATCH,
CREATE and UPDATE (in which case we fallback on the user-agent).

Kubernetes-commit: eb904d8fa89da491f400614f99458ed3f0d529fb
2019-02-16 20:16:11 -08:00
Kevin Wiesmüller 485fbb474e test that managedFields get stripped recursively
Kubernetes-commit: 8a6a2883f9a38e09ae941b62c14f4e68037b2d21
2019-02-26 20:22:54 +01:00
Kevin Wiesmüller 14b16dd3e2 remove deletionTimestamp from strippedFields
Kubernetes-commit: d73dbfc8c1bdc443cf6bf2f70a7789b689815cf7
2019-02-26 20:22:30 +01:00
Kevin Wiesmüller 752a6fcdc7 add tests for new stripped fields and cleanup test
Kubernetes-commit: 89f4f9d4bfe5dd14a11e94ff13b1efa676a2d59f
2019-02-23 12:54:33 +01:00
Kevin Wiesmüller 00e253c3da hardcode time
Kubernetes-commit: 332bb15476ed6f7ef0b55a5a3a3a735b915ccee3
2019-02-19 20:17:33 +01:00
Kevin Wiesmüller 0faeae1509 rename mocks to fakes and add nil check
Kubernetes-commit: 96d4fa7e4678430046d8fee98bc715f385242e3f
2019-02-19 19:13:49 +01:00
Kevin Wiesmüller 84fe2e0447 add fieldmanager tests for stripFields
Kubernetes-commit: 2f8e8fa3af4b8adce5562dd1a033fd37ea8244d8
2019-02-18 11:44:07 +01:00