Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant helper functions for Kafka and Update constants #1074

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions apis/kubedb/v1alpha2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,13 @@ const (
KafkaPortNameCruiseControlREST = "cc-rest"
KafkaBrokerClientPortName = "broker"
KafkaControllerClientPortName = "controller"
KafkaPortNameInternal = "internal"
KafkaPortNameExternal = "external"
KafkaPortNameLocal = "local"
KafkaTopicNameHealth = "kafka-health"
KafkaTopicDeletionThresholdOffset = 1000
KafkaControllerMaxID = 1000
KafkaBrokerMaxID = 1000
KafkaRESTPort = 9092
KafkaControllerRESTPort = 9093
KafkaInternalRESTPort = 29092
KafkaExternalRESTPort = 19092
KafkaLocalRESTPort = 29092
KafkaCruiseControlRESTPort = 9090
KafkaCruiseControlListenerPort = 9094
KafkaCCDefaultInNetwork = 500000
Expand Down
8 changes: 0 additions & 8 deletions apis/kubedb/v1alpha2/kafka_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ func (k *Kafka) GoverningServiceName() string {
return meta_util.NameWithSuffix(k.ServiceName(), "pods")
}

func (k *Kafka) GoverningServiceNameController() string {
return meta_util.NameWithSuffix(k.ServiceName(), KafkaNodeRolesController)
}

func (k *Kafka) GoverningServiceNameBroker() string {
return meta_util.NameWithSuffix(k.ServiceName(), KafkaNodeRolesBrokers)
}

func (k *Kafka) GoverningServiceNameCruiseControl() string {
return meta_util.NameWithSuffix(k.ServiceName(), KafkaNodeRolesCruiseControl)
}
Expand Down
3 changes: 1 addition & 2 deletions apis/kubedb/v1alpha2/kafka_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ type KafkaListenerType string
const (
KafkaListenerBroker KafkaListenerType = "BROKER"
KafkaListenerController KafkaListenerType = "CONTROLLER"
KafkaListenerInternal KafkaListenerType = "INTERNAL"
KafkaListenerExternal KafkaListenerType = "EXTERNAL"
KafkaListenerLocal KafkaListenerType = "LOCAL"
KafkaListenerCC KafkaListenerType = "CC"
)

Expand Down
14 changes: 14 additions & 0 deletions apis/kubedb/v1alpha2/kafka_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ func (k *Kafka) ValidateDelete() error {
func (k *Kafka) ValidateCreateOrUpdate() error {
var allErr field.ErrorList
// TODO(user): fill in your validation logic upon object creation.
if k.Spec.EnableSSL {
if k.Spec.TLS == nil {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("enableSSL"),
k.Name,
".spec.tls can't be nil, if .spec.enableSSL is true"))
}
} else {
if k.Spec.TLS != nil {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("enableSSL"),
k.Name,
".spec.tls must be nil, if .spec.enableSSL is disabled"))
}
}
if k.Spec.Topology != nil {
if k.Spec.Topology.Controller == nil {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology").Child("controller"),
Expand Down Expand Up @@ -195,6 +208,7 @@ var availableVersions = []string{
"3.4.0",
"3.4.1",
"3.5.1",
"3.6.0",
}

func validateVersion(db *Kafka) error {
Expand Down
Loading