Server Side Apply and CRD's

562 views
Skip to first unread message

Joji Mekkatt

unread,
Jan 13, 2020, 5:09:34 PM1/13/20
to kubernetes-wg-apply
I have a CRD that has two status fields, managed asynchronously by two components.

e.g.   MyCRDStatus {
              Status1 structA    // managed by Component 1
              Status2 structB   // managed by Component 2
         }

Is there a way to use server side apply so the two components can update Status1 and Status2 without overwriting each other? Will appreciate any pointers.

Thanks,
Joji


Daniel Smith

unread,
Jan 13, 2020, 5:16:25 PM1/13/20
to Joji Mekkatt, kubernetes-wg-apply
It should "just work";

* Use a PATCH verb with the right content type ("application/apply-patch+yaml")
* Send a yaml or json body and make sure only the fields you want to manage are present
* Use the ?force=true, since it's a controller



--
You received this message because you are subscribed to the Google Groups "kubernetes-wg-apply" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-wg-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-wg-apply/8debabef-ab41-4658-b8c1-b200e96fc7fc%40googlegroups.com.

Joji Mekkatt

unread,
Jan 13, 2020, 5:52:37 PM1/13/20
to kubernetes-wg-apply
Thank you! One clarification. I am using a json body. Should I still be using PatchType = "application/apply-patch+yaml"?
Or should it be PatchType = "application/json-patch+json"

Thanks,
Joji

On Monday, January 13, 2020 at 2:16:25 PM UTC-8, Daniel Smith wrote:
It should "just work";

* Use a PATCH verb with the right content type ("application/apply-patch+yaml")
* Send a yaml or json body and make sure only the fields you want to manage are present
* Use the ?force=true, since it's a controller



On Mon, Jan 13, 2020 at 2:09 PM Joji Mekkatt <joj...@gmail.com> wrote:
I have a CRD that has two status fields, managed asynchronously by two components.

e.g.   MyCRDStatus {
              Status1 structA    // managed by Component 1
              Status2 structB   // managed by Component 2
         }

Is there a way to use server side apply so the two components can update Status1 and Status2 without overwriting each other? Will appreciate any pointers.

Thanks,
Joji


--
You received this message because you are subscribed to the Google Groups "kubernetes-wg-apply" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-wg-apply+unsub...@googlegroups.com.

Daniel Smith

unread,
Jan 13, 2020, 6:03:26 PM1/13/20
to Joji Mekkatt, kubernetes-wg-apply
Since YAML is a superset of JSON (surprising but true!), IIRC we just made it "application/apply-patch+yaml" for both.

Let us know how it goes!

On Mon, Jan 13, 2020 at 2:52 PM Joji Mekkatt <joj...@gmail.com> wrote:
Thank you! One clarification. I am using a json body. Should I still be using PatchType = "application/apply-patch+yaml"?
Or should it be PatchType = "application/json-patch+json"

Thanks,
Joji

On Monday, January 13, 2020 at 2:16:25 PM UTC-8, Daniel Smith wrote:
It should "just work";

* Use a PATCH verb with the right content type ("application/apply-patch+yaml")
* Send a yaml or json body and make sure only the fields you want to manage are present
* Use the ?force=true, since it's a controller



On Mon, Jan 13, 2020 at 2:09 PM Joji Mekkatt <joj...@gmail.com> wrote:
I have a CRD that has two status fields, managed asynchronously by two components.

e.g.   MyCRDStatus {
              Status1 structA    // managed by Component 1
              Status2 structB   // managed by Component 2
         }

Is there a way to use server side apply so the two components can update Status1 and Status2 without overwriting each other? Will appreciate any pointers.

Thanks,
Joji


--
You received this message because you are subscribed to the Google Groups "kubernetes-wg-apply" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-wg-a...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "kubernetes-wg-apply" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-wg-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-wg-apply/94f41516-91f1-409d-9c90-5c7d5af5fd80%40googlegroups.com.

Joji Mekkatt

unread,
Jan 13, 2020, 9:07:02 PM1/13/20
to Daniel Smith, kubernetes-wg-apply
I get this error.

PatchOptions.meta.k8s.io \"\" is invalid: fieldManager: Required value: is required for apply patch

I don't see a way to pass this in the client API (version 1.13). Am I supposed to use a different version? Or is there a different way to pass this option?

Daniel Smith

unread,
Jan 14, 2020, 12:27:01 PM1/14/20
to Joji Mekkatt, kubernetes-wg-apply
Ah, you probably need to use a newer client-go version. The PatchOptions type has that option (and one for Force which you also need to set): https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#PatchOptions
Reply all
Reply to author
Forward
0 new messages