Skip to content

Commit 34bde59

Browse files
committed
fix cluster operation tests
1 parent f2b97a5 commit 34bde59

14 files changed

Lines changed: 121 additions & 26 deletions

File tree

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,3 @@ properties:
149149
required: false
150150
asOfVersion: "0.0.0"
151151
description: "The number of seconds after which the OPA authorizer cache expires"
152-
153-
- property: &logDirs
154-
propertyNames:
155-
- name: "log.dirs"
156-
kind:
157-
type: "file"
158-
file: "broker.properties"
159-
datatype:
160-
type: "string"
161-
recommendedValues:
162-
- value: "/stackable/data/topicdata"
163-
roles:
164-
- name: "broker"
165-
required: true
166-
asOfVersion: "0.0.0"
167-
description: "A comma separated list of directories under which to store log files"

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,14 @@ spec:
609609
- roleGroups
610610
type: object
611611
clusterConfig:
612+
default:
613+
authentication: []
614+
authorization:
615+
opa: null
616+
tls:
617+
internalSecretClass: tls
618+
serverSecretClass: tls
619+
zookeeperConfigMapName: null
612620
description: |-
613621
Kafka settings that affect all roles and role groups.
614622
@@ -1320,7 +1328,6 @@ spec:
13201328
type: string
13211329
type: object
13221330
required:
1323-
- clusterConfig
13241331
- image
13251332
type: object
13261333
status:

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ pub mod versioned {
123123
/// Kafka settings that affect all roles and role groups.
124124
///
125125
/// The settings in the `clusterConfig` are cluster wide settings that do not need to be configurable at role or role group level.
126+
#[serde(default)]
126127
pub cluster_config: v1alpha1::KafkaClusterConfig,
127128

128129
// no doc - docs in ClusterOperation struct.
@@ -164,6 +165,18 @@ pub mod versioned {
164165
}
165166
}
166167

168+
impl Default for v1alpha1::KafkaClusterConfig {
169+
fn default() -> Self {
170+
Self {
171+
authentication: vec![],
172+
authorization: KafkaAuthorization::default(),
173+
tls: tls::default_kafka_tls(),
174+
vector_aggregator_config_map_name: None,
175+
zookeeper_config_map_name: None,
176+
}
177+
}
178+
}
179+
167180
impl HasStatusCondition for v1alpha1::KafkaCluster {
168181
fn conditions(&self) -> Vec<ClusterCondition> {
169182
match &self.status {

tests/templates/kuttl/cluster-operation/10-assert.yaml renamed to tests/templates/kuttl/cluster-operation/10-assert.yaml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% if test_scenario['values']['use-kraft-controller'] == 'false' %}
12
---
23
apiVersion: kuttl.dev/v1beta1
34
kind: TestAssert
@@ -10,3 +11,4 @@ metadata:
1011
status:
1112
readyReplicas: 1
1213
replicas: 1
14+
{% endif %}

tests/templates/kuttl/cluster-operation/10-install-zk.yaml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% if test_scenario['values']['use-kraft-controller'] == 'false' %}
12
---
23
apiVersion: zookeeper.stackable.tech/v1alpha1
34
kind: ZookeeperCluster
@@ -18,3 +19,4 @@ spec:
1819
roleGroups:
1920
default:
2021
replicas: 1
22+
{% endif %}

tests/templates/kuttl/cluster-operation/50-assert.yaml renamed to tests/templates/kuttl/cluster-operation/20-assert.yaml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ metadata:
1212
status:
1313
readyReplicas: 1
1414
replicas: 1
15+
{% if test_scenario['values']['use-kraft-controller'] == 'true' %}
16+
---
17+
apiVersion: apps/v1
18+
kind: StatefulSet
19+
metadata:
20+
name: test-kafka-controller-default
21+
status:
22+
readyReplicas: 1
23+
replicas: 1
24+
{% endif %}

tests/templates/kuttl/cluster-operation/20-install-kafka.yaml.j2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ spec:
1616
productVersion: "{{ test_scenario['values']['kafka-latest'] }}"
1717
{% endif %}
1818
pullPolicy: IfNotPresent
19+
{% if lookup('env', 'VECTOR_AGGREGATOR') or test_scenario['values']['use-kraft-controller'] == 'false' %}
1920
clusterConfig:
21+
{% endif %}
2022
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
2123
vectorAggregatorConfigMapName: vector-aggregator-discovery
2224
{% endif %}
25+
{% if test_scenario['values']['use-kraft-controller'] == 'false' %}
2326
zookeeperConfigMapName: test-zk
27+
{% else %}
28+
controllers:
29+
config:
30+
logging:
31+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
32+
roleGroups:
33+
default:
34+
replicas: 1
35+
{% endif %}
2436
brokers:
2537
config:
2638
logging:

tests/templates/kuttl/cluster-operation/30-assert.yaml renamed to tests/templates/kuttl/cluster-operation/30-assert.yaml.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ metadata:
1111
name: test-kafka-broker-default
1212
status:
1313
replicas: 0
14+
{% if test_scenario['values']['use-kraft-controller'] == 'true' %}
15+
---
16+
apiVersion: apps/v1
17+
kind: StatefulSet
18+
metadata:
19+
name: test-kafka-controller-default
20+
status:
21+
replicas: 0
22+
{% endif %}

tests/templates/kuttl/cluster-operation/30-stop-kafka.yaml.j2

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,30 @@ spec:
1616
productVersion: "{{ test_scenario['values']['kafka-latest'] }}"
1717
{% endif %}
1818
pullPolicy: IfNotPresent
19+
{% if lookup('env', 'VECTOR_AGGREGATOR') or test_scenario['values']['use-kraft-controller'] == 'false' %}
1920
clusterConfig:
21+
{% endif %}
2022
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
2123
vectorAggregatorConfigMapName: vector-aggregator-discovery
2224
{% endif %}
25+
{% if test_scenario['values']['use-kraft-controller'] == 'false' %}
2326
zookeeperConfigMapName: test-zk
24-
clusterOperation:
25-
stopped: true
26-
reconciliationPaused: false
27+
{% else %}
28+
brokers:
29+
config:
30+
logging:
31+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
32+
roleGroups:
33+
default:
34+
replicas: 1
35+
{% endif %}
2736
brokers:
2837
config:
2938
logging:
3039
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
3140
roleGroups:
3241
default:
3342
replicas: 1
43+
clusterOperation:
44+
stopped: true
45+
reconciliationPaused: false

tests/templates/kuttl/cluster-operation/40-assert.yaml renamed to tests/templates/kuttl/cluster-operation/40-assert.yaml.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ metadata:
1111
name: test-kafka-broker-default
1212
status:
1313
replicas: 0
14+
{% if test_scenario['values']['use-kraft-controller'] == 'true' %}
15+
---
16+
apiVersion: apps/v1
17+
kind: StatefulSet
18+
metadata:
19+
name: test-kafka-controller-default
20+
status:
21+
replicas: 0
22+
{% endif %}

0 commit comments

Comments
 (0)