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

Defaulting internal zookeper #1398

Merged
merged 4 commits into from
Feb 14, 2025
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
4 changes: 2 additions & 2 deletions apis/kubedb/v1alpha2/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions apis/kubedb/v1alpha2/solr_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,34 @@ func (s Solr) CoordinatorSelectors() map[string]string {
return s.OffshootSelectors(map[string]string{string(SolrNodeRoleCoordinator): SolrNodeRoleSet})
}

func (s *Solr) SetDefaultsToZooKeeperRef() {
if s.Spec.ZookeeperRef == nil {
s.Spec.ZookeeperRef = &ZookeeperRef{}
}
s.SetZooKeeperObjectRef()
if s.Spec.ZookeeperRef.Version == nil {
defaultVersion := "3.7.2"
s.Spec.ZookeeperRef.Version = &defaultVersion
}
}

func (s *Solr) GetZooKeeperName() string {
return s.OffshootName() + "-zk"
}

func (s *Solr) SetZooKeeperObjectRef() {
if s.Spec.ZookeeperRef.ObjectReference == nil {
s.Spec.ZookeeperRef.ObjectReference = &kmapi.ObjectReference{}
}
if s.Spec.ZookeeperRef.Name == "" {
s.Spec.ZookeeperRef.ExternallyManaged = false
s.Spec.ZookeeperRef.Name = s.GetZooKeeperName()
}
if s.Spec.ZookeeperRef.Namespace == "" {
s.Spec.ZookeeperRef.Namespace = s.Namespace
}
}

func (s *Solr) SetDefaults() {
if s.Spec.DeletionPolicy == "" {
s.Spec.DeletionPolicy = DeletionPolicyDelete
Expand All @@ -285,6 +313,9 @@ func (s *Solr) SetDefaults() {
s.Spec.StorageType = StorageTypeDurable
}

s.SetDefaultsToZooKeeperRef()
s.SetZooKeeperObjectRef()

if s.Spec.ZookeeperDigestSecret == nil {
s.Spec.ZookeeperDigestSecret = &v1.LocalObjectReference{
Name: s.SolrSecretName("zk-digest"),
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/solr_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type SolrSpec struct {
Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"`

// // ZooKeeper contains information for Solr to store configurations for collections
ZookeeperRef *kmapi.ObjectReference `json:"zookeeperRef,omitempty"`
ZookeeperRef *ZookeeperRef `json:"zookeeperRef,omitempty"`

// +optional
SolrModules []string `json:"solrModules,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crds/kubedb.com_solrs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13158,10 +13158,16 @@ spec:
x-kubernetes-map-type: atomic
zookeeperRef:
properties:
externallyManaged:
type: boolean
name:
type: string
namespace:
type: string
pathsBase:
type: string
version:
type: string
required:
- name
type: object
Expand Down
Loading