@@ -641,7 +641,12 @@ func (r *PDBReconciler) createPDB(ctx context.Context, req ctrl.Request, pdb *db
641
641
642
642
r .Recorder .Eventf (pdb , corev1 .EventTypeNormal , "Created" , "PDB '%s' created successfully" , pdb .Spec .PDBName )
643
643
644
+ if cdb .Spec .DBServer != "" {
644
645
pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
646
+ } else {
647
+ pdb .Status .ConnString = cdb .Spec .DBTnsurl
648
+ }
649
+
645
650
log .Info ("Created PDB Resource" , "PDB Name" , pdb .Spec .PDBName )
646
651
r .getPDBState (ctx , req , pdb )
647
652
return nil
@@ -695,7 +700,13 @@ func (r *PDBReconciler) clonePDB(ctx context.Context, req ctrl.Request, pdb *dba
695
700
696
701
r .Recorder .Eventf (pdb , corev1 .EventTypeNormal , "Created" , "PDB '%s' cloned successfully" , pdb .Spec .PDBName )
697
702
698
- pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
703
+ if cdb .Spec .DBServer != "" {
704
+ pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
705
+ } else {
706
+ pdb .Status .ConnString = cdb .Spec .DBTnsurl
707
+ }
708
+
709
+
699
710
log .Info ("Cloned PDB successfully" , "Source PDB Name" , pdb .Spec .SrcPDBName , "Clone PDB Name" , pdb .Spec .PDBName )
700
711
r .getPDBState (ctx , req , pdb )
701
712
return nil
@@ -763,7 +774,12 @@ func (r *PDBReconciler) plugPDB(ctx context.Context, req ctrl.Request, pdb *dbap
763
774
764
775
r .Recorder .Eventf (pdb , corev1 .EventTypeNormal , "Created" , "PDB '%s' plugged successfully" , pdb .Spec .PDBName )
765
776
766
- pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
777
+ if cdb .Spec .DBServer != "" {
778
+ pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
779
+ } else {
780
+ pdb .Status .ConnString = cdb .Spec .DBTnsurl
781
+ }
782
+
767
783
log .Info ("Successfully plugged PDB" , "PDB Name" , pdb .Spec .PDBName )
768
784
r .getPDBState (ctx , req , pdb )
769
785
return nil
@@ -883,7 +899,13 @@ func (r *PDBReconciler) modifyPDB(ctx context.Context, req ctrl.Request, pdb *db
883
899
}
884
900
885
901
r .Recorder .Eventf (pdb , corev1 .EventTypeNormal , "Modified" , "PDB '%s' modified successfully" , pdb .Spec .PDBName )
886
- pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
902
+
903
+ if cdb .Spec .DBServer != "" {
904
+ pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
905
+ } else {
906
+ pdb .Status .ConnString = cdb .Spec .DBTnsurl
907
+ }
908
+
887
909
888
910
log .Info ("Successfully modified PDB state" , "PDB Name" , pdb .Spec .PDBName )
889
911
r .getPDBState (ctx , req , pdb )
@@ -970,7 +992,13 @@ func (r *PDBReconciler) mapPDB(ctx context.Context, req ctrl.Request, pdb *dbapi
970
992
971
993
pdb .Status .OpenMode = objmap ["open_mode" ].(string )
972
994
pdb .Status .TotalSize = fmt .Sprintf ("%.2f" , totSizeInGB ) + "G"
973
- pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
995
+
996
+ if cdb .Spec .DBServer != "" {
997
+ pdb .Status .ConnString = cdb .Spec .DBServer + ":" + strconv .Itoa (cdb .Spec .DBPort ) + "/" + pdb .Spec .PDBName
998
+ } else {
999
+ pdb .Status .ConnString = cdb .Spec .DBTnsurl
1000
+ }
1001
+
974
1002
975
1003
log .Info ("Successfully mapped PDB to Kubernetes resource" , "PDB Name" , pdb .Spec .PDBName )
976
1004
return nil
0 commit comments