Skip to content

Commit 00fcc76

Browse files
authored
Merge pull request #897 from RedHatInsights/psav/fix_msk
Fix MSK replicas
2 parents 8526928 + ab08087 commit 00fcc76

File tree

7 files changed

+26
-3
lines changed

7 files changed

+26
-3
lines changed

apis/cloud.redhat.com/v1alpha1/clowdenvironment_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ type KafkaConfig struct {
275275

276276
// (Deprecated) (Unused)
277277
Suffix string `json:"suffix,omitempty"`
278+
279+
// Sets the replica count for ephem-msk mode for kafka connect
280+
KafkaConnectReplicaCount int `json:"kafkaConnectReplicaCount,omitempty"`
278281
}
279282

280283
// DatabaseMode details the mode of operation of the Clowder Database Provider

config/crd/bases/cloud.redhat.com_clowdenvironments.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ spec:
316316
enableLegacyStrimzi:
317317
description: EnableLegacyStrimzi disables TLS + user auth
318318
type: boolean
319+
kafkaConnectReplicaCount:
320+
description: Sets the replica count for ephem-msk mode for
321+
kafka connect
322+
type: integer
319323
managedPrefix:
320324
description: Managed topic prefix for the managed cluster.
321325
Only used in (*_managed_*) mode.

controllers/cloud.redhat.com/providers/kafka/msk.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package kafka
33
import (
44
"encoding/json"
55
"fmt"
6+
"strconv"
67
"strings"
78

89
crd "github.com/RedHatInsights/clowder/apis/cloud.redhat.com/v1alpha1"
@@ -199,14 +200,19 @@ type genericConfig map[string]string
199200

200201
func (s mskProvider) connectConfig(config *apiextensions.JSON) error {
201202

203+
replicas := 3
204+
if s.Env.Spec.Providers.Kafka.KafkaConnectReplicaCount != 0 {
205+
replicas = s.Env.Spec.Providers.Kafka.KafkaConnectReplicaCount
206+
}
207+
202208
connectConfig := genericConfig{
203-
"config.storage.replication.factor": "1",
209+
"config.storage.replication.factor": strconv.Itoa(replicas),
204210
"config.storage.topic": fmt.Sprintf("%v-connect-cluster-configs", s.Env.Name),
205211
"connector.client.config.override.policy": "All",
206212
"group.id": "connect-cluster",
207-
"offset.storage.replication.factor": "1",
213+
"offset.storage.replication.factor": strconv.Itoa(replicas),
208214
"offset.storage.topic": fmt.Sprintf("%v-connect-cluster-offsets", s.Env.Name),
209-
"status.storage.replication.factor": "1",
215+
"status.storage.replication.factor": strconv.Itoa(replicas),
210216
"status.storage.topic": fmt.Sprintf("%v-connect-cluster-status", s.Env.Name),
211217
}
212218

deploy-mutate.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6524,6 +6524,10 @@ objects:
65246524
enableLegacyStrimzi:
65256525
description: EnableLegacyStrimzi disables TLS + user auth
65266526
type: boolean
6527+
kafkaConnectReplicaCount:
6528+
description: Sets the replica count for ephem-msk mode for
6529+
kafka connect
6530+
type: integer
65276531
managedPrefix:
65286532
description: Managed topic prefix for the managed cluster.
65296533
Only used in (*_managed_*) mode.

deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6524,6 +6524,10 @@ objects:
65246524
enableLegacyStrimzi:
65256525
description: EnableLegacyStrimzi disables TLS + user auth
65266526
type: boolean
6527+
kafkaConnectReplicaCount:
6528+
description: Sets the replica count for ephem-msk mode for
6529+
kafka connect
6530+
type: integer
65276531
managedPrefix:
65286532
description: Managed topic prefix for the managed cluster.
65296533
Only used in (*_managed_*) mode.

docs/antora/modules/ROOT/pages/api_reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ KafkaConfig configures the Clowder provider controlling the creation of Kafka in
10091009
| *`connectNamespace`* __string__ | (Deprecated) The namespace that the Kafka Connect cluster is expected to reside in. This is only used in (*_app-interface_*) and (*_operator_*) modes.
10101010
| *`connectClusterName`* __string__ | (Deprecated) Defines the kafka connect cluster name that is used in this environment.
10111011
| *`suffix`* __string__ | (Deprecated) (Unused)
1012+
| *`kafkaConnectReplicaCount`* __integer__ | Sets the replica count for ephem-msk mode for kafka connect
10121013
|===
10131014

10141015

tests/kuttl/test-kafka-msk/03-pods.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
namespace: test-kafka-msk-sec-source
2121
clusterAnnotation: test-kafka-msk
2222
topicNamespace: test-kafka-msk-sec-source
23+
kafkaConnectReplicaCount: 1
2324
db:
2425
mode: none
2526
logging:

0 commit comments

Comments
 (0)