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-derive/src/lib.rs
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ mod custom_resource;
70
70
///
71
71
/// ### `#[kube(apiextensions = "v1beta1")]`
72
72
/// The version for `CustomResourceDefinition` desired in the `apiextensions.k8s.io` group.
73
-
/// Default is `v1` (for clusters >= 1.17). If using kubernetes <= 1.16 pluase use `v1beta1`.
73
+
/// Default is `v1` (for clusters >= 1.17). If using kubernetes <= 1.16 please use `v1beta1`.
74
74
///
75
75
/// **NOTE**: Support for `v1` requires deriving the openapi v3 `JsonSchema` via the `schemars` dependency.
76
76
///
@@ -150,6 +150,18 @@ mod custom_resource;
150
150
/// }
151
151
/// ```
152
152
///
153
+
/// ## Customizing Schemas
154
+
/// Should you need to customize the schemas, you can use:
155
+
/// - [Serde/Schemars Attributes](https://graham.cool/schemars/examples/3-schemars_attrs/) (no need to duplicate serde renames)
156
+
/// - [`#[schemars(schema_with = "func")]`](https://graham.cool/schemars/examples/7-custom_serialization/) (e.g. like in the [`crd_derive` example](https://github.com/clux/kube-rs/blob/master/examples/crd_derive.rs))
157
+
///
158
+
/// In general, you will need to override parts of the schemas (for fields in question) when you are:
159
+
/// - **using enums**: enums do not currently generate [structural schemas](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema), so kubernetes won't support them by default
160
+
/// - **customizing [merge-strategies](https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy)** (e.g. like in the [`crd_derive_schema` example](https://github.com/clux/kube-rs/blob/master/examples/crd_derive_schema.rs))
161
+
/// - **customizing [certain kubebuilder like validation rules](https://github.com/clux/kube-rs/issues/129#issuecomment-749463718)** (tail the issue for state of affairs)
162
+
///
163
+
/// If you have to override a lot, [you can opt-out of schema-generation entirely](https://github.com/clux/kube-rs/issues/355#issuecomment-751253657)
164
+
///
153
165
/// ## Debugging
154
166
/// Try `cargo-expand` to see your own macro expansion.
Copy file name to clipboardExpand all lines: kube/src/api/params.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -150,8 +150,8 @@ impl PostParams {
150
150
///
151
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
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).
153
+
/// Note that patches have different effects on different fields depending on their mergestrategies.
154
+
/// These strategies are configurable when deriving your [`CustomResource`](kube_derive::CustomResource#customizing-schemas).
0 commit comments