Skip to content

Commit 5aaeb94

Browse files
authored
feat: Allow adding entries to the OpenSearch keystore (#76)
* feat: Allow adding entries to the OpenSearch keystore * address feedback on PR * address more feedback on PR * remove unnecessary volumes and volumeMount
1 parent 7694293 commit 5aaeb94

File tree

17 files changed

+351
-100
lines changed

17 files changed

+351
-100
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88

9-
- Add the role group as a node attribute ([#63]).
109
- Allow the configuration of TLS for the HTTP and TRANSPORT ports with the operator ([#55]).
10+
- Add the role group as a node attribute ([#63]).
11+
- Allow adding entries to the OpenSearch keystore ([#76]).
1112

1213
[#55]: https://github.com/stackabletech/opensearch-operator/pull/55
1314
[#63]: https://github.com/stackabletech/opensearch-operator/pull/63
15+
[#76]: https://github.com/stackabletech/opensearch-operator/pull/76
1416

1517
## [25.11.0] - 2025-11-07
1618

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,46 @@ spec:
3030
properties:
3131
clusterConfig:
3232
default:
33+
keystore: []
3334
tls:
3435
internalSecretClass: tls
3536
serverSecretClass: tls
3637
description: Configuration that applies to all roles and role groups
3738
properties:
39+
keystore:
40+
default: []
41+
description: Entries to add to the OpenSearch keystore.
42+
items:
43+
properties:
44+
key:
45+
description: Key in the OpenSearch keystore
46+
minLength: 1
47+
pattern: ^[A-Za-z0-9_\-.]+$
48+
type: string
49+
secretKeyRef:
50+
description: Reference to the Secret containing the value which will be stored in the OpenSearch keystore
51+
properties:
52+
key:
53+
description: Key in the Secret that contains the value
54+
maxLength: 253
55+
minLength: 1
56+
pattern: ^[-._a-zA-Z0-9]+$
57+
type: string
58+
name:
59+
description: Name of the Secret
60+
maxLength: 253
61+
minLength: 1
62+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
63+
type: string
64+
required:
65+
- key
66+
- name
67+
type: object
68+
required:
69+
- key
70+
- secretKeyRef
71+
type: object
72+
type: array
3873
tls:
3974
default:
4075
internalSecretClass: tls
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
= Add entries to the OpenSearch Keystore
2+
:description: Add entries to the OpenSearch Keystore
3+
4+
The OpenSearch keystore provides secure storage for sensitive configuration settings such as credentials and API keys.
5+
You can populate the keystore by referencing Secrets within your OpenSearch configuration.
6+
7+
[source,yaml]
8+
----
9+
---
10+
apiVersion: opensearch.stackable.tech/v1alpha1
11+
kind: OpenSearchCluster
12+
metadata:
13+
name: opensearch
14+
spec:
15+
clusterConfig:
16+
keystore:
17+
- key: s3.client.default.access_key # <1>
18+
secretKeyRef:
19+
name: s3-credentials # <2>
20+
key: accessKey # <3>
21+
- key: s3.client.default.secret_key
22+
secretKeyRef:
23+
name: s3-credentials
24+
key: secretKey
25+
...
26+
---
27+
apiVersion: v1
28+
kind: Secret
29+
metadata:
30+
name: s3-credentials
31+
stringData:
32+
accessKey: my-access-key
33+
secretKey: my-secret-key
34+
----
35+
<1> The key in the OpenSearch keystore which corresponds to a setting in OpenSearch (e.g. `s3.client.default.access_key`).
36+
<2> The name of the Secret containing the value
37+
<3> The key within that Secret

docs/modules/opensearch/partials/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
** xref:opensearch:usage-guide/logging.adoc[]
1111
** xref:opensearch:usage-guide/opensearch-dashboards.adoc[]
1212
** xref:opensearch:usage-guide/scaling.adoc[]
13+
** xref:opensearch:usage-guide/keystore.adoc[]
1314
** xref:opensearch:usage-guide/security.adoc[]
1415
** xref:opensearch:usage-guide/operations/index.adoc[]
1516
*** xref:opensearch:usage-guide/operations/cluster-operations.adoc[]

rust/operator-binary/src/controller.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ pub struct ValidatedCluster {
171171
pub role_config: GenericRoleConfig,
172172
pub role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>,
173173
pub tls_config: v1alpha1::OpenSearchTls,
174+
pub keystores: Vec<v1alpha1::OpenSearchKeystore>,
174175
}
175176

176177
impl ValidatedCluster {
@@ -184,6 +185,7 @@ impl ValidatedCluster {
184185
role_config: GenericRoleConfig,
185186
role_group_configs: BTreeMap<RoleGroupName, OpenSearchRoleGroupConfig>,
186187
tls_config: v1alpha1::OpenSearchTls,
188+
keystores: Vec<v1alpha1::OpenSearchKeystore>,
187189
) -> Self {
188190
let uid = uid.into();
189191
ValidatedCluster {
@@ -201,6 +203,7 @@ impl ValidatedCluster {
201203
role_config,
202204
role_group_configs,
203205
tls_config,
206+
keystores,
204207
}
205208
}
206209

@@ -507,6 +510,7 @@ mod tests {
507510
]
508511
.into(),
509512
v1alpha1::OpenSearchTls::default(),
513+
vec![],
510514
)
511515
}
512516

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ mod tests {
199199
]
200200
.into(),
201201
v1alpha1::OpenSearchTls::default(),
202+
vec![],
202203
)
203204
}
204205

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ mod tests {
502502
)]
503503
.into(),
504504
v1alpha1::OpenSearchTls::default(),
505+
vec![],
505506
);
506507

507508
NodeConfig::new(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ mod tests {
315315
)]
316316
.into(),
317317
v1alpha1::OpenSearchTls::default(),
318+
vec![],
318319
);
319320

320321
RoleBuilder::new(cluster, context_names)

0 commit comments

Comments
 (0)