Skip to content

Commit e559188

Browse files
committed
implement cluster operation
1 parent 4f42a32 commit e559188

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

deploy/helm/spark-k8s-operator/crds/crds.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,21 @@ spec:
18951895
- external-stable
18961896
type: string
18971897
type: object
1898+
clusterOperation:
1899+
default:
1900+
reconciliationPaused: false
1901+
stopped: false
1902+
description: '[Cluster operations](https://docs.stackable.tech/home/nightly/concepts/operations/cluster_operations) properties, allow stopping the product instance as well as pausing reconciliation.'
1903+
properties:
1904+
reconciliationPaused:
1905+
default: false
1906+
description: Flag to stop cluster reconciliation by the operator. This means that all changes in the custom resource spec are ignored until this flag is set to false or removed. The operator will however still watch the deployed resources at the time and update the custom resource status field. If applied at the same time with `stopped`, `reconciliationPaused` will take precedence over `stopped` and stop the reconciliation immediately.
1907+
type: boolean
1908+
stopped:
1909+
default: false
1910+
description: Flag to stop the cluster. This means all deployed resources (e.g. Services, StatefulSets, ConfigMaps) are kept but all deployed Pods (e.g. replicas from a StatefulSet) are scaled to 0 and therefore stopped and removed. If applied at the same time with `reconciliationPaused`, the latter will pause reconciliation and `stopped` will take no effect until `reconciliationPaused` is set to false or removed.
1911+
type: boolean
1912+
type: object
18981913
image:
18991914
anyOf:
19001915
- required:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pub async fn reconcile(
233233
OPERATOR_NAME,
234234
CONNECT_CONTROLLER_NAME,
235235
&scs.object_ref(&()),
236-
ClusterResourceApplyStrategy::Default,
236+
ClusterResourceApplyStrategy::from(&scs.spec.cluster_operation),
237237
)
238238
.context(CreateClusterResourcesSnafu)?;
239239

rust/operator-binary/src/connect/crd.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
33
use snafu::{ResultExt, Snafu};
44
use stackable_operator::{
55
commons::{
6+
cluster_operation::ClusterOperation,
67
product_image_selection::ProductImage,
78
resources::{
89
CpuLimitsFragment, MemoryLimitsFragment, NoRuntimeLimits, NoRuntimeLimitsFragment,
@@ -82,6 +83,10 @@ pub mod versioned {
8283
#[serde(default)]
8384
pub cluster_config: v1alpha1::SparkConnectServerClusterConfig,
8485

86+
// no doc string - See ClusterOperation struct
87+
#[serde(default)]
88+
pub cluster_operation: ClusterOperation,
89+
8590
/// Name of the Vector aggregator discovery ConfigMap.
8691
/// It must contain the key `ADDRESS` with the address of the Vector aggregator.
8792
#[serde(skip_serializing_if = "Option::is_none")]

0 commit comments

Comments
 (0)