You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kube/src/api/params.rs
+35-3Lines changed: 35 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -144,9 +144,41 @@ impl PostParams {
144
144
145
145
/// Describes changes that should be applied to a resource
146
146
///
147
-
/// For all strategies except `Json`, patch can be represented with arbitrary
148
-
/// serializable value, such as `serde_json::Value`. You may also want to use
149
-
/// a `k8s-openapi` definition for the resource for the better type safety.
147
+
/// Takes arbitrary serializable data for all strategies except `Json`.
148
+
///
149
+
/// We recommend using ([server-side](https://kubernetes.io/blog/2020/04/01/kubernetes-1.18-feature-server-side-apply-beta-2)) `Apply` patches on new kubernetes releases.
150
+
///
151
+
/// See [kubernetes patch docs](https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment) for the older patch types.
152
+
///
153
+
/// Note that patches have different effects on different fields depending on their [merge-strategies](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy).
154
+
/// These strategies are configurable when deriving your [`CustomResource`](kube_derive::CustomResource).
155
+
///
156
+
/// # Creating a patch via serde_json
157
+
/// ```
158
+
/// use kube::api::Patch;
159
+
/// let patch = serde_json::json!({
160
+
/// "apiVersion": "v1",
161
+
/// "kind": "Pod",
162
+
/// "metadata": {
163
+
/// "name": "blog"
164
+
/// },
165
+
/// "spec": {
166
+
/// "activeDeadlineSeconds": 5
167
+
/// }
168
+
/// });
169
+
/// let patch = Patch::Apply(&patch);
170
+
/// ```
171
+
/// # Creating a patch from a type
172
+
/// ```
173
+
/// use kube::api::Patch;
174
+
/// use k8s_openapi::api::rbac::v1::Role;
175
+
/// use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
0 commit comments