@@ -105,6 +105,10 @@ func (c *ClickHouse) OffshootLabels() map[string]string {
105105 return c .offshootLabels (c .OffshootSelectors (), nil )
106106}
107107
108+ func (c * ClickHouse ) OffshootDBLabels () map [string ]string {
109+ return c .offshootLabels (c .OffshootDBSelectors (), nil )
110+ }
111+
108112func (c * ClickHouse ) ServiceLabels (alias ServiceAlias , extraLabels ... map [string ]string ) map [string ]string {
109113 svcTemplate := GetServiceTemplate (c .Spec .ServiceTemplates , alias )
110114 return c .offshootLabels (meta_util .OverwriteKeys (c .OffshootSelectors (), extraLabels ... ), svcTemplate .Labels )
@@ -114,10 +118,6 @@ func (c *ClickHouse) OffshootKeeperLabels() map[string]string {
114118 return c .offshootKeeperLabels (c .OffshootKeeperSelectors (), nil )
115119}
116120
117- func (c * ClickHouse ) OffshootClusterLabels (petSetName string ) map [string ]string {
118- return c .offshootLabels (c .OffshootClusterSelectors (petSetName ), nil )
119- }
120-
121121func (c * ClickHouse ) offshootLabels (selector , override map [string ]string ) map [string ]string {
122122 selector [meta_util .ComponentLabelKey ] = kubedb .ComponentDatabase
123123 return meta_util .FilterKeys (kubedb .GroupName , selector , meta_util .OverwriteKeys (nil , c .Labels , override ))
@@ -140,19 +140,20 @@ func (c *ClickHouse) OffshootSelectors(extraSelectors ...map[string]string) map[
140140
141141func (c * ClickHouse ) OffshootKeeperSelectors (extraSelectors ... map [string ]string ) map [string ]string {
142142 selector := map [string ]string {
143+ meta_util .ComponentLabelKey : kubedb .ComponentCoOrdinator ,
143144 meta_util .NameLabelKey : c .ResourceFQN (),
144145 meta_util .InstanceLabelKey : c .Name ,
145146 meta_util .ManagedByLabelKey : kubedb .GroupName ,
146147 }
147148 return meta_util .OverwriteKeys (selector , extraSelectors ... )
148149}
149150
150- func (c * ClickHouse ) OffshootClusterSelectors ( petSetName string , extraSelectors ... map [string ]string ) map [string ]string {
151+ func (c * ClickHouse ) OffshootDBSelectors ( extraSelectors ... map [string ]string ) map [string ]string {
151152 selector := map [string ]string {
153+ meta_util .ComponentLabelKey : kubedb .ComponentDatabase ,
152154 meta_util .NameLabelKey : c .ResourceFQN (),
153155 meta_util .InstanceLabelKey : c .Name ,
154156 meta_util .ManagedByLabelKey : kubedb .GroupName ,
155- meta_util .PartOfLabelKey : petSetName ,
156157 }
157158 return meta_util .OverwriteKeys (selector , extraSelectors ... )
158159}
@@ -233,11 +234,11 @@ func (c *ClickHouse) PodLabels(extraLabels ...map[string]string) map[string]stri
233234}
234235
235236func (c * ClickHouse ) KeeperPodLabels (extraLabels ... map [string ]string ) map [string ]string {
236- return c .offshootLabels (meta_util .OverwriteKeys (c .OffshootKeeperSelectors (), extraLabels ... ), c .Spec .ClusterTopology .ClickHouseKeeper .Spec .PodTemplate .Labels )
237+ return c .offshootKeeperLabels (meta_util .OverwriteKeys (c .OffshootKeeperSelectors (), extraLabels ... ), c .Spec .ClusterTopology .ClickHouseKeeper .Spec .PodTemplate .Labels )
237238}
238239
239- func (c * ClickHouse ) ClusterPodLabels ( petSetName string , labels map [string ]string , extraLabels ... map [string ]string ) map [string ]string {
240- return c .offshootLabels (meta_util .OverwriteKeys (c .OffshootClusterSelectors ( petSetName ), extraLabels ... ), labels )
240+ func (c * ClickHouse ) DBPodLabels ( labels map [string ]string , extraLabels ... map [string ]string ) map [string ]string {
241+ return c .offshootLabels (meta_util .OverwriteKeys (c .OffshootDBSelectors ( ), extraLabels ... ), labels )
241242}
242243
243244func (c * ClickHouse ) GetConnectionScheme () string {
@@ -331,16 +332,20 @@ func (c *ClickHouse) SetDefaults(kc client.Client) {
331332 klog .Errorf ("can't get the clickhouse version object %s for %s \n " , err .Error (), c .Spec .Version )
332333 return
333334 }
334-
335- if c .Spec .TLS != nil && c .Spec .TLS .ClientCACertificateRefs != nil {
336- for i , secret := range c .Spec .TLS .ClientCACertificateRefs {
337- if secret .Key == "" {
338- c .Spec .TLS .ClientCACertificateRefs [i ].Key = kubedb .CACert
339- }
340- if secret .Optional == nil {
341- c .Spec .TLS .ClientCACertificateRefs [i ].Optional = ptr .To (false )
335+ if c .Spec .TLS != nil {
336+ if c .Spec .TLS .ClientCACertificateRefs != nil {
337+ for i , secret := range c .Spec .TLS .ClientCACertificateRefs {
338+ if secret .Key == "" {
339+ c .Spec .TLS .ClientCACertificateRefs [i ].Key = kubedb .CACert
340+ }
341+ if secret .Optional == nil {
342+ c .Spec .TLS .ClientCACertificateRefs [i ].Optional = ptr .To (false )
343+ }
342344 }
343345 }
346+ if c .Spec .SSLVerificationMode == "" {
347+ c .Spec .SSLVerificationMode = SSLVerificationModeRelaxed
348+ }
344349 }
345350
346351 if c .Spec .ClusterTopology != nil {
0 commit comments