Skip to content

Commit 26c37f1

Browse files
committed
chore: Update to operator-rs 0.77.1 and use new S3 structs
1 parent 18791e6 commit 26c37f1

File tree

9 files changed

+958
-608
lines changed

9 files changed

+958
-608
lines changed

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"
2424
serde_yaml = "0.9"
2525
snafu = "0.8"
26-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.74.0" }
26+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.77.1" }
2727
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
2828
strum = { version = "0.26", features = ["derive"] }
29-
tokio = { version = "1.39", features = ["full"] }
29+
tokio = { version = "1.40", features = ["full"] }
3030
tracing = "0.1"
3131

3232
# [patch."https://github.com/stackabletech/operator-rs.git"]

crate-hashes.json

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

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ spec:
104104
- reference
105105
properties:
106106
inline:
107-
description: Inline definition of an S3 connection.
107+
description: S3 connection definition as a resource. Learn more on the [S3 concept documentation](https://docs.stackable.tech/home/nightly/concepts/s3).
108108
properties:
109109
accessStyle:
110+
default: VirtualHosted
110111
description: Which access style to use. Defaults to virtual hosted-style as most of the data products out there. Have a look at the [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html).
111112
enum:
112113
- Path
113114
- VirtualHosted
114-
nullable: true
115115
type: string
116116
credentials:
117117
description: If the S3 uses authentication you have to specify you S3 credentials. In the most cases a [SecretClass](https://docs.stackable.tech/home/nightly/secret-operator/secretclass) providing `accessKey` and `secretKey` is sufficient.
@@ -121,6 +121,12 @@ spec:
121121
description: '[Scope](https://docs.stackable.tech/home/nightly/secret-operator/scope) of the [SecretClass](https://docs.stackable.tech/home/nightly/secret-operator/secretclass).'
122122
nullable: true
123123
properties:
124+
listenerVolumes:
125+
default: []
126+
description: The listener volume scope allows Node and Service scopes to be inferred from the applicable listeners. This must correspond to Volume names in the Pod that mount Listeners.
127+
items:
128+
type: string
129+
type: array
124130
node:
125131
default: false
126132
description: The node scope is resolved to the name of the Kubernetes Node object that the Pod is running on. This will typically be the DNS name of the node.
@@ -143,8 +149,7 @@ spec:
143149
- secretClass
144150
type: object
145151
host:
146-
description: 'Hostname of the S3 server without any protocol or port. For example: `west1.my-cloud.com`.'
147-
nullable: true
152+
description: 'Host of the S3 server without any protocol or port. For example: `west1.my-cloud.com`.'
148153
type: string
149154
port:
150155
description: Port the S3 server listens on. If not specified the product will determine the port to use.
@@ -153,7 +158,7 @@ spec:
153158
nullable: true
154159
type: integer
155160
tls:
156-
description: If you want to use TLS when talking to S3 you can enable TLS encrypted communication with this setting.
161+
description: Use a TLS connection. If not specified no TLS will be used.
157162
nullable: true
158163
properties:
159164
verification:
@@ -192,9 +197,10 @@ spec:
192197
required:
193198
- verification
194199
type: object
200+
required:
201+
- host
195202
type: object
196203
reference:
197-
description: A reference to an S3Connection resource.
198204
type: string
199205
type: object
200206
vectorAggregatorConfigMapName:
@@ -251,8 +257,10 @@ spec:
251257
description: LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
252258
properties:
253259
name:
254-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
260+
description: 'Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
255261
type: string
262+
required:
263+
- name
256264
type: object
257265
nullable: true
258266
type: array
@@ -306,10 +314,6 @@ spec:
306314
nullable: true
307315
type: object
308316
x-kubernetes-preserve-unknown-fields: true
309-
required:
310-
- nodeAffinity
311-
- podAffinity
312-
- podAntiAffinity
313317
type: object
314318
gracefulShutdownTimeout:
315319
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
@@ -578,10 +582,6 @@ spec:
578582
nullable: true
579583
type: object
580584
x-kubernetes-preserve-unknown-fields: true
581-
required:
582-
- nodeAffinity
583-
- podAffinity
584-
- podAntiAffinity
585585
type: object
586586
gracefulShutdownTimeout:
587587
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.

rust/crd/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ use stackable_operator::{
1313
CpuLimitsFragment, MemoryLimitsFragment, NoRuntimeLimits, NoRuntimeLimitsFragment,
1414
PvcConfig, PvcConfigFragment, Resources, ResourcesFragment,
1515
},
16-
s3::S3ConnectionDef,
16+
s3::S3ConnectionInlineOrReference,
17+
},
18+
config::{
19+
fragment::{self, Fragment, ValidationError},
20+
merge::Merge,
1721
},
18-
config::{fragment, fragment::Fragment, fragment::ValidationError, merge::Merge},
1922
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
2023
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
2124
product_config_utils::{self, Configuration},
@@ -150,7 +153,7 @@ pub struct HiveClusterConfig {
150153
/// S3 connection specification. This can be either `inline` or a `reference` to an
151154
/// S3Connection object. Read the [S3 concept documentation](DOCS_BASE_URL_PLACEHOLDER/concepts/s3) to learn more.
152155
#[serde(default, skip_serializing_if = "Option::is_none")]
153-
pub s3: Option<S3ConnectionDef>,
156+
pub s3: Option<S3ConnectionInlineOrReference>,
154157

155158
/// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery).
156159
/// It must contain the key `ADDRESS` with the address of the Vector aggregator.

rust/operator-binary/src/command.rs

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ use stackable_hive_crd::{
44
STACKABLE_CONFIG_MOUNT_DIR, STACKABLE_LOG_CONFIG_MOUNT_DIR, STACKABLE_TRUST_STORE,
55
STACKABLE_TRUST_STORE_PASSWORD, SYSTEM_TRUST_STORE, SYSTEM_TRUST_STORE_PASSWORD,
66
};
7-
use stackable_operator::commons::{
8-
authentication::tls::{CaCert, Tls, TlsServerVerification, TlsVerification},
9-
s3::S3ConnectionSpec,
10-
};
11-
12-
pub const S3_SECRET_DIR: &str = "/stackable/secrets";
13-
pub const S3_ACCESS_KEY: &str = "accessKey";
14-
pub const S3_SECRET_KEY: &str = "secretKey";
15-
pub const ACCESS_KEY_PLACEHOLDER: &str = "xxx_access_key_xxx";
16-
pub const SECRET_KEY_PLACEHOLDER: &str = "xxx_secret_key_xxx";
7+
use stackable_operator::commons::s3::S3ConnectionSpec;
178

189
pub fn build_container_command_args(
1910
hive: &HiveCluster,
@@ -29,6 +20,10 @@ pub fn build_container_command_args(
2920
format!("echo copying {STACKABLE_LOG_CONFIG_MOUNT_DIR}/{HIVE_METASTORE_LOG4J2_PROPERTIES} to {STACKABLE_CONFIG_DIR}/{HIVE_METASTORE_LOG4J2_PROPERTIES}"),
3021
format!("cp -RL {STACKABLE_LOG_CONFIG_MOUNT_DIR}/{HIVE_METASTORE_LOG4J2_PROPERTIES} {STACKABLE_CONFIG_DIR}/{HIVE_METASTORE_LOG4J2_PROPERTIES}"),
3122

23+
// Template config files
24+
format!("if test -f {STACKABLE_CONFIG_DIR}/core-site.xml; then config-utils template {STACKABLE_CONFIG_DIR}/core-site.xml; fi"),
25+
format!("if test -f {STACKABLE_CONFIG_DIR}/hive-site.xml; then config-utils template {STACKABLE_CONFIG_DIR}/hive-site.xml; fi"),
26+
3227
// Copy system truststore to stackable truststore
3328
format!("keytool -importkeystore -srckeystore {SYSTEM_TRUST_STORE} -srcstoretype jks -srcstorepass {SYSTEM_TRUST_STORE_PASSWORD} -destkeystore {STACKABLE_TRUST_STORE} -deststoretype pkcs12 -deststorepass {STACKABLE_TRUST_STORE_PASSWORD} -noprompt")
3429
];
@@ -41,22 +36,9 @@ pub fn build_container_command_args(
4136
}
4237

4338
if let Some(s3) = s3_connection_spec {
44-
if s3.credentials.is_some() {
45-
args.extend([
46-
format!("echo replacing {ACCESS_KEY_PLACEHOLDER} and {SECRET_KEY_PLACEHOLDER} with secret values."),
47-
format!("sed -i \"s|{ACCESS_KEY_PLACEHOLDER}|$(cat {S3_SECRET_DIR}/{S3_ACCESS_KEY})|g\" {STACKABLE_CONFIG_DIR}/{HIVE_SITE_XML}"),
48-
format!("sed -i \"s|{SECRET_KEY_PLACEHOLDER}|$(cat {S3_SECRET_DIR}/{S3_SECRET_KEY})|g\" {STACKABLE_CONFIG_DIR}/{HIVE_SITE_XML}"),
49-
]);
50-
}
51-
52-
if let Some(Tls {
53-
verification:
54-
TlsVerification::Server(TlsServerVerification {
55-
ca_cert: CaCert::SecretClass(secret_class),
56-
}),
57-
}) = &s3.tls
58-
{
59-
args.push(format!("keytool -importcert -file /stackable/certificates/{secret_class}-tls-certificate/ca.crt -alias stackable-{secret_class} -keystore {STACKABLE_TRUST_STORE} -storepass {STACKABLE_TRUST_STORE_PASSWORD} -noprompt"));
39+
if let Some(ca_cert) = s3.tls.tls_ca_cert_mount_path() {
40+
// The alias can not clash, as we only support a single S3Connection
41+
args.push(format!("keytool -importcert -file {ca_cert} -alias stackable-s3-ca-cert -keystore {STACKABLE_TRUST_STORE} -storepass {STACKABLE_TRUST_STORE_PASSWORD} -noprompt"));
6042
}
6143
}
6244

0 commit comments

Comments
 (0)