Commit Graph

49 Commits

Author SHA1 Message Date
Antoine Pelisse b02ebf4b97 Make internal managers private
This significantly reduces the surface area of the fieldmanager package
by hiding all the private "managers" objects, as well as the interface
that was made specifically for these. There is no reason to configure
these.

Kubernetes-commit: adfc65ec23292ebd95d96727654acd8e8e0452a5
2022-12-12 14:07:13 -08:00
Andrew Sy Kim 3f92018a06 apiserver: use the correct error when logging errors updating managedFields
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: efdd06718646fc7e8912f8aaa8fc7bef3f7cdba0
2022-11-07 23:00:58 -05:00
Alexander Zielenski e2b596449a remove mutation of liveObj in fieldManager.Apply
also document manager interface

Kubernetes-commit: 0963704178200365897390d1834615b30fac9b01
2021-11-09 11:40:20 -08:00
Dr. Stefan Schimanski 5210be757e server-side-apply: print object name in SHOULD NOT HAPPEN message
Kubernetes-commit: dc6f471e2cceb7aebb62fe2e4bd7c9ce53df6ff0
2021-09-06 08:35:47 +02: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
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
Kevin Wiesmueller f9c68c0e80 export and cleanup managedFields decoding
Kubernetes-commit: 589ca1be1c9e75b1730feacd1af6e2c817f693ac
2021-02-26 17:47:52 +01:00
lala123912 5d990a9e20 staging\src\k8s.io\apiserver\pkg\endpoints:migrate to structured logs
Kubernetes-commit: 12076ff3e587be00f1ef52e546fa3a3a85d41e7b
2021-01-15 15:23:55 +08: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
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 cc0f41ad59 fieldManager: Ignore and log all errors when updating managedFields
Kubernetes-commit: 5378a788e471a18594c446888306d826d3b44661
2020-05-08 12:48:09 -07:00
Antoine Pelisse 5de3b6339e fieldmanager: Move ManagedFields update logic into its own class
Kubernetes-commit: 39681aa5800492b8e4b4ff5fb82e034376864a37
2020-03-05 10:01:37 -08:00
Antoine Pelisse 07f3bde07d Enable field management for all new objects
Kubernetes-commit: a54a52c5de3458bfa5dbe1973d12584f59a5581c
2020-02-10 09:06:18 -08:00
Jordan Liggitt 51a2cc34eb Lower server-side apply percentage to 10%
Kubernetes-commit: a657d51ce35eb3886a56ed710805cd68732461ee
2020-02-11 09:15:12 -05:00
Antoine Pelisse 3104ef647b Enable field management for all new objects
Kubernetes-commit: 8438bba5fd911c4674e46519228e6c47b5057346
2020-02-10 09:06:18 -08:00
jennybuckley 605316fae2 Re-enable apply for 50% of requests
Kubernetes-commit: 9b679748239faa4d01f13c32af1956ffdbfff9aa
2020-01-23 11:27:20 -08:00
jennybuckley 49d583f0ef Update Structured Merge Diff to V3
Kubernetes-commit: b33fbc84d9d6e7033c36fa3bc321b8fea28ceed6
2020-01-21 15:03:56 -08:00
Jordan Liggitt 223f76bd7a Set managedField probability to 0%
Lowers probability of managedField population on create/update to 0%
until serialization/normalization issues are resolved

Kubernetes-commit: ba23aa98f6574bd1f9781f0d3e61d0496f16fc53
2020-01-14 14:47:35 -05:00
Jennifer Buckley 2ac09e3ec3 Update fieldmanager.go
Kubernetes-commit: 4db3822ebbac30248463eb529d88176f8b258fd9
2020-01-10 11:15:06 -08:00
jennybuckley d516617523 create probabilistic SkipNonAppliedManager
Kubernetes-commit: 6cab3a7bec75e42581e8041395c3ceaa14e07c74
2020-01-09 14:15:34 -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 72d976a445 Cap the number of managedFields entries for updates at 10
Kubernetes-commit: 61b19c729892a150b61dde19359f6fb19e8d61f1
2019-09-26 12:53:28 -07:00
jennybuckley 49914e3423 Refactor fieldmanager to be more modular
Kubernetes-commit: d72260b9dad186d96aa621dc8594ca9bd6088937
2019-09-19 13:14:36 -07:00
Jordan Liggitt f7fbf2eee4 Limit YAML/JSON decode size
Kubernetes-commit: 8ef4566cefebf49f9a806a36df2105c9149785a1
2019-09-27 16:36:48 -04:00
Antoine Pelisse 3e0b6a7493 Apply current parses the yaml object 3 times
This is super expensive and not needed at all since we don't have to
reparse the entire object. Remove all allocations but the first one.

