Skip to content

Commit aa624c8

Browse files
fhennigmaltesander
andauthored
feat: Better CRD docs (#394)
* docs * better s3 docs * Update rust/crd/src/lib.rs Co-authored-by: Malte Sander <contact@maltesander.com> * changed the clusterConfig description * Changelog * Update rust/crd/src/lib.rs Co-authored-by: Malte Sander <contact@maltesander.com> * ~ * Updated changelog --------- Co-authored-by: Malte Sander <contact@maltesander.com>
1 parent a0928bd commit aa624c8

File tree

6 files changed

+108
-48
lines changed

6 files changed

+108
-48
lines changed

CHANGELOG.md

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

55
## [Unreleased]
66

7+
### Added
8+
9+
- Various documentation of the CRD ([#394]).
10+
11+
[#394]: https://github.com/stackabletech/hive-operator/pull/394
12+
713
## [23.11.0] - 2023-11-24
814

915
### Added

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ serde = { version = "1.0", features = ["derive"] }
2222
serde_json = "1.0"
2323
serde_yaml = "0.9"
2424
snafu = "0.7"
25-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.56.1" }
25+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.57.0" }
2626
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.6.0" }
2727
strum = { version = "0.25", features = ["derive"] }
2828
tokio = { version = "1.29", features = ["full"] }

deploy/helm/hive-operator/crds/crds.yaml

Lines changed: 56 additions & 32 deletions
Large diffs are not rendered by default.

rust/crd/src/lib.rs

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ pub enum Error {
9292
},
9393
}
9494

95+
/// A Hive cluster stacklet. This resource is managed by the Stackable operator for Apache Hive.
96+
/// Find more information on how to use it and the resources that the operator generates in the
97+
/// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/hive/).
9598
#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
9699
#[serde(rename_all = "camelCase")]
97100
#[kube(
@@ -109,32 +112,44 @@ pub enum Error {
109112
)
110113
)]
111114
pub struct HiveClusterSpec {
112-
/// General Hive metastore cluster settings
115+
/// Hive metastore settings that affect all roles and role groups.
116+
/// The settings in the `clusterConfig` are cluster wide settings that do not need to be configurable at role or role group level.
113117
pub cluster_config: HiveClusterConfig,
114-
/// Cluster operations like pause reconciliation or cluster stop.
118+
119+
// no doc - docs in ClusterOperation struct.
115120
#[serde(default)]
116121
pub cluster_operation: ClusterOperation,
117-
/// The Hive metastore image to use
122+
123+
// no doc - docs in ProductImage struct.
118124
pub image: ProductImage,
125+
126+
// no doc - docs in Role struct.
119127
#[serde(default, skip_serializing_if = "Option::is_none")]
120128
pub metastore: Option<Role<MetaStoreConfigFragment>>,
121129
}
122130

123131
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
124132
#[serde(rename_all = "camelCase")]
125133
pub struct HiveClusterConfig {
126-
/// Database connection specification
134+
// no doc - docs in DatabaseConnectionSpec struct.
127135
pub database: DatabaseConnectionSpec,
128-
/// HDFS connection specification
136+
137+
/// HDFS connection specification.
129138
#[serde(default, skip_serializing_if = "Option::is_none")]
130139
pub hdfs: Option<HdfsConnection>,
131-
/// S3 connection specification
140+
141+
/// S3 connection specification. This can be either `inline` or a `reference` to an
142+
/// S3Connection object. Read the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3) to learn more.
132143
#[serde(default, skip_serializing_if = "Option::is_none")]
133144
pub s3: Option<S3ConnectionDef>,
134-
/// Name of the Vector aggregator discovery ConfigMap.
145+
146+
/// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery).
135147
/// It must contain the key `ADDRESS` with the address of the Vector aggregator.
148+
/// Follow the [logging tutorial](DOCS_BASE_URL_PLACEHOLDER/tutorials/logging-vector-aggregator)
149+
/// to learn how to configure log aggregation with Vector.
136150
#[serde(skip_serializing_if = "Option::is_none")]
137151
pub vector_aggregator_config_map_name: Option<String>,
152+
138153
/// This field controls which type of Service the Operator creates for this HiveCluster:
139154
///
140155
/// * cluster-internal: Use a ClusterIP service
@@ -144,7 +159,7 @@ pub struct HiveClusterConfig {
144159
/// * external-stable: Use a LoadBalancer service
145160
///
146161
/// This is a temporary solution with the goal to keep yaml manifests forward compatible.
147-
/// In the future, this setting will control which ListenerClass <https://docs.stackable.tech/home/stable/listener-operator/listenerclass.html>
162+
/// In the future, this setting will control which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html)
148163
/// will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change.
149164
#[serde(default)]
150165
pub listener_class: CurrentlySupportedListenerClasses,
@@ -176,7 +191,10 @@ impl CurrentlySupportedListenerClasses {
176191
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
177192
#[serde(rename_all = "camelCase")]
178193
pub struct HdfsConnection {
179-
/// Name of the discovery-configmap providing information about the HDFS cluster
194+
/// Name of the [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery)
195+
/// providing information about the HDFS cluster.
196+
/// See also the [Stackable Operator for HDFS](DOCS_BASE_URL_PLACEHOLDER/hdfs/) to learn
197+
/// more about setting up an HDFS cluster.
180198
pub config_map: String,
181199
}
182200

@@ -263,7 +281,7 @@ pub enum Container {
263281
)]
264282
pub struct MetastoreStorageConfig {
265283
/// This field is deprecated. It was never used by Hive and will be removed in a future
266-
/// CRD version. The controller will warn if it's set to a non zero value
284+
/// CRD version. The controller will warn if it's set to a non zero value.
267285
#[fragment_attrs(serde(default))]
268286
pub data: PvcConfig,
269287
}
@@ -401,12 +419,23 @@ impl DbType {
401419
}
402420
}
403421

422+
/// Database connection specification for the metadata database.
404423
#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize)]
405424
#[serde(rename_all = "camelCase")]
406425
pub struct DatabaseConnectionSpec {
426+
/// A connection string for the database. For example:
427+
/// `jdbc:postgresql://hivehdfs-postgresql:5432/hivehdfs`
407428
pub conn_string: String,
429+
430+
/// The database user.
408431
pub user: String,
432+
433+
/// The password for the database user.
409434
pub password: String,
435+
436+
/// The type of database to connect to. Supported are:
437+
/// `postgres`, `mysql`, `oracle`, `mssql` and `derby`.
438+
/// This value is used to configure the jdbc driver class.
410439
pub db_type: DbType,
411440
}
412441

rust/operator-binary/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct Opts {
4040
async fn main() -> anyhow::Result<()> {
4141
let opts = Opts::parse();
4242
match opts.cmd {
43-
Command::Crd => HiveCluster::print_yaml_schema()?,
43+
Command::Crd => HiveCluster::print_yaml_schema(built_info::CARGO_PKG_VERSION)?,
4444
Command::Run(ProductOperatorRun {
4545
product_config,
4646
watch_namespace,

0 commit comments

Comments
 (0)