@@ -85,6 +85,8 @@ var futureRequeue ctrl.Result = requeueN
85
85
86
86
const singleInstanceDatabaseFinalizer = "database.oracle.com/singleinstancedatabasefinalizer"
87
87
88
+ var oemExpressUrl string
89
+
88
90
//+kubebuilder:rbac:groups=database.oracle.com,resources=singleinstancedatabases,verbs=get;list;watch;create;update;patch;delete
89
91
//+kubebuilder:rbac:groups=database.oracle.com,resources=singleinstancedatabases/status,verbs=get;update;patch
90
92
//+kubebuilder:rbac:groups=database.oracle.com,resources=singleinstancedatabases/finalizers,verbs=update
@@ -369,9 +371,9 @@ func (r *SingleInstanceDatabaseReconciler) validate(m *dbapi.SingleInstanceDatab
369
371
}
370
372
}
371
373
372
- // If Express Edition, ensure Replicas=1
373
- if m .Spec .Edition == "express" && m .Spec .Replicas > 1 {
374
- eventMsgs = append (eventMsgs , "express edition supports only one replica" )
374
+ // If Express/Free Edition, ensure Replicas=1
375
+ if ( m .Spec .Edition == "express" || m . Spec . Edition == "free" ) && m .Spec .Replicas > 1 {
376
+ eventMsgs = append (eventMsgs , m . Spec . Edition + " edition supports only one replica" )
375
377
}
376
378
// If no persistence, ensure Replicas=1
377
379
if m .Spec .Persistence .Size == "" && m .Spec .Replicas > 1 {
@@ -394,11 +396,11 @@ func (r *SingleInstanceDatabaseReconciler) validate(m *dbapi.SingleInstanceDatab
394
396
m .Status .CloneFrom != dbcommons .NoCloneRef && m .Status .CloneFrom != m .Spec .CloneFrom ) {
395
397
eventMsgs = append (eventMsgs , "cloneFrom cannot be updated" )
396
398
}
397
- if m .Spec .Edition == "express" && m .Spec .CloneFrom != "" {
398
- eventMsgs = append (eventMsgs , "cloning not supported for express edition" )
399
+ if ( m .Spec .Edition == "express" || m . Spec . Edition == "free" ) && m .Spec .CloneFrom != "" {
400
+ eventMsgs = append (eventMsgs , "cloning not supported for " + m . Spec . Edition + " edition" )
399
401
}
400
- if m .Spec .Edition == "express" && m .Spec .PrimaryDatabaseRef != "" && m .Spec .CreateAsStandby {
401
- eventMsgs = append (eventMsgs , "Standby database creation is not supported for express edition" )
402
+ if ( m .Spec .Edition == "express" || m . Spec . Edition == "free" ) && m .Spec .PrimaryDatabaseRef != "" && m .Spec .CreateAsStandby {
403
+ eventMsgs = append (eventMsgs , "Standby database creation is not supported for " + m . Spec . Edition + " edition" )
402
404
}
403
405
if m .Status .OrdsReference != "" && m .Status .Persistence .Size != "" && m .Status .Persistence != m .Spec .Persistence {
404
406
eventMsgs = append (eventMsgs , "uninstall ORDS to change Peristence" )
@@ -665,8 +667,8 @@ func (r *SingleInstanceDatabaseReconciler) instantiatePodSpec(m *dbapi.SingleIns
665
667
})
666
668
}
667
669
}
668
- /* Wallet only for non- express edition , non-prebuiltDB */
669
- if m .Spec .Edition != "express" && ! m .Spec .Image .PrebuiltDB {
670
+ /* Wallet only for edition barring express and free editions , non-prebuiltDB */
671
+ if ( m .Spec .Edition != "express" && m . Spec . Edition != "free" ) && ! m .Spec .Image .PrebuiltDB {
670
672
initContainers = append (initContainers , corev1.Container {
671
673
Name : "init-wallet" ,
672
674
Image : m .Spec .Image .PullFrom ,
@@ -766,7 +768,7 @@ func (r *SingleInstanceDatabaseReconciler) instantiatePodSpec(m *dbapi.SingleIns
766
768
}(),
767
769
Env : func () []corev1.EnvVar {
768
770
// adding XE support, useful for dev/test/CI-CD
769
- if m .Spec .Edition == "express" {
771
+ if m .Spec .Edition == "express" || m . Spec . Edition == "free" {
770
772
return []corev1.EnvVar {
771
773
{
772
774
Name : "SVC_HOST" ,
@@ -1481,7 +1483,7 @@ func (r *SingleInstanceDatabaseReconciler) createOrReplaceSVC(ctx context.Contex
1481
1483
}
1482
1484
m .Status .ConnectString = lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [1 ].Port ) + "/" + strings .ToUpper (sid )
1483
1485
m .Status .PdbConnectString = lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [1 ].Port ) + "/" + strings .ToUpper (pdbName )
1484
- m . Status . OemExpressUrl = "https://" + lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [0 ].Port ) + "/em"
1486
+ oemExpressUrl = "https://" + lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [0 ].Port ) + "/em"
1485
1487
if m .Spec .EnableTCPS {
1486
1488
m .Status .TcpsConnectString = lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [len (extSvc .Spec .Ports )- 1 ].Port ) + "/" + strings .ToUpper (sid )
1487
1489
m .Status .TcpsPdbConnectString = lbAddress + ":" + fmt .Sprint (extSvc .Spec .Ports [len (extSvc .Spec .Ports )- 1 ].Port ) + "/" + strings .ToUpper (pdbName )
@@ -1493,7 +1495,7 @@ func (r *SingleInstanceDatabaseReconciler) createOrReplaceSVC(ctx context.Contex
1493
1495
if nodeip != "" {
1494
1496
m .Status .ConnectString = nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [1 ].NodePort ) + "/" + strings .ToUpper (sid )
1495
1497
m .Status .PdbConnectString = nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [1 ].NodePort ) + "/" + strings .ToUpper (pdbName )
1496
- m . Status . OemExpressUrl = "https://" + nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [0 ].NodePort ) + "/em"
1498
+ oemExpressUrl = "https://" + nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [0 ].NodePort ) + "/em"
1497
1499
if m .Spec .EnableTCPS {
1498
1500
m .Status .TcpsConnectString = nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [len (extSvc .Spec .Ports )- 1 ].NodePort ) + "/" + strings .ToUpper (sid )
1499
1501
m .Status .TcpsPdbConnectString = nodeip + ":" + fmt .Sprint (extSvc .Spec .Ports [len (extSvc .Spec .Ports )- 1 ].NodePort ) + "/" + strings .ToUpper (pdbName )
@@ -1701,8 +1703,8 @@ func (r *SingleInstanceDatabaseReconciler) createOrReplacePods(m *dbapi.SingleIn
1701
1703
// #############################################################################
1702
1704
func (r * SingleInstanceDatabaseReconciler ) createWallet (m * dbapi.SingleInstanceDatabase , ctx context.Context , req ctrl.Request ) (ctrl.Result , error ) {
1703
1705
1704
- // Wallet not supported for XE Database
1705
- if m .Spec .Edition == "express" {
1706
+ // Wallet not supported for Express/Free Database
1707
+ if m .Spec .Edition == "express" || m . Spec . Edition == "free" {
1706
1708
return requeueN , nil
1707
1709
}
1708
1710
@@ -2016,6 +2018,16 @@ func (r *SingleInstanceDatabaseReconciler) validateDBReadiness(m *dbapi.SingleIn
2016
2018
m .Status .ReleaseUpdate = version
2017
2019
}
2018
2020
}
2021
+ oemSupport , err := isOEMSupported (r ,m .Status .ReleaseUpdate )
2022
+ if err != nil {
2023
+ r .Log .Error (err , err .Error ())
2024
+ return requeueY , readyPod , err
2025
+ }
2026
+ if oemSupport {
2027
+ m .Status .OemExpressUrl = oemExpressUrl
2028
+ } else {
2029
+ m .Status .OemExpressUrl = dbcommons .ValueUnavailable
2030
+ }
2019
2031
2020
2032
if strings .ToUpper (m .Status .Role ) == "PRIMARY" && m .Status .DatafilesPatched != "true" {
2021
2033
eventReason := "Datapatch Pending"
@@ -2034,8 +2046,8 @@ func (r *SingleInstanceDatabaseReconciler) validateDBReadiness(m *dbapi.SingleIn
2034
2046
// #############################################################################
2035
2047
func (r * SingleInstanceDatabaseReconciler ) deleteWallet (m * dbapi.SingleInstanceDatabase , ctx context.Context , req ctrl.Request ) (ctrl.Result , error ) {
2036
2048
2037
- // Wallet not supported for XE Database
2038
- if m .Spec .Edition == "express" {
2049
+ // Wallet not supported for Express/Free Database
2050
+ if m .Spec .Edition == "express" || m . Spec . Edition == "free" {
2039
2051
return requeueN , nil
2040
2052
}
2041
2053
@@ -2250,9 +2262,9 @@ func (r *SingleInstanceDatabaseReconciler) runDatapatch(m *dbapi.SingleInstanceD
2250
2262
readyPod corev1.Pod , ctx context.Context , req ctrl.Request ) (ctrl.Result , error ) {
2251
2263
2252
2264
// Datapatch not supported for XE Database
2253
- if m .Spec .Edition == "express" {
2265
+ if m .Spec .Edition == "express" || m . Spec . Edition == "free" {
2254
2266
eventReason := "Datapatch Check"
2255
- eventMsg := "datapatch not supported for express edition"
2267
+ eventMsg := "datapatch not supported for " + m . Spec . Edition + " edition"
2256
2268
r .Recorder .Eventf (m , corev1 .EventTypeNormal , eventReason , eventMsg )
2257
2269
r .Log .Info (eventMsg )
2258
2270
return requeueN , nil
@@ -3074,3 +3086,19 @@ func SetupStandbyDatabase(r *SingleInstanceDatabaseReconciler, stdby *dbapi.Sing
3074
3086
3075
3087
return nil
3076
3088
}
3089
+
3090
+
3091
+ func isOEMSupported (r * SingleInstanceDatabaseReconciler ,version string ) (bool ,error ) {
3092
+ majorVersion , err := strconv .Atoi (strings .Split (version ,"." )[0 ])
3093
+ r .Log .Info ("majorVersion of database is " + strconv .Itoa (majorVersion ))
3094
+ if err != nil {
3095
+ return false ,err
3096
+ }
3097
+ if majorVersion > 21 {
3098
+ r .Log .Info ("major Version " + strconv .Itoa (majorVersion ) + " is greater that 21 so OEM Express is not supported" )
3099
+ return false ,nil
3100
+ } else {
3101
+ r .Log .Info ("major Version " + strconv .Itoa (majorVersion ) + " is lesser than equal to 21 so OEM Express is supported" )
3102
+ return true ,nil
3103
+ }
3104
+ }
0 commit comments