Skip to content

Commit 4f05048

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/snapshot-s3
2 parents 0b1030b + 3f57fd1 commit 4f05048

63 files changed

Lines changed: 2670 additions & 1058 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yaml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,7 @@ on:
1818
# Run every Saturday morning: https://crontab.guru/#15_3_*_*_6
1919
- cron: '15 3 * * 6'
2020
pull_request:
21-
paths:
22-
- '.github/workflows/build.yaml'
23-
- 'rust-toolchain.toml'
24-
- '.dockerignore'
25-
- 'deploy/**'
26-
- '.cargo/**'
27-
- 'docker/**'
28-
- 'Cargo.*'
29-
- '*.rs'
21+
# Do not limit by paths. This workflow contains a required job.
3022
merge_group:
3123

3224
env:
@@ -39,8 +31,41 @@ env:
3931
CARGO_TERM_COLOR: always
4032

4133
jobs:
34+
# This workflow contains a "required job", and GitHub Actions isn't clever
35+
# enough to detect that it should be skipped, and therefore pass (like they
36+
# allow for skipping jobs in a workflow).
37+
# Therefore, we have to move path filters/globs down to an actual job, and
38+
# emit an output that can be used to skip irrelevant jobs.
39+
detect-changes:
40+
name: Detect relevant changed files
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout Repository
44+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
45+
with:
46+
persist-credentials: false
47+
fetch-depth: 0
48+
49+
- name: Check for changed files
50+
id: check
51+
uses: stackabletech/actions/detect-changes@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
52+
with:
53+
patterns: |
54+
- '.github/workflows/build.yaml'
55+
- 'rust-toolchain.toml'
56+
- '.dockerignore'
57+
- 'deploy/**'
58+
- '.cargo/**'
59+
- 'docker/**'
60+
- 'Cargo.*'
61+
- '*.rs'
62+
outputs:
63+
detected: ${{ steps.check.outputs.detected }}
64+
4265
cargo-udeps:
4366
name: Run cargo-udeps
67+
if: needs.detect-changes.outputs.detected == 'true'
68+
needs: [detect-changes]
4469
runs-on: ubuntu-latest
4570
env:
4671
RUSTC_BOOTSTRAP: 1
@@ -76,7 +101,8 @@ jobs:
76101

77102
build-container-image:
78103
name: Build/Publish ${{ matrix.runner.arch }} Image
79-
if: github.event_name != 'merge_group'
104+
if: (github.event_name != 'merge_group') && needs.detect-changes.outputs.detected == 'true'
105+
needs: [detect-changes]
80106
permissions:
81107
id-token: write
82108
strategy:
@@ -140,15 +166,15 @@ jobs:
140166

141167
- name: Build Container Image
142168
id: build
143-
uses: stackabletech/actions/build-container-image@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
169+
uses: stackabletech/actions/build-container-image@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
144170
with:
145171
image-name: ${{ env.OPERATOR_NAME }}
146172
image-index-manifest-tag: ${{ steps.version.outputs.OPERATOR_VERSION }}
147173
build-arguments: VERSION=${{ steps.version.outputs.OPERATOR_VERSION }}
148174
container-file: docker/Dockerfile
149175

150176
- name: Publish Container Image
151-
uses: stackabletech/actions/publish-image@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
177+
uses: stackabletech/actions/publish-image@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
152178
with:
153179
image-registry-uri: oci.stackable.tech
154180
image-registry-username: robot$sdp+github-action-build
@@ -159,8 +185,9 @@ jobs:
159185

160186
publish-index-manifest:
161187
name: Publish/Sign ${{ needs.build-container-image.outputs.operator-version }} Index
162-
if: github.event_name != 'merge_group'
188+
if: (github.event_name != 'merge_group') && needs.detect-changes.outputs.detected == 'true'
163189
needs:
190+
- detect-changes
164191
- build-container-image
165192
permissions:
166193
id-token: write
@@ -172,7 +199,7 @@ jobs:
172199
persist-credentials: false
173200

174201
- name: Publish and Sign Image Index
175-
uses: stackabletech/actions/publish-image-index-manifest@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
202+
uses: stackabletech/actions/publish-image-index-manifest@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
176203
with:
177204
image-registry-uri: oci.stackable.tech
178205
image-registry-username: robot$sdp+github-action-build
@@ -182,8 +209,9 @@ jobs:
182209

183210
publish-helm-chart:
184211
name: Package/Publish ${{ needs.build-container-image.outputs.operator-version }} Helm Chart
185-
if: github.event_name != 'merge_group'
212+
if: (github.event_name != 'merge_group') && needs.detect-changes.outputs.detected == 'true'
186213
needs:
214+
- detect-changes
187215
- build-container-image
188216
permissions:
189217
id-token: write
@@ -196,7 +224,7 @@ jobs:
196224
submodules: recursive
197225

