Skip to content

Commit

Permalink
Add helpers for appbinding
Browse files Browse the repository at this point in the history
Signed-off-by: raihankhan <[email protected]>
  • Loading branch information
raihankhan committed Dec 7, 2022
1 parent d0e02d1 commit 6e752fd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apis/kubedb/v1alpha2/kafka_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha2

import (
"fmt"
appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1"
"path/filepath"
"strings"

Expand Down Expand Up @@ -280,3 +281,27 @@ func (kfTopology *KafkaClusterTopology) ToMap() map[KafkaNodeRoleType]KafkaNode
}
return topology
}

type KafkaApp struct {
*Kafka
}

func (r KafkaApp) Name() string {
return r.Kafka.Name
}

func (r KafkaApp) Type() appcat.AppType {
return appcat.AppType(fmt.Sprintf("%s/%s", kubedb.GroupName, ResourceSingularKafka))
}

func (k *Kafka) AppBindingMeta() appcat.AppBindingMeta {
return &KafkaApp{k}
}

func (k *Kafka) GetConnectionScheme() string {
scheme := "http"
if k.Spec.EnableSSL {
scheme = "https"
}
return scheme
}

0 comments on commit 6e752fd

Please sign in to comment.