Kubernetes-commit: 31c644a1e79c685b52683ed1e84964186a37f3ff
2019-09-25 12:38:38 -07:00
jennybuckley 6c75819b84 Split fieldmanager with interface
Kubernetes-commit: 2c67bf47db8557b6481a5181bdae924e91665988
2019-09-12 10:57:21 -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 350fef76f5 Only update managedFields on update if it already exists
Kubernetes-commit: 9a12e37a6dc28fd1d209eb84c210eb0723e6e38f
2019-06-05 14:09:08 -07:00
jennybuckley dcedf932c2 Make sure no op updates don't affect the resource version
Kubernetes-commit: aa1f01ec7e6ebf29444b93de7c3cb65a1a54d47e
2019-08-20 15:09:42 -07:00
jennybuckley 427507ed32 Group update managedFieldsEntries by manager name
Kubernetes-commit: 87eabcdbfa5d551af7ebcae3fb07fd8f386badc3
2019-08-19 13:50:15 -07:00
jennybuckley 6d17cee146 Make changes to integrate new version
Kubernetes-commit: 229894c730c70d39992b27fe3ef98968b2a3fbff
2019-07-08 16:32:03 -07:00
jennybuckley 5751866f63 apiserver: make changes to integrate new structured-merge-patch
Kubernetes-commit: bd333e3ac7f84c33abebc7d55a8c581743d891f7
2019-07-08 16:32:03 -07:00
Antoine Pelisse 2d27d30e4d fieldManager: Ignore conversion errors to internal types
Errors on updates are bad because they usually come from controllers and
it's very hard to take actions on them. We also don't want to start
breaking kubernetes clusters if something in a schema happens a way we
didn't foresee (even though we've tried to be diligent and test as much
as possible, these can still happen).

Log an identifiable error when they happen. Ideally people can look in
the logs to find these and report them, or providers can look for these
in logs and make sure they don't happen.

Only conversion to internal types are going to be logged and ignored.

It means that we're still failing for:
- Version conversions. If we can't convert the object from one version
  to another,
- Unions. If we can't normalize the union,
- Invalid MangedFields sent in the object. If something has changed the
  ManagedFields to an invalid value.
- Failure to serialize the manager information, this really shouldn't
  happen.
- Encoding the ManagedFields

Kubernetes-commit: 4e32d183d0257c9f6c7f8342d1f9aa7f28458f2f
2019-05-16 11:07:47 -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
jennybuckley 2deaad0322 Fix version converter
Kubernetes-commit: f9e57744d3e760b1473cb22e655d20c254af03b6
2019-03-07 17:44:21 -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 14b16dd3e2 remove deletionTimestamp from strippedFields
Kubernetes-commit: d73dbfc8c1bdc443cf6bf2f70a7789b689815cf7
2019-02-26 20:22:30 +01:00
Kevin Wiesmüller a0ddba7a54 add more fields to be stripped from managedFields
Kubernetes-commit: 78ba7fa05c4360e217af3854c5ae5ba4e823312f
2019-02-17 22:35:15 +01:00
jennybuckley ddd6f48420 Make apply conflict errors more readable
Kubernetes-commit: 69b9167dcbc8eea2ca5653fa42584539920a1fd4
2019-02-12 15:16:19 -08:00
Kevin Wiesmüller fa595d7437 strip selected fields from managedFields
refactor fieldstrip and update tests

add checks and remove empty fields

shorten test and check for nil manager

fix gofmt

panic on nil manager

Kubernetes-commit: 9082cac48240ebc316015dabb466e5b24a113dc1
2019-02-03 22:22:10 +01:00
jennybuckley f279314dc7 Minor fixes
Kubernetes-commit: 6b2e4682fe883eebcaf1c1e43cf2957dde441174
2019-02-01 11:55:18 -08:00
Antoine Pelisse d1a2d7fd8d Plugin FieldManager in CRD handler, change to API
Kubernetes-commit: b55417f429353e1109df8b3bfa2afc8dbd9f240b
2019-01-29 14:24:52 -08:00
Antoine Pelisse 337fc9ccde API Machinery, Kubectl and tests
Kubernetes-commit: 0e1d50e70fdc9ed838d75a7a1abbe5fa607d22a1
2019-01-16 21:14:42 -08:00