Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fieldManager querystring to all operations #1031

Merged
merged 2 commits into from Sep 27, 2022

Conversation

goenning
Copy link
Contributor

@goenning goenning commented Sep 26, 2022

Motivation

Not too sure if the fieldManager was intentionally not set or just forgotten, but the *Params struct accepted a field_manager and never used it. I noticed this when I used the replace function with a PostParams that had field_manager set, but the resulting YAML after the update had unknown on the manager field, instead of the name of my app.

Solution

set the fieldManager for create/update/replace operations just like patch does.

Signed-off-by: goenning <me@goenning.net>
@clux
Copy link
Member

clux commented Sep 26, 2022

Hm, it's possible this is an oversight. Does this actually do something upstream? The older replace and create methods are not what the fieldManager feature was made for, and it's only required for .patch with the Apply patch type AFAIKR.

@goenning
Copy link
Contributor Author

It does, I pulled this branch on my app and updated the name1 property with get+replace, this was the result (note the manager: aptakube). On kube-rs 0.74, this used to be manager: unknown

apiVersion: v1
data:
  name1: HelloKube2
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: >
      {"apiVersion":"v1","data":{"name":"HelloKube"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"hellokube-cfg","namespace":"default"}}
  creationTimestamp: '2022-09-26T19:22:42Z'
  managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:data: {}
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: '2022-09-26T19:22:42Z'
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:data:
          f:name1: {}
      manager: aptakube
      operation: Update
      time: '2022-09-26T20:35:45Z'
  name: hellokube-cfg
  namespace: default
  resourceVersion: '34746487'
  uid: 41525102-088d-43a0-974f-81d9729f23eb

I also checked the API docs ( https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/ ) and you can see that all PUT/POST operations also accept a fieldManager query string

@clux clux added the changelog-fix changelog fix category for prs label Sep 26, 2022
@clux clux added this to the 0.76.0 milestone Sep 26, 2022
kube-core/src/request.rs Outdated Show resolved Hide resolved
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor q/suggestion, but am happy to add this in.

@clux clux merged commit de7afa5 into kube-rs:main Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-fix changelog fix category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants