Skip to content

Commit

Permalink
Merge pull request #897 from RedHatInsights/psav/fix_msk
Browse files Browse the repository at this point in the history
Fix MSK replicas
  • Loading branch information
psav authored Nov 15, 2023
2 parents 8526928 + ab08087 commit 00fcc76
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apis/cloud.redhat.com/v1alpha1/clowdenvironment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ type KafkaConfig struct {

// (Deprecated) (Unused)
Suffix string `json:"suffix,omitempty"`

// Sets the replica count for ephem-msk mode for kafka connect
KafkaConnectReplicaCount int `json:"kafkaConnectReplicaCount,omitempty"`
}

// DatabaseMode details the mode of operation of the Clowder Database Provider
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/cloud.redhat.com_clowdenvironments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ spec:
enableLegacyStrimzi:
description: EnableLegacyStrimzi disables TLS + user auth
type: boolean
kafkaConnectReplicaCount:
description: Sets the replica count for ephem-msk mode for
kafka connect
type: integer
managedPrefix:
description: Managed topic prefix for the managed cluster.
Only used in (*_managed_*) mode.
Expand Down
12 changes: 9 additions & 3 deletions controllers/cloud.redhat.com/providers/kafka/msk.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kafka
import (
"encoding/json"
"fmt"
"strconv"
"strings"

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

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

replicas := 3
if s.Env.Spec.Providers.Kafka.KafkaConnectReplicaCount != 0 {
replicas = s.Env.Spec.Providers.Kafka.KafkaConnectReplicaCount
}

connectConfig := genericConfig{
"config.storage.replication.factor": "1",
"config.storage.replication.factor": strconv.Itoa(replicas),
"config.storage.topic": fmt.Sprintf("%v-connect-cluster-configs", s.Env.Name),
"connector.client.config.override.policy": "All",
"group.id": "connect-cluster",
"offset.storage.replication.factor": "1",
"offset.storage.replication.factor": strconv.Itoa(replicas),
"offset.storage.topic": fmt.Sprintf("%v-connect-cluster-offsets", s.Env.Name),
"status.storage.replication.factor": "1",
"status.storage.replication.factor": strconv.Itoa(replicas),
"status.storage.topic": fmt.Sprintf("%v-connect-cluster-status", s.Env.Name),
}

Expand Down
4 changes: 4 additions & 0 deletions deploy-mutate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6524,6 +6524,10 @@ objects:
enableLegacyStrimzi:
description: EnableLegacyStrimzi disables TLS + user auth
type: boolean
kafkaConnectReplicaCount:
description: Sets the replica count for ephem-msk mode for
kafka connect
type: integer
managedPrefix:
description: Managed topic prefix for the managed cluster.
Only used in (*_managed_*) mode.
Expand Down
4 changes: 4 additions & 0 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6524,6 +6524,10 @@ objects:
enableLegacyStrimzi:
description: EnableLegacyStrimzi disables TLS + user auth
type: boolean
kafkaConnectReplicaCount:
description: Sets the replica count for ephem-msk mode for
kafka connect
type: integer
managedPrefix:
description: Managed topic prefix for the managed cluster.
Only used in (*_managed_*) mode.
Expand Down
1 change: 1 addition & 0 deletions docs/antora/modules/ROOT/pages/api_reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ KafkaConfig configures the Clowder provider controlling the creation of Kafka in
| *`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.
| *`connectClusterName`* __string__ | (Deprecated) Defines the kafka connect cluster name that is used in this environment.
| *`suffix`* __string__ | (Deprecated) (Unused)
| *`kafkaConnectReplicaCount`* __integer__ | Sets the replica count for ephem-msk mode for kafka connect
|===


Expand Down
1 change: 1 addition & 0 deletions tests/kuttl/test-kafka-msk/03-pods.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
namespace: test-kafka-msk-sec-source
clusterAnnotation: test-kafka-msk
topicNamespace: test-kafka-msk-sec-source
kafkaConnectReplicaCount: 1
db:
mode: none
logging:
Expand Down

0 comments on commit 00fcc76

Please sign in to comment.