Skip to content

Commit 11185cc

Browse files
committed
Merge branch 'main' into feat/sso-auth-classes
2 parents 2918d85 + 4a1de5e commit 11185cc

11 files changed

+99
-19
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ All notable changes to this project will be documented in this file.
2121

2222
[#680]: https://github.com/stackabletech/operator-rs/pull/680
2323

24+
## [0.56.2] - 2023-11-23
25+
26+
### Added
27+
28+
- More documentation for CRD structs ([#687]).
29+
30+
[#687]: https://github.com/stackabletech/operator-rs/pull/687
31+
2432
## [0.56.1] - 2023-11-23
2533

2634
### Changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.56.1"
2+
version = "0.56.2"
33
authors = ["Stackable GmbH <[email protected]>"]
44
license = "Apache-2.0"
55
edition = "2021"

src/commons/affinity.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use crate::{
1818

1919
pub const TOPOLOGY_KEY_HOSTNAME: &str = "kubernetes.io/hostname";
2020

21+
/// These configuration settings control
22+
/// [Pod placement](https://docs.stackable.tech/home/nightly/concepts/operations/pod_placement).
2123
#[derive(Clone, Debug, Default, Deserialize, Fragment, JsonSchema, PartialEq, Serialize)]
2224
#[fragment(path_overrides(fragment = "crate::config::fragment"))]
2325
#[fragment_attrs(

src/commons/cluster_operation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use schemars::JsonSchema;
22
use serde::{Deserialize, Serialize};
33

4+
/// [Cluster operations](https://docs.stackable.tech/home/nightly/concepts/operations/cluster_operations)
5+
/// properties, allow stopping the product instance as well as pausing reconciliation.
46
#[derive(Clone, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
57
#[serde(rename_all = "camelCase")]
68
pub struct ClusterOperation {

src/commons/opa.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,17 @@ impl OpaApiVersion {
7373
}
7474
}
7575

76+
/// Configure the OPA stacklet [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery)
77+
/// and the name of the Rego package containing your authorization rules.
78+
/// Consult the [OPA authorization documentation](https://docs.stackable.tech/home/nightly/concepts/opa)
79+
/// to learn how to deploy Rego authorization rules with OPA.
7680
#[derive(Clone, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
7781
#[serde(rename_all = "camelCase")]
7882
pub struct OpaConfig {
83+
/// The [discovery ConfigMap](https://docs.stackable.tech/home/nightly/concepts/service_discovery)
84+
/// for the OPA stacklet that should be used for authorization requests.
7985
pub config_map_name: String,
86+
/// The name of the Rego package containing the Rego rules for the product.
8087
pub package: Option<String>,
8188
}
8289

src/commons/pdb.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ use schemars::JsonSchema;
22
use serde::{Deserialize, Serialize};
33

44
/// This struct is used to configure:
5-
/// 1.) If PodDisruptionBudgets are created by the operator
6-
/// 2.) The allowed number of Pods to be unavailable (`maxUnavailable`)
5+
///
6+
/// 1. If PodDisruptionBudgets are created by the operator
7+
/// 2. The allowed number of Pods to be unavailable (`maxUnavailable`)
8+
///
9+
/// Learn more in the
10+
/// [allowed Pod disruptions documentation](https://docs.stackable.tech/home/nightly/concepts/operations/pod_disruptions).
711
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
812
#[serde(rename_all = "camelCase")]
913
pub struct PdbConfig {

src/commons/product_image_selection.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@ use crate::labels::get_recommended_labels;
99

1010
pub const STACKABLE_DOCKER_REPO: &str = "docker.stackable.tech/stackable";
1111

12+
/// Specify which image to use, the easiest way is to only configure the `productVersion`.
13+
/// You can also configure a custom image registry to pull from, as well as completely custom
14+
/// images.
15+
///
16+
/// Consult the [Product image selection documentation](https://docs.stackable.tech/home/nightly/concepts/product_image_selection)
17+
/// for details.
1218
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
1319
#[serde(rename_all = "camelCase")]
1420
pub struct ProductImage {
1521
#[serde(flatten)]
1622
image_selection: ProductImageSelection,
1723

1824
#[serde(default)]
19-
/// [Pull policy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) used when pulling the Images
25+
/// [Pull policy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) used when pulling the image.
2026
pull_policy: PullPolicy,
2127

22-
/// [Image pull secrets](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) to pull images from a private registry
28+
/// [Image pull secrets](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) to pull images from a private registry.
2329
pull_secrets: Option<Vec<LocalObjectReference>>,
2430
}
2531

src/commons/resources.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ use strum::Display;
9090
pub const LIMIT_REQUEST_RATIO_CPU: f32 = 5.0;
9191
pub const LIMIT_REQUEST_RATIO_MEMORY: f32 = 1.0;
9292

93-
// This struct allows specifying memory and cpu limits as well as generically adding storage
94-
// settings.
93+
/// Resource usage is configured here, this includes CPU usage, memory usage and disk storage
94+
/// usage, if this role needs any.
9595
#[derive(Clone, Debug, Default, Fragment, PartialEq, JsonSchema)]
9696
#[fragment(
9797
bound = "T: FromFragment, K: FromFragment",
@@ -158,10 +158,14 @@ pub struct Resources<T, K = NoRuntimeLimits> {
158158
schemars(bound = "T: JsonSchema, T::Fragment: JsonSchema + Default")
159159
)]
160160
pub struct MemoryLimits<T> {
161-
// The maximum amount of memory that should be available
162-
// Should in most cases be mapped to resources.limits.memory
161+
/// The maximum amount of memory that should be available to the Pod.
162+
/// Specified as a byte [Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/),
163+
/// which means these suffixes are supported: E, P, T, G, M, k.
164+
/// You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki.
165+
/// For example, the following represent roughly the same value:
166+
/// `128974848, 129e6, 129M, 128974848000m, 123Mi`
163167
pub limit: Option<Quantity>,
164-
// Additional options that may be required
168+
/// Additional options that can be specified.
165169
#[fragment_attrs(serde(default))]
166170
pub runtime_limits: T,
167171
}
@@ -211,8 +215,6 @@ pub struct JvmHeapLimits {
211215
pub min: Option<Quantity>,
212216
}
213217

214-
// Cpu limits
215-
// These should usually be forwarded to resources.limits.cpu
216218
#[derive(Clone, Debug, Default, Fragment, PartialEq, JsonSchema)]
217219
#[fragment(path_overrides(fragment = "crate::config::fragment"))]
218220
#[fragment_attrs(
@@ -230,7 +232,15 @@ pub struct JvmHeapLimits {
230232
serde(rename_all = "camelCase")
231233
)]
232234
pub struct CpuLimits {
235+
/// The minimal amount of CPU cores that Pods need to run.
236+
/// Equivalent to the `request` for Pod resource configuration.
237+
/// Cores are specified either as a decimal point number or as milli units.
238+
/// For example:`1.5` will be 1.5 cores, also written as `1500m`.
233239
pub min: Option<Quantity>,
240+
/// The maximum amount of CPU cores that can be requested by Pods.
241+
/// Equivalent to the `limit` for Pod resource configuration.
242+
/// Cores are specified either as a decimal point number or as milli units.
243+
/// For example:`1.5` will be 1.5 cores, also written as `1500m`.
234244
pub max: Option<Quantity>,
235245
}
236246

src/commons/s3.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ use crate::{
3333
)]
3434
#[serde(rename_all = "camelCase")]
3535
pub struct S3BucketSpec {
36+
/// The name of the S3 bucket.
3637
// FIXME: Try to remove the Option<>, as this field should be mandatory
3738
#[serde(default, skip_serializing_if = "Option::is_none")]
3839
pub bucket_name: Option<String>,
40+
41+
/// The definition of an S3 connection, either inline or as a reference.
3942
// FIXME: Try to remove the Option<>, as this field should be mandatory
4043
#[serde(default, skip_serializing_if = "Option::is_none")]
4144
pub connection: Option<S3ConnectionDef>,
@@ -91,11 +94,17 @@ impl InlinedS3BucketSpec {
9194
}
9295
}
9396

94-
/// Operators are expected to define fields for this type in order to work with S3 buckets.
97+
/// An S3 bucket definition, it can either be a reference to an explicit S3Bucket object,
98+
/// or it can be an inline defintion of a bucket. Read the
99+
/// [S3 resources concept documentation](https://docs.stackable.tech/home/nightly/concepts/s3)
100+
/// to learn more.
95101
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
96102
#[serde(rename_all = "camelCase")]
97103
pub enum S3BucketDef {
104+
/// An inline definition, containing the S3 bucket properties.
98105
Inline(S3BucketSpec),
106+
/// A reference to an S3 bucket object. This is simply the name of the `S3Bucket`
107+
/// resource.
99108
Reference(String),
100109
}
101110

@@ -122,7 +131,9 @@ impl S3BucketDef {
122131
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
123132
#[serde(rename_all = "camelCase")]
124133
pub enum S3ConnectionDef {
134+
/// Inline definition of an S3 connection.
125135
Inline(S3ConnectionSpec),
136+
/// A reference to an S3Connection resource.
126137
Reference(String),
127138
}
128139

@@ -160,24 +171,28 @@ impl S3ConnectionDef {
160171
)]
161172
#[serde(rename_all = "camelCase")]
162173
pub struct S3ConnectionSpec {
174+
/// Hostname of the S3 server without any protocol or port. For example: `west1.my-cloud.com`.
163175
// FIXME: Try to remove the Option<>, as this field should be mandatory
164-
/// Hostname of the S3 server without any protocol or port
165176
#[serde(default, skip_serializing_if = "Option::is_none")]
166177
pub host: Option<String>,
178+
167179
/// Port the S3 server listens on.
168-
/// If not specified the products will determine the port to use.
180+
/// If not specified the product will determine the port to use.
169181
#[serde(default, skip_serializing_if = "Option::is_none")]
170182
pub port: Option<u16>,
183+
171184
// FIXME: Try to remove the Option<>, as this field should be mandatory
172185
/// Which access style to use.
173186
/// Defaults to virtual hosted-style as most of the data products out there.
174-
/// Have a look at the official documentation on <https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html>
187+
/// Have a look at the [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html).
175188
#[serde(default, skip_serializing_if = "Option::is_none")]
176189
pub access_style: Option<S3AccessStyle>,
190+
177191
/// If the S3 uses authentication you have to specify you S3 credentials.
178192
/// In the most cases a SecretClass providing `accessKey` and `secretKey` is sufficient.
179193
#[serde(default, skip_serializing_if = "Option::is_none")]
180194
pub credentials: Option<SecretClassVolume>,
195+
181196
/// If you want to use TLS when talking to S3 you can enable TLS encrypted communication with this setting.
182197
#[serde(default, skip_serializing_if = "Option::is_none")]
183198
pub tls: Option<Tls>,

src/product_logging/spec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ use serde::{Deserialize, Serialize};
6868
rename_all = "camelCase",
6969
),
7070
// We don't want Rust code in public API descriptions
71-
schemars(description = "Logging configuration")
71+
schemars(description = "Logging configuration, learn more in the [logging concept documentation](https://docs.stackable.tech/home/nightly/concepts/logging).")
7272
)]
7373
pub struct Logging<T>
7474
where
7575
T: Clone + Display + Ord,
7676
{
77-
/// Wether or not to deploy a container with the Vector log agent
77+
/// Wether or not to deploy a container with the Vector log agent.
7878
pub enable_vector_agent: bool,
79-
/// Log configuration per container
79+
/// Log configuration per container.
8080
#[fragment_attrs(serde(default))]
8181
pub containers: BTreeMap<T, ContainerLogConfig>,
8282
}

src/role_utils.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,39 @@ pub struct CommonConfiguration<T> {
113113
// does not support specifying custom bounds.
114114
#[schemars(default = "config_schema_default")]
115115
pub config: T,
116+
/// The `configOverrides` can be used to configure properties in product config files
117+
/// that are not exposed in the CRD. For example, for a HdfsCluster:
118+
///
119+
/// ```yaml
120+
/// configOverrides: # on role level
121+
/// core-site.xml: # the name of the configuration file
122+
/// fs.trash.interval: "5" # the name of the property and the value to set
123+
/// ```
124+
///
125+
/// Read the
126+
/// [config overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#config-overrides)
127+
/// and consult the operator specific usage guide documentation for details on the
128+
/// available config files and settings for the specific product.
116129
#[serde(default)]
117130
pub config_overrides: HashMap<String, HashMap<String, String>>,
131+
/// `envOverrides` configure environment variables to be set in the Pods.
132+
/// It is a map from strings to strings - environment variables and the value to set.
133+
/// Read the
134+
/// [environment variable overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#env-overrides)
135+
/// for more information and consult the operator specific usage guide to find out about
136+
/// the product specific environment variables that are available.
118137
#[serde(default)]
119138
pub env_overrides: HashMap<String, String>,
120139
// BTreeMap to keep some order with the cli arguments.
140+
// TODO add documentation.
121141
#[serde(default)]
122142
pub cli_overrides: BTreeMap<String, String>,
143+
/// In the `podOverrides` property you can define a
144+
/// [PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core)
145+
/// to override any property that can be set on a Kubernetes Pod.
146+
/// Read the
147+
/// [Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides)
148+
/// for more information.
123149
#[serde(default)]
124150
#[schemars(schema_with = "pod_overrides_schema")]
125151
pub pod_overrides: PodTemplateSpec,

0 commit comments

Comments
 (0)