Skip to content

Commit 8c5e02f

Browse files
committed
Merge branch 'AbhiK_tcps_bugfix2' into 'master'
Reducing number of events, explain about tcpsCertRenewInterval in readme See merge request rac-docker-dev/oracle-database-operator!224
2 parents 9aa33d9 + 7ffe454 commit 8c5e02f

File tree

3 files changed

+24
-34
lines changed

3 files changed

+24
-34
lines changed

config/samples/sidb/singleinstancedatabase_tcps.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44
#
55

6-
apiVersion: v1
7-
kind: Secret
8-
metadata:
9-
name: db-admin-secret
10-
namespace: default
11-
type: Opaque
12-
stringData:
13-
# Specify your DB password here
14-
oracle_pwd:
15-
16-
---
17-
186
apiVersion: database.oracle.com/v1alpha1
197
kind: SingleInstanceDatabase
208
metadata:

controllers/database/singleinstancedatabase_controller.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ func (r *SingleInstanceDatabaseReconciler) instantiatePodSpec(m *dbapi.SingleIns
674674
if m.Spec.ReadinessCheckPeriod > 0 {
675675
return int32(m.Spec.ReadinessCheckPeriod)
676676
}
677-
return 30
677+
return 60
678678
}(),
679679
},
680680

@@ -1796,15 +1796,13 @@ func (r *SingleInstanceDatabaseReconciler) validateDBReadiness(m *dbapi.SingleIn
17961796
return requeueY, readyPod, err
17971797
}
17981798
if readyPod.Name == "" {
1799-
eventReason := "Database Pending"
1800-
eventMsg := "status of database is not ready, retrying..."
18011799
m.Status.Status = dbcommons.StatusPending
18021800
if ok, _ := dbcommons.IsAnyPodWithStatus(available, corev1.PodFailed); ok {
1803-
eventReason = "Database Failed"
1804-
eventMsg = "pod creation failed"
1801+
eventReason := "Database Failed"
1802+
eventMsg := "pod creation failed"
1803+
r.Recorder.Eventf(m, corev1.EventTypeNormal, eventReason, eventMsg)
18051804
} else if ok, runningPod := dbcommons.IsAnyPodWithStatus(available, corev1.PodRunning); ok {
1806-
eventReason = "Database Creating"
1807-
eventMsg = "database creation in progress..."
1805+
r.Log.Info("Database Creating...", "Name", m.Name)
18081806
m.Status.Status = dbcommons.StatusCreating
18091807
if m.Spec.CloneFrom != "" {
18101808
// Required since clone creates the datafiles under primary database SID folder
@@ -1823,18 +1821,20 @@ func (r *SingleInstanceDatabaseReconciler) validateDBReadiness(m *dbapi.SingleIn
18231821
r.Log.Info("GetCheckpointFileCMD Output : \n" + out)
18241822

18251823
if out != "" {
1826-
eventReason = "Database Unhealthy"
1827-
eventMsg = "datafiles exists"
1824+
eventReason := "Database Unhealthy"
1825+
eventMsg := "datafiles exists"
1826+
r.Recorder.Eventf(m, corev1.EventTypeNormal, eventReason, eventMsg)
18281827
m.Status.DatafilesCreated = "true"
18291828
m.Status.Status = dbcommons.StatusNotReady
18301829
r.updateORDSStatus(m, ctx, req)
18311830
}
18321831

1832+
} else {
1833+
r.Log.Info("Database Pending...", "Name", m.Name)
18331834
}
1834-
r.Recorder.Eventf(m, corev1.EventTypeNormal, eventReason, eventMsg)
1835-
r.Log.Info(eventMsg)
1835+
18361836
// As No pod is ready now , turn on mode when pod is ready . so requeue the request
1837-
return requeueY, readyPod, errors.New(eventMsg)
1837+
return requeueY, readyPod, errors.New("no pod is ready currently")
18381838
}
18391839
if m.Status.DatafilesPatched != "true" {
18401840
eventReason := "Datapatch Pending"

docs/sidb/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,9 @@ true
535535
```
536536

537537
The following steps are required to connect the Database using TCPS:
538-
- You need to download the wallet from the Persistent Volume(PV) attached with the database pod. You can use the following command to get the list of pod:
538+
- You need to download the wallet from the Persistent Volume (PV) attached with the database pod. The location of the wallet inside the pod is as `/opt/oracle/oradata/clientWallet/$ORACLE_SID`. **Let us assume the `ORACLE_SID` is `ORCL1`, and singleinstance database resource name is `sidb-sample` for the upcoming example command**. You can copy the wallet to the destination directory by the following command:
539539
```bash
540-
kubectl get po
541-
NAME READY STATUS RESTARTS AGE
542-
sidb-sample-gaqoe 1/1 Running 0 3d14h
543-
```
544-
- The location of the wallet inside the pod is as `/opt/oracle/oradata/clientWallet/$ORACLE_SID`. **Let us assume the `ORACLE_SID` is `ORCL1` for the upcoming example commands**. The sample command to download the wallet is as follows:
545-
```bash
546-
kubectl cp sidb-sample-gaqoe:/opt/oracle/oradata/clientWallet/ORCL1 <Destination directory>
540+
kubectl cp $(kubectl get pods -l app=sidb-sample -o=jsonpath='{.items[0].metadata.name}'):/opt/oracle/oradata/clientWallet/ORCL1 <Destination directory>
547541
```
548542
- This wallet includes the sample `tnsnames.ora` and `sqlnet.ora` files. All the TNS entries for the database (corresponding to the CDB and PDB) resides in `tnsnames.ora` file. You need to go inside the downloaded wallet directory and set the `TNS_ADMIN` environment variable to point to the current directory as follows:
549543
```bash
@@ -553,13 +547,20 @@ The following steps are required to connect the Database using TCPS:
553547
After this, you can connect using SQL\*Plus using the following sample commands:
554548
```bash
555549
sqlplus sys@ORCL1 as sysdba
556-
557-
sqlplus system@ORCL1
550+
```
551+
- Alternatively, you can use the following SQL\*Plus command to connect using TCPS without setting TNS_ADMIN environment variable:
552+
```bash
553+
sqlplus sys@tcps://<TCPS Connect String>?wallet_location=<Downloaded Wallet Directory>
554+
```
555+
Here, TCPS connect string can be found by using the following command:
556+
```bash
557+
kubectl get singleinstancedatabase sidb-sample -o "jsonpath={.status.TcpsConnectString}"
558558
```
559559
**NOTE:**
560560
- Only database server authentication is supported (no mTLS).
561561
- When TCPS is enabled, a self-signed certificate is generated and stored inside the wallets. For users' convenience, a client-side wallet is generated and stored at `/opt/oracle/oradata/clientWallet/$ORACLE_SID` location in the pod.
562562
- The self-signed certificate used with TCPS has validity for 2 years. After the certificate is expired, it will be renewed by the `OraOperator` automatically. You need to download the wallet again after the auto-renewal.
563+
- You can set the certificate renew interval with the help of `tcpsCertRenewInterval` field in the **[config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml)** file. The minimum accepted value is 1m, and the maximum value is 26280h (3 years). The certificates used with TCPS will automatically be renewed after this interval. If this field is omitted/commented in the yaml file, the certificates will not be renewed automatically.
563564
564565
### Specifying Custom Ports
565566
As mentioned in the section [Setup Database with LoadBalancer](#setup-database-with-loadbalancer), there are two kubernetes services possible for the database: NodePort and LoadBalancer. You can specify which port to use with these services by editing the `listenerPort` and `tcpsListenerPort` fields of the [config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml) file.
@@ -574,6 +575,7 @@ In case of `NodePort` service, `listenerPort`, and `tcpsListenerPort` will be th
574575
- `listenerPort` and `tcpsListenerPort` can not have same values.
575576
- `tcpsListenerPort` will come into effect only when TCPS connections are enabled (i.e. `enableTCPS` field is set in [config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml) file).
576577
- If TCPS connections are enabled, and `listenerPort` is commented/removed in the [config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml) file, only TCPS endpoint will be exposed.
578+
- If LoadBalancer is enabled, and either `listenerPort` or `tcpsListenerPort` is changed, then it takes some time to complete the work requests (drain existing backend sets and create new ones). SingleInstanceDatabase and LoadBalancer remains in the healthy state, but, you can check the progress of the work requests by logging into the OCI console and checking the corresponding LoadBalancer.
577579
578580
579581
## OracleRestDataService Resource

0 commit comments

Comments
 (0)