198226
- name: Package, Publish, and Sign Helm Chart
199-
uses: stackabletech/actions/publish-helm-chart@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
227+
uses: stackabletech/actions/publish-helm-chart@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
200228
with:
201229
chart-registry-uri: oci.stackable.tech
202230
chart-registry-username: robot$sdp-charts+github-action-build
@@ -208,8 +236,9 @@ jobs:
208236

209237
openshift-preflight-check:
210238
name: Run OpenShift Preflight Check for ${{ needs.build-container-image.outputs.operator-version }}-${{ matrix.arch }}
211-
if: github.event_name != 'merge_group'
239+
if: (github.event_name != 'merge_group') && needs.detect-changes.outputs.detected == 'true'
212240
needs:
241+
- detect-changes
213242
- build-container-image
214243
- publish-index-manifest
215244
strategy:
@@ -221,7 +250,7 @@ jobs:
221250
runs-on: ubuntu-latest
222251
steps:
223252
- name: Run OpenShift Preflight Check
224-
uses: stackabletech/actions/run-openshift-preflight@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
253+
uses: stackabletech/actions/run-openshift-preflight@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
225254
with:
226255
image-index-uri: oci.stackable.tech/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
227256
image-architecture: ${{ matrix.arch }}
@@ -243,8 +272,9 @@ jobs:
243272

244273
notify:
245274
name: Failure Notification
246-
if: (failure() || github.run_attempt > 1) && github.event_name != 'merge_group'
275+
if: (failure() || github.run_attempt > 1) && github.event_name != 'merge_group' && needs.detect-changes.outputs.detected == 'true'
247276
needs:
277+
- detect-changes
248278
- build-container-image
249279
- publish-index-manifest
250280
- publish-helm-chart
@@ -256,7 +286,7 @@ jobs:
256286
persist-credentials: false
257287

258288
- name: Send Notification
259-
uses: stackabletech/actions/send-slack-notification@29bea1b451c0c2e994bd495969286f95bf49ed6a # v0.11.0
289+
uses: stackabletech/actions/send-slack-notification@babe44d7b1db87f8e7731c011151d22a8a374191 # v0.12.0
260290
with:
261291
publish-helm-chart-result: ${{ needs.publish-helm-chart.result }}
262292
publish-manifests-result: ${{ needs.publish-index-manifest.result }}

deploy/helm/opensearch-operator/configs/properties.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ spec:
4848
description: Key in the Secret that contains the value
4949
maxLength: 253
5050
minLength: 1
51+
pattern: ^[-._a-zA-Z0-9]+$
5152
type: string
5253
name:
5354
description: Name of the Secret
5455
maxLength: 253
5556
minLength: 1
57+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
5658
type: string
5759
required:
5860
- key
@@ -72,6 +74,7 @@ spec:
7274
maxLength: 253
7375
minLength: 1
7476
nullable: true
77+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
7578
type: string
7679
type: object
7780
clusterOperation:
@@ -222,6 +225,7 @@ spec:
222225
maxLength: 253
223226
minLength: 1
224227
nullable: true
228+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
225229
type: string
226230
logging:
227231
default:
@@ -570,6 +574,7 @@ spec:
570574
maxLength: 253
571575
minLength: 1
572576
nullable: true
577+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
573578
type: string
574579
logging:
575580
default:

rust/operator-binary/src/controller.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ use crate::{
3333
v1alpha1::{self, OpenSearchKeystore},
3434
},
3535
framework::{
36-
ClusterName, ControllerName, HasName, HasUid, ListenerClassName, NameIsValidLabelValue,
37-
NamespaceName, OperatorName, ProductName, ProductVersion, RoleGroupName, RoleName, Uid,
36+
HasName, HasUid, NameIsValidLabelValue,
3837
product_logging::framework::{ValidatedContainerLogConfigChoice, VectorContainerLogConfig},
3938
role_utils::{GenericProductSpecificCommonConfig, RoleGroupConfig},
39+
types::{
40+
kubernetes::{ListenerClassName, NamespaceName, Uid},
41+
operator::{
42+
ClusterName, ControllerName, OperatorName, ProductName, ProductVersion,
43+
RoleGroupName, RoleName,
44+
},
45+
},
4046
},
4147
};
4248

@@ -387,10 +393,13 @@ mod tests {
387393
v1alpha1::{self, OpenSearchKeystore, SecretKeyRef},
388394
},
389395
framework::{
390-
ClusterName, ListenerClassName, NamespaceName, OperatorName, ProductVersion,
391-
RoleGroupName, SecretKey, SecretName, builder::pod::container::EnvVarSet,
396+
builder::pod::container::EnvVarSet,
392397
product_logging::framework::ValidatedContainerLogConfigChoice,
393398
role_utils::GenericProductSpecificCommonConfig,
399+
types::{
400+
kubernetes::{ListenerClassName, NamespaceName, SecretKey, SecretName},
401+
operator::{ClusterName, OperatorName, ProductVersion, RoleGroupName},
402+
},
394403
},
395404
};
396405

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ use stackable_operator::{
1010
use strum::{EnumDiscriminants, IntoStaticStr};
1111

1212
use super::{Applied, ContextNames, KubernetesResources, Prepared};
13-
use crate::framework::{ClusterName, NamespaceName, Uid, cluster_resources::cluster_resources_new};
13+
use crate::framework::{
14+
cluster_resources::cluster_resources_new,
15+
types::{
16+
kubernetes::{NamespaceName, Uid},
17+
operator::ClusterName,
18+
},
19+
};
1420

1521
#[derive(Snafu, Debug, EnumDiscriminants)]
1622
#[strum_discriminants(derive(IntoStaticStr))]

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,15 @@ mod tests {
8282
v1alpha1::{self, OpenSearchKeystore, SecretKeyRef},
8383
},
8484
framework::{
85-
ClusterName, ControllerName, ListenerClassName, NamespaceName, OperatorName,
86-
ProductName, ProductVersion, RoleGroupName, SecretKey, SecretName,
87-
builder::pod::container::EnvVarSet, role_utils::GenericProductSpecificCommonConfig,
85+
builder::pod::container::EnvVarSet,
86+
role_utils::GenericProductSpecificCommonConfig,
87+
types::{
88+
kubernetes::{ListenerClassName, NamespaceName, SecretKey, SecretName},
89+
operator::{
90+
ClusterName, ControllerName, OperatorName, ProductName, ProductVersion,
91+
RoleGroupName,
92+
},
93+
},
8894
},
8995
};
9096

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use crate::{
1010
controller::OpenSearchRoleGroupConfig,
1111
crd::v1alpha1,
1212
framework::{
13-
RoleGroupName, ServiceName,
1413
builder::pod::container::{EnvVarName, EnvVarSet},
1514
role_group_utils,
15+
types::{kubernetes::ServiceName, operator::RoleGroupName},
1616
},
1717
};
1818

@@ -315,9 +315,12 @@ mod tests {
315315
controller::{ValidatedLogging, ValidatedOpenSearchConfig},
316316
crd::NodeRoles,
317317
framework::{
318-
ClusterName, ListenerClassName, NamespaceName, ProductVersion, RoleGroupName,
319318
product_logging::framework::ValidatedContainerLogConfigChoice,
320319
role_utils::GenericProductSpecificCommonConfig,
320+
types::{
321+
kubernetes::{ListenerClassName, NamespaceName},
322+
operator::{ClusterName, ProductVersion, RoleGroupName},
323+
},
321324
},
322325
};
323326

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,15 @@ mod tests {
241241
},
242242
crd::{NodeRoles, v1alpha1},
243243
framework::{
244-
ClusterName, ControllerName, ListenerClassName, NamespaceName, OperatorName,
245-
ProductName, ProductVersion, RoleGroupName, builder::pod::container::EnvVarSet,
244+
builder::pod::container::EnvVarSet,
246245
role_utils::GenericProductSpecificCommonConfig,
246+
types::{
247+
kubernetes::{ListenerClassName, NamespaceName},
248+
operator::{
249+
ClusterName, ControllerName, OperatorName, ProductName, ProductVersion,
250+
RoleGroupName,
251+
},
252+
},
247253
},
248254
};
249255

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ use crate::{
4444
},
4545
crd::v1alpha1,
4646
framework::{
47-
PersistentVolumeClaimName, RoleGroupName, ServiceAccountName, ServiceName, VolumeName,
4847
builder::{
4948
meta::ownerreference_from_resource,
5049
pod::{
@@ -57,6 +56,10 @@ use crate::{
5756
STACKABLE_LOG_DIR, ValidatedContainerLogConfigChoice, vector_container,
5857
},
5958
role_group_utils::ResourceNames,
59+
types::{
60+
kubernetes::{PersistentVolumeClaimName, ServiceAccountName, ServiceName, VolumeName},
61+
operator::RoleGroupName,
62+
},
6063
},
6164
};
6265

@@ -759,11 +762,19 @@ mod tests {
759762
v1alpha1::{self, OpenSearchKeystore, SecretKeyRef},
760763
},
761764
framework::{
762-
ClusterName, ConfigMapName, ControllerName, ListenerClassName, NamespaceName,
763-
OperatorName, ProductName, ProductVersion, RoleGroupName, SecretKey, SecretName,
764-
ServiceAccountName, ServiceName, builder::pod::container::EnvVarSet,
765+
builder::pod::container::EnvVarSet,
765766
product_logging::framework::VectorContainerLogConfig,
766767
role_utils::GenericProductSpecificCommonConfig,
768+
types::{
769+
kubernetes::{
770+
ConfigMapName, ListenerClassName, NamespaceName, SecretKey, SecretName,
771+
ServiceAccountName, ServiceName,
772+
},
773+
operator::{
774+
ClusterName, ControllerName, OperatorName, ProductName, ProductVersion,
775+
RoleGroupName,
776+
},
777+
},
767778
},
768779
};
769780

0 commit comments

Comments
 (0)