Skip to content

Commit 31378ff

Browse files
committed
chore: Merge branch 'main' into feat/stackable-versioned-mod-support
2 parents b349321 + a2ac5f5 commit 31378ff

File tree

12 files changed

+237
-9
lines changed

12 files changed

+237
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ repos:
5151
name: .scripts/verify-crate-versions
5252
language: system
5353
entry: .scripts/verify_crate_versions.sh
54-
stages: [commit, merge-commit, manual]
54+
stages: [pre-commit, pre-merge-commit, manual]
5555
pass_filenames: false

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/CHANGELOG.md

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

55
## [Unreleased]
66

7+
## [0.79.0] - 2024-10-18
8+
79
### Added
810

911
- Re-export the `YamlSchema` trait and the `stackable-shared` crate as the `shared` module ([#883]).
1012
- BREAKING: Added `preferredAddressType` field to ListenerClass CRD ([#885]).
13+
- BREAKING: The cluster domain (default: `cluster.local`) can now be configured in the individual
14+
operators via the ENV variable `KUBERNETES_CLUSTER_DOMAIN` or resolved automatically by parsing
15+
the `/etc/resolve.conf` file. This requires using `initialize_operator` instead of `create_client`
16+
in the `main.rs` of the individual operators ([#893]).
1117

1218
### Changed
1319

1420
- BREAKING: The `CustomResourceExt` trait is now re-exported from the `stackable-shared` crate. The
1521
trait functions use the same parameters but return a different error type ([#883]).
16-
- BREAKING: `KeyValuePairs` (as well as `Labels`/`Annotations` via it) is now backed by a `BTreeMap` rather than a `BTreeSet` ([#888]).
22+
- BREAKING: `KeyValuePairs` (as well as `Labels`/`Annotations` via it) is now backed by a `BTreeMap`
23+
rather than a `BTreeSet` ([#888]).
1724
- The `Deref` impl now returns a `BTreeMap` instead.
1825
- `iter()` now clones the values.
1926

2027
### Fixed
2128

22-
- BREAKING: `KeyValuePairs::insert` (as well as `Labels::`/`Annotations::` via it) now overwrites the old value if the key already exists ([#888]).
23-
- Previously, `iter()` would return *both* values in lexicographical order (causing further conversions like `Into<BTreeMap>` to prefer the maximum value).
29+
- BREAKING: `KeyValuePairs::insert` (as well as `Labels::`/`Annotations::` via it) now overwrites
30+
the old value if the key already exists. Previously, `iter()` would return *both* values in
31+
lexicographical order (causing further conversions like `Into<BTreeMap>` to prefer the maximum
32+
value) ([#888]).
2433

2534
### Removed
2635

@@ -31,6 +40,7 @@ All notable changes to this project will be documented in this file.
3140
[#883]: https://github.com/stackabletech/operator-rs/pull/883
3241
[#885]: https://github.com/stackabletech/operator-rs/pull/885
3342
[#888]: https://github.com/stackabletech/operator-rs/pull/888
43+
[#893]: https://github.com/stackabletech/operator-rs/pull/893
3444

3545
## [0.78.0] - 2024-09-30
3646

crates/stackable-operator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "stackable-operator"
33
description = "Stackable Operator Framework"
4-
version = "0.78.0"
4+
version = "0.79.0"
55
authors.workspace = true
66
license.workspace = true
77
edition.workspace = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nameserver 10.243.21.53
2+
options ndots:5
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
search baz svc.foo.bar foo.bar
2+
search sble-operators.svc.cluster.local svc.cluster.local cluster.local
3+
nameserver 10.243.21.53
4+
options ndots:5
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
search sble-operators.svc.cluster.local svc.cluster.local cluster.local
2+
nameserver 10.243.21.53
3+
options ndots:5
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
search openshift-service-ca-operator.svc.cluster.local svc.cluster.local cluster.local cmx.repl-openshift.build
2+
nameserver 172.30.0.10
3+
options ndots:5

crates/stackable-operator/src/client.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::kvp::LabelSelectorExt;
2+
use crate::utils::cluster_domain::{self, retrieve_cluster_domain, KUBERNETES_CLUSTER_DOMAIN};
23

34
use either::Either;
45
use futures::StreamExt;
@@ -77,6 +78,9 @@ pub enum Error {
7778

7879
#[snafu(display("unable to create kubernetes client"))]
7980
CreateKubeClient { source: kube::Error },
81+
82+
#[snafu(display("unable to to resolve kubernetes cluster domain"))]
83+
ResolveKubernetesClusterDomain { source: cluster_domain::Error },
8084
}
8185

8286
/// This `Client` can be used to access Kubernetes.
@@ -510,12 +514,12 @@ impl Client {
510514
/// use tokio::time::error::Elapsed;
511515
/// use kube::runtime::watcher;
512516
/// use k8s_openapi::api::core::v1::Pod;
513-
/// use stackable_operator::client::{Client, create_client};
517+
/// use stackable_operator::client::{Client, initialize_operator};
514518
///
515519
/// #[tokio::main]
516520
/// async fn main(){
517521
///
518-
/// let client: Client = create_client(None).await.expect("Unable to construct client.");
522+
/// let client: Client = initialize_operator(None).await.expect("Unable to construct client.");
519523
/// let watcher_config: watcher::Config =
520524
/// watcher::Config::default().fields(&format!("metadata.name=nonexistent-pod"));
521525
///
@@ -622,7 +626,13 @@ where
622626
}
623627
}
624628

625-
pub async fn create_client(field_manager: Option<String>) -> Result<Client> {
629+
pub async fn initialize_operator(field_manager: Option<String>) -> Result<Client> {
630+
let _ = KUBERNETES_CLUSTER_DOMAIN
631+
.set(retrieve_cluster_domain().context(ResolveKubernetesClusterDomainSnafu)?);
632+
create_client(field_manager).await
633+
}
634+
635+
async fn create_client(field_manager: Option<String>) -> Result<Client> {
626636
let kubeconfig: Config = kube::Config::infer()
627637
.await
628638
.map_err(kube::Error::InferConfig)

crates/stackable-operator/src/commons/networking.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ impl TryFrom<String> for DomainName {
3030
}
3131
}
3232

33+
impl TryFrom<&str> for DomainName {
34+
type Error = validation::Errors;
35+
36+
fn try_from(value: &str) -> Result<Self, Self::Error> {
37+
value.parse()
38+
}
39+
}
40+
3341
impl From<DomainName> for String {
3442
fn from(value: DomainName) -> Self {
3543
value.0

0 commit comments

Comments
 (0)