Skip to content

Commit 68afc57

Browse files
doc: Fix references
1 parent 53d0529 commit 68afc57

16 files changed

Lines changed: 78 additions & 68 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Controller for `v1alpha1::OpenSearchCluster`
1+
//! Controller for [`v1alpha1::OpenSearchCluster`]
22
//!
33
//! The cluster specification is validated, Kubernetes resource specifications are created and
44
//! applied and the cluster status is updated.
@@ -46,7 +46,7 @@ mod validate;
4646

4747
/// Names in the controller context which are passed to the submodules of the controller
4848
///
49-
/// The names are not directly defined in `Context` because not every submodule requires a
49+
/// The names are not directly defined in [`Context`] because not every submodule requires a
5050
/// Kubernetes client and unit testing is easier without an unnecessary client.
5151
pub struct ContextNames {
5252
pub product_name: ProductName,
@@ -123,7 +123,7 @@ type OpenSearchRoleGroupConfig =
123123
type OpenSearchNodeResources =
124124
stackable_operator::commons::resources::Resources<v1alpha1::StorageConfig>;
125125

126-
/// The validated `v1alpha1::OpenSearchConfig`.
126+
/// The validated [`v1alpha1::OpenSearchConfig`]
127127
#[derive(Clone, Debug, PartialEq)]
128128
pub struct ValidatedOpenSearchConfig {
129129
pub affinity: StackableAffinity,
@@ -133,14 +133,14 @@ pub struct ValidatedOpenSearchConfig {
133133
pub listener_class: String,
134134
}
135135

136-
/// The validated `v1alpha1::OpenSearchCluster`
136+
/// The validated [`v1alpha1::OpenSearchCluster`]
137137
///
138138
/// Validated means that there should be no reason for Kubernetes to reject resources generated
139139
/// from these values. This is usually achieved by using fail-safe types. For instance, the cluster
140-
/// name is wrapped in the type `ClusterName`. This type implements e.g. the function
141-
/// `ClusterName::to_label_value` which returns a valid label value as string. If this function is
142-
/// used as intended, i.e. to set a label value, and if it is used as late as possible in the call
143-
/// chain, then chances are high that the resulting Kubernetes resource is valid.
140+
/// name is wrapped in the type [`ClusterName`]. This type implements e.g. the function
141+
/// [`ClusterName::to_label_value`] which returns a valid label value as string. If this function
142+
/// is used as intended, i.e. to set a label value, and if it is used as late as possible in the
143+
/// call chain, then chances are high that the resulting Kubernetes resource is valid.
144144
#[derive(Clone, Debug, PartialEq)]
145145
pub struct ValidatedCluster {
146146
metadata: ObjectMeta,
@@ -275,7 +275,7 @@ pub fn error_policy(
275275
/// Reconcile function of the OpenSearchCluster controller
276276
///
277277
/// The reconcile function performs the following steps:
278-
/// 1. Validate the given cluster specification and return a `ValidatedCluster` if successful.
278+
/// 1. Validate the given cluster specification and return a [`ValidatedCluster`] if successful.
279279
/// 2. Build Kubernetes resource specifications from the validated cluster.
280280
/// 3. Apply the Kubernetes resource specifications
281281
/// 4. Update the cluster status
@@ -330,8 +330,8 @@ struct Applied;
330330

331331
/// List of all Kubernetes resources produced by this controller
332332
///
333-
/// `T` is a marker that indicates if these resources are only `Prepared` or already `Applied`. The
334-
/// marker is useful e.g. to ensure that the cluster status is updated based on the applied
333+
/// `T` is a marker that indicates if these resources are only [`Prepared`] or already [`Applied`].
334+
/// The marker is useful e.g. to ensure that the cluster status is updated based on the applied
335335
/// resources.
336336
struct KubernetesResources<T> {
337337
stateful_sets: Vec<StatefulSet>,

rust/operator-binary/src/controller/apply.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Result<T, E = Error> = std::result::Result<T, E>;
3131
/// Applier for the Kubernetes resource specifications produced by this controller
3232
///
3333
/// The implementation is not tied to this controller and could theoretically be moved to
34-
/// stackable_operator if `KubernetesResources` would contain all possible resource types.
34+
/// stackable_operator if [`KubernetesResources`] would contain all possible resource types.
3535
pub struct Applier<'a> {
3636
client: &'a Client,
3737
cluster_resources: ClusterResources,

rust/operator-binary/src/controller/build/node_config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl NodeConfig {
136136
== Some(true)
137137
}
138138

139-
/// Converts the given JSON value to `bool` if possible
139+
/// Converts the given JSON value to [`bool`] if possible
140140
pub fn value_as_bool(value: &Value) -> Option<bool> {
141141
value.as_bool().or(
142142
// OpenSearch parses the strings "true" and "false" as boolean, see
@@ -154,7 +154,7 @@ impl NodeConfig {
154154
pub fn environment_variables(&self) -> EnvVarSet {
155155
EnvVarSet::new()
156156
// Set the OpenSearch node name to the Pod name.
157-
// The node name is used e.g. for `{INITIAL_CLUSTER_MANAGER_NODES}`.
157+
// The node name is used e.g. for INITIAL_CLUSTER_MANAGER_NODES.
158158
.with_field_path(
159159
EnvVarName::from_str_unsafe(CONFIG_OPTION_NODE_NAME),
160160
FieldPathEnvVar::Name,
@@ -189,9 +189,9 @@ impl NodeConfig {
189189
.join("\n")
190190
}
191191

192-
/// Configuration for `{DISCOVERY_TYPE}`
192+
/// Configuration for `discovery.type`
193193
///
194-
/// "zen" is the default if `{DISCOVERY_TYPE}` is not set.
194+
/// "zen" is the default if `discovery.type` is not set.
195195
/// It is nevertheless explicitly set here.
196196
/// see <https://github.com/opensearch-project/OpenSearch/blob/3.0.0/server/src/main/java/org/opensearch/discovery/DiscoveryModule.java#L88-L89>
197197
///
@@ -236,7 +236,7 @@ impl NodeConfig {
236236
.cluster
237237
.role_group_configs_filtered_by_node_role(&v1alpha1::NodeRole::ClusterManager);
238238

239-
// This setting requires node names as set in `{NODE_NAME}`.
239+
// This setting requires node names as set in NODE_NAME.
240240
// The node names are set to the pod names with
241241
// `valueFrom.fieldRef.fieldPath: metadata.name`, so it is okay to calculate the pod
242242
// names here and use them as node names.

rust/operator-binary/src/controller/build/role_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'a> RoleBuilder<'a> {
103103
/// Builds a Service that references all nodes with the cluster_manager node role
104104
///
105105
/// Initially, this service was meant to be used by
106-
/// `NodeConfig::initial_cluster_manager_nodes`, but the function uses now another approach.
106+
/// [`super::node_config::NodeConfig::initial_cluster_manager_nodes`], but the function uses now another approach.
107107
/// Afterwards, it was meant to be used as an entry point to OpenSearch, but it could also make
108108
/// sense to use coordinating only nodes as entry points and not cluster manager nodes.
109109
/// Therefore, this service will bei either adapted or removed. There is already an according
@@ -144,7 +144,7 @@ impl<'a> RoleBuilder<'a> {
144144
}
145145
}
146146

147-
/// Builds a PodDisruptionBudget used by all role-groups
147+
/// Builds a [`PodDisruptionBudget`] used by all role-groups
148148
pub fn build_pdb(&self) -> Option<PodDisruptionBudget> {
149149
let pdb_config = &self.cluster.role_config.pod_disruption_budget;
150150

rust/operator-binary/src/controller/build/role_group_builder.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ impl<'a> RoleGroupBuilder<'a> {
103103
}
104104
}
105105

106-
/// Builds the ConfigMap containing the configuration files of the role-group StatefulSet
106+
/// Builds the [`ConfigMap`] containing the configuration files of the role-group
107+
/// [`StatefulSet`]
107108
pub fn build_config_map(&self) -> ConfigMap {
108109
let metadata = self
109110
.common_metadata(self.resource_names.role_group_config_map())
@@ -122,7 +123,7 @@ impl<'a> RoleGroupBuilder<'a> {
122123
}
123124
}
124125

125-
/// Builds the role-group StatefulSet
126+
/// Builds the role-group [`StatefulSet`]
126127
pub fn build_stateful_set(&self) -> StatefulSet {
127128
let metadata = self
128129
.common_metadata(self.resource_names.stateful_set_name())
@@ -177,7 +178,7 @@ impl<'a> RoleGroupBuilder<'a> {
177178
}
178179
}
179180

180-
/// Builds the PodTemplateSpec for the role-group StatefulSet
181+
/// Builds the [`PodTemplateSpec`] for the role-group [`StatefulSet`]
181182
fn build_pod_template(&self) -> PodTemplateSpec {
182183
let mut node_role_labels = Labels::new();
183184
for node_role in self.role_group_config.config.node_roles.iter() {
@@ -245,8 +246,8 @@ impl<'a> RoleGroupBuilder<'a> {
245246

246247
/// Returns the labels of OpenSearch nodes with the `cluster_manager` role.
247248
///
248-
/// As described in `RoleBuilder::build_cluster_manager_service`, this function will be
249-
/// changed or deleted.
249+
/// As described in [`super::role_builder::RoleBuilder::build_cluster_manager_service`], this
250+
/// function will be changed or deleted.
250251
pub fn cluster_manager_labels(
251252
cluster: &ValidatedCluster,
252253
context_names: &ContextNames,
@@ -275,7 +276,7 @@ impl<'a> RoleGroupBuilder<'a> {
275276
.expect("should be a valid label")
276277
}
277278

278-
/// Builds the container for the PodTemplateSpec
279+
/// Builds the container for the [`PodTemplateSpec`]
279280
fn build_container(&self, role_group_config: &OpenSearchRoleGroupConfig) -> Container {
280281
let product_image = self
281282
.cluster
@@ -312,7 +313,7 @@ impl<'a> RoleGroupBuilder<'a> {
312313
.get(EnvVarName::from_str_unsafe("OPENSEARCH_HOME"))
313314
.and_then(|env_var| env_var.value.clone())
314315
.unwrap_or(DEFAULT_OPENSEARCH_HOME.to_owned());
315-
// Use `OPENSEARCH_PATH_CONF` from envOverrides or default to `{OPENSEARCH_HOME}/config`,
316+
// Use `OPENSEARCH_PATH_CONF` from envOverrides or default to `OPENSEARCH_HOME/config`,
316317
// i.e. depend on `OPENSEARCH_HOME`.
317318
let opensearch_path_conf = env_vars
318319
.get(EnvVarName::from_str_unsafe("OPENSEARCH_PATH_CONF"))
@@ -367,7 +368,7 @@ impl<'a> RoleGroupBuilder<'a> {
367368
.build()
368369
}
369370

370-
/// Builds the headless Service for the role-group
371+
/// Builds the headless [`Service`] for the role-group
371372
pub fn build_headless_service(&self) -> Service {
372373
let metadata = self
373374
.common_metadata(self.resource_names.headless_service_name())
@@ -437,7 +438,7 @@ impl<'a> RoleGroupBuilder<'a> {
437438
.expect("should be valid annotations")
438439
}
439440

440-
/// Builds the Listener for the role-group
441+
/// Builds the [`listener::v1alpha1::Listener`] for the role-group
441442
///
442443
/// The Listener exposes only the HTTP port.
443444
/// The Listener operator will create a Service per role-group.
@@ -495,7 +496,9 @@ impl<'a> RoleGroupBuilder<'a> {
495496
)
496497
}
497498

498-
/// Labels to select a Pod in the role-group
499+
/// Labels to select a [`Pod`] in the role-group
500+
///
501+
/// [`Pod`]: stackable_operator::k8s_openapi::api::core::v1::Pod
499502
fn pod_selector(&self) -> Labels {
500503
role_group_selector(
501504
&self.cluster,

rust/operator-binary/src/controller/update_status.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pub enum Error {
3434

3535
type Result<T, E = Error> = std::result::Result<T, E>;
3636

37-
/// Updates the status of the `v1alpha1::OpenSearchCluster` according to the given applied resources
37+
/// Updates the status of the [`v1alpha1::OpenSearchCluster`] according to the given applied
38+
/// resources
3839
pub async fn update_status(
3940
client: &Client,
4041
names: &ContextNames,

rust/operator-binary/src/controller/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub enum Error {
6969

7070
type Result<T, E = Error> = std::result::Result<T, E>;
7171

72-
/// Validates the `v1alpha1::OpenSearchCluster` and returns a `ValidateCluster`
72+
/// Validates the [`v1alpha1::OpenSearchCluster`] and returns a [`ValidatedCluster`]
7373
///
7474
/// The validated values should be wrapped in fail-safe types so that illegal states are
7575
/// unrepresentable in the following steps.

rust/operator-binary/src/framework.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
//! Additions to stackable-operator
22
//!
33
//! Functions in stackable-operator usually accept generic types like strings and validate the
4-
//! parameters as late as possible. Therefore, nearly all functions have to return a `Result` and
4+
//! parameters as late as possible. Therefore, nearly all functions have to return a [`Result`] and
55
//! errors are returned along the call chain. That makes error handling complex because every
66
//! module re-packages the received error. Also, the validation is repeated if the value is used in
77
//! different function calls. Sometimes, validation is not necessary if constant values are used,
88
//! e.g. the name of the operator.
99
//!
1010
//! The OpenSearch operator uses a different approach. The incoming values are validated as early
1111
//! as possible and wrapped in a fail-safe type. This type is then used along the call chain,
12-
//! validation is not necessary anymore and functions without side effects do not need to return
13-
//! a `Result`.
12+
//! validation is not necessary anymore and functions without side effects do not need to return a
13+
//! [`Result`].
1414
//!
1515
//! However, the OpenSearch operator uses stackable-operator and at the interface, the fail-safe
16-
//! types must be unwrapped and the `Result` returned by the stackable-operator function must be
17-
//! handled. This is done by calling `Result::expect` which requires thorough testing.
16+
//! types must be unwrapped and the [`Result`] returned by the stackable-operator function must be
17+
//! handled. This is done by calling [`Result::expect`] which requires thorough testing.
1818
//!
1919
//! When the development of the OpenSearch operator has progressed and changes in this module
20-
//! become less frequent, then this module can be incorporated into stackable-operator. The
21-
//! module structure should already resemble the one of stackable-operator.
20+
//! become less frequent, then this module can be incorporated into stackable-operator. The module
21+
//! structure should already resemble the one of stackable-operator.
2222
2323
use std::{fmt::Display, str::FromStr};
2424

@@ -63,17 +63,18 @@ pub enum Error {
6363

6464
/// Maximum length of DNS subdomain names as defined in RFC 1123.
6565
///
66-
/// Duplicates the private constant `stackable-operator::validation::RFC_1123_SUBDOMAIN_MAX_LENGTH`
66+
/// Duplicates the private constant
67+
/// [`stackable-operator::validation::RFC_1123_SUBDOMAIN_MAX_LENGTH`]
6768
pub const MAX_RFC_1123_DNS_SUBDOMAIN_NAME_LENGTH: usize = 253;
6869

6970
/// Maximum length of label names as defined in RFC 1123.
7071
///
71-
/// Duplicates the private constant `stackable-operator::validation::RFC_1123_LABEL_MAX_LENGTH`
72+
/// Duplicates the private constant [`stackable-operator::validation::RFC_1123_LABEL_MAX_LENGTH`]
7273
pub const MAX_RFC_1123_LABEL_NAME_LENGTH: usize = 63;
7374

7475
/// Maximum length of label values
7576
///
76-
/// Duplicates the private constant `stackable-operator::kvp::label::value::LABEL_VALUE_MAX_LEN`
77+
/// Duplicates the private constant [`stackable-operator::kvp::label::value::LABEL_VALUE_MAX_LEN`]
7778
pub const MAX_LABEL_VALUE_LENGTH: usize = 63;
7879

7980
/// Has a non-empty name
@@ -213,7 +214,7 @@ macro_rules! attributed_string_type {
213214

214215
/// Returns the minimum of the given values.
215216
///
216-
/// As opposed to `std::cmp::min`, this function can be used at compile-time.
217+
/// As opposed to [`std::cmp::min`], this function can be used at compile-time.
217218
///
218219
/// # Examples
219220
///

rust/operator-binary/src/framework/builder/meta.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use stackable_operator::{
55

66
use crate::framework::{HasName, HasUid};
77

8-
/// Infallible variant of `stackable_operator::builder::meta::ObjectMetaBuilder::ownerreference_from_resource`
8+
/// Infallible variant of
9+
/// [`stackable_operator::builder::meta::ObjectMetaBuilder::ownerreference_from_resource`]
910
pub fn ownerreference_from_resource(
1011
resource: &(impl Resource<DynamicType = ()> + HasName + HasUid),
1112
block_owner_deletion: Option<bool>,

rust/operator-binary/src/framework/builder/pdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::framework::{
99
};
1010

1111
/// Infallible variant of
12-
/// `stackable_operator::builder::pdb::PodDisruptionBudgetBuilder::new_with_role`
12+
/// [`stackable_operator::builder::pdb::PodDisruptionBudgetBuilder::new_with_role`]
1313
pub fn pod_disruption_budget_builder_with_role(
1414
owner: &(impl Resource<DynamicType = ()> + HasName + NameIsValidLabelValue + HasUid),
1515
product_name: &ProductName,

0 commit comments

Comments
 (0)