@@ -203,15 +203,6 @@ pub enum CurrentlySupportedListenerClasses {
203203 ExternalUnstable ,
204204}
205205
206- impl CurrentlySupportedListenerClasses {
207- pub fn k8s_service_type ( & self ) -> String {
208- match self {
209- CurrentlySupportedListenerClasses :: ClusterInternal => "ClusterIP" . to_string ( ) ,
210- CurrentlySupportedListenerClasses :: ExternalUnstable => "NodePort" . to_string ( ) ,
211- }
212- }
213- }
214-
215206#[ derive( Clone , Debug , Default , Fragment , JsonSchema , PartialEq ) ]
216207#[ fragment_attrs(
217208 derive(
@@ -290,6 +281,102 @@ pub enum Container {
290281 Zookeeper ,
291282}
292283
284+ #[ derive(
285+ Clone ,
286+ Debug ,
287+ Deserialize ,
288+ Display ,
289+ EnumIter ,
290+ Eq ,
291+ Hash ,
292+ JsonSchema ,
293+ PartialEq ,
294+ Serialize ,
295+ EnumString ,
296+ ) ]
297+ #[ strum( serialize_all = "camelCase" ) ]
298+ pub enum ZookeeperRole {
299+ #[ strum( serialize = "server" ) ]
300+ Server ,
301+ }
302+
303+ #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
304+ #[ serde( rename_all = "camelCase" ) ]
305+ pub struct ZookeeperClusterStatus {
306+ /// An opaque value that changes every time a discovery detail does
307+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
308+ pub discovery_hash : Option < String > ,
309+ #[ serde( default ) ]
310+ pub conditions : Vec < ClusterCondition > ,
311+ }
312+
313+ pub enum LoggingFramework {
314+ LOG4J ,
315+ LOGBACK ,
316+ }
317+
318+ /// Reference to a single `Pod` that is a component of a [`ZookeeperCluster`]
319+ ///
320+ /// Used for service discovery.
321+ pub struct ZookeeperPodRef {
322+ pub namespace : String ,
323+ pub role_group_service_name : String ,
324+ pub pod_name : String ,
325+ pub zookeeper_myid : u16 ,
326+ }
327+
328+ /// A claim for a single ZooKeeper ZNode tree (filesystem node).
329+ ///
330+ /// A ConfigMap will automatically be created with the same name, containing the connection string in the field `ZOOKEEPER`.
331+ /// Each ZookeeperZnode gets an isolated ZNode chroot, which the `ZOOKEEPER` automatically contains.
332+ /// All data inside of this chroot will be deleted when the corresponding `ZookeeperZnode` is.
333+ ///
334+ /// `ZookeeperZnode` is *not* designed to manage the contents of this ZNode. Instead, it should be used to create a chroot
335+ /// for an installation of an application to work inside. Initializing the contents is the responsibility of the application.
336+ ///
337+ /// You can learn more about this in the
338+ /// [Isolating clients with ZNodes usage guide](DOCS_BASE_URL_PLACEHOLDER/zookeeper/usage_guide/isolating_clients_with_znodes).
339+ #[ derive( Clone , CustomResource , Debug , Deserialize , JsonSchema , PartialEq , Serialize ) ]
340+ #[ kube(
341+ group = "zookeeper.stackable.tech" ,
342+ version = "v1alpha1" ,
343+ kind = "ZookeeperZnode" ,
344+ plural = "zookeeperznodes" ,
345+ shortname = "zno" ,
346+ shortname = "znode" ,
347+ status = "ZookeeperZnodeStatus" ,
348+ namespaced,
349+ crates(
350+ kube_core = "stackable_operator::kube::core" ,
351+ k8s_openapi = "stackable_operator::k8s_openapi" ,
352+ schemars = "stackable_operator::schemars"
353+ )
354+ ) ]
355+ #[ serde( rename_all = "camelCase" ) ]
356+ pub struct ZookeeperZnodeSpec {
357+ /// The reference to the ZookeeperCluster that this ZNode belongs to.
358+ #[ serde( default ) ]
359+ pub cluster_ref : ClusterRef < ZookeeperCluster > ,
360+ }
361+
362+ #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
363+ #[ serde( rename_all = "camelCase" ) ]
364+ pub struct ZookeeperZnodeStatus {
365+ /// The absolute ZNode allocated to the ZookeeperZnode. This will typically be set by the operator.
366+ ///
367+ /// This can be set explicitly by an administrator, such as when restoring from a backup.
368+ pub znode_path : Option < String > ,
369+ }
370+
371+ impl CurrentlySupportedListenerClasses {
372+ pub fn k8s_service_type ( & self ) -> String {
373+ match self {
374+ CurrentlySupportedListenerClasses :: ClusterInternal => "ClusterIP" . to_string ( ) ,
375+ CurrentlySupportedListenerClasses :: ExternalUnstable => "NodePort" . to_string ( ) ,
376+ }
377+ }
378+ }
379+
293380impl ZookeeperConfig {
294381 pub const INIT_LIMIT : & ' static str = "initLimit" ;
295382 pub const SYNC_LIMIT : & ' static str = "syncLimit" ;
@@ -415,25 +502,6 @@ impl Configuration for ZookeeperConfigFragment {
415502 }
416503}
417504
418- #[ derive(
419- Clone ,
420- Debug ,
421- Deserialize ,
422- Display ,
423- EnumIter ,
424- Eq ,
425- Hash ,
426- JsonSchema ,
427- PartialEq ,
428- Serialize ,
429- EnumString ,
430- ) ]
431- #[ strum( serialize_all = "camelCase" ) ]
432- pub enum ZookeeperRole {
433- #[ strum( serialize = "server" ) ]
434- Server ,
435- }
436-
437505impl ZookeeperRole {
438506 pub fn roles ( ) -> Vec < String > {
439507 let mut roles = vec ! [ ] ;
@@ -444,16 +512,6 @@ impl ZookeeperRole {
444512 }
445513}
446514
447- #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
448- #[ serde( rename_all = "camelCase" ) ]
449- pub struct ZookeeperClusterStatus {
450- /// An opaque value that changes every time a discovery detail does
451- #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
452- pub discovery_hash : Option < String > ,
453- #[ serde( default ) ]
454- pub conditions : Vec < ClusterCondition > ,
455- }
456-
457515impl HasStatusCondition for ZookeeperCluster {
458516 fn conditions ( & self ) -> Vec < ClusterCondition > {
459517 match & self . status {
@@ -463,9 +521,16 @@ impl HasStatusCondition for ZookeeperCluster {
463521 }
464522}
465523
466- pub enum LoggingFramework {
467- LOG4J ,
468- LOGBACK ,
524+ impl ZookeeperPodRef {
525+ pub fn fqdn ( & self , cluster_info : & KubernetesClusterInfo ) -> String {
526+ format ! (
527+ "{pod_name}.{service_name}.{namespace}.svc.{cluster_domain}" ,
528+ pod_name = self . pod_name,
529+ service_name = self . role_group_service_name,
530+ namespace = self . namespace,
531+ cluster_domain = cluster_info. cluster_domain
532+ )
533+ }
469534}
470535
471536impl ZookeeperCluster {
@@ -672,71 +737,6 @@ impl ZookeeperCluster {
672737 }
673738}
674739
675- /// Reference to a single `Pod` that is a component of a [`ZookeeperCluster`]
676- ///
677- /// Used for service discovery.
678- pub struct ZookeeperPodRef {
679- pub namespace : String ,
680- pub role_group_service_name : String ,
681- pub pod_name : String ,
682- pub zookeeper_myid : u16 ,
683- }
684-
685- impl ZookeeperPodRef {
686- pub fn fqdn ( & self , cluster_info : & KubernetesClusterInfo ) -> String {
687- format ! (
688- "{pod_name}.{service_name}.{namespace}.svc.{cluster_domain}" ,
689- pod_name = self . pod_name,
690- service_name = self . role_group_service_name,
691- namespace = self . namespace,
692- cluster_domain = cluster_info. cluster_domain
693- )
694- }
695- }
696-
697- /// A claim for a single ZooKeeper ZNode tree (filesystem node).
698- ///
699- /// A ConfigMap will automatically be created with the same name, containing the connection string in the field `ZOOKEEPER`.
700- /// Each ZookeeperZnode gets an isolated ZNode chroot, which the `ZOOKEEPER` automatically contains.
701- /// All data inside of this chroot will be deleted when the corresponding `ZookeeperZnode` is.
702- ///
703- /// `ZookeeperZnode` is *not* designed to manage the contents of this ZNode. Instead, it should be used to create a chroot
704- /// for an installation of an application to work inside. Initializing the contents is the responsibility of the application.
705- ///
706- /// You can learn more about this in the
707- /// [Isolating clients with ZNodes usage guide](DOCS_BASE_URL_PLACEHOLDER/zookeeper/usage_guide/isolating_clients_with_znodes).
708- #[ derive( Clone , CustomResource , Debug , Deserialize , JsonSchema , PartialEq , Serialize ) ]
709- #[ kube(
710- group = "zookeeper.stackable.tech" ,
711- version = "v1alpha1" ,
712- kind = "ZookeeperZnode" ,
713- plural = "zookeeperznodes" ,
714- shortname = "zno" ,
715- shortname = "znode" ,
716- status = "ZookeeperZnodeStatus" ,
717- namespaced,
718- crates(
719- kube_core = "stackable_operator::kube::core" ,
720- k8s_openapi = "stackable_operator::k8s_openapi" ,
721- schemars = "stackable_operator::schemars"
722- )
723- ) ]
724- #[ serde( rename_all = "camelCase" ) ]
725- pub struct ZookeeperZnodeSpec {
726- /// The reference to the ZookeeperCluster that this ZNode belongs to.
727- #[ serde( default ) ]
728- pub cluster_ref : ClusterRef < ZookeeperCluster > ,
729- }
730-
731- #[ derive( Clone , Default , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
732- #[ serde( rename_all = "camelCase" ) ]
733- pub struct ZookeeperZnodeStatus {
734- /// The absolute ZNode allocated to the ZookeeperZnode. This will typically be set by the operator.
735- ///
736- /// This can be set explicitly by an administrator, such as when restoring from a backup.
737- pub znode_path : Option < String > ,
738- }
739-
740740#[ cfg( test) ]
741741mod tests {
742742 use super :: * ;
0 commit comments