Skip to content

Commit d1f91bf

Browse files
committed
Merge branch 'AbhiK_tcps_bugfix4' into 'master'
TCPS connections bugfixes See merge request rac-docker-dev/oracle-database-operator!227
2 parents 56ac149 + c5a4da5 commit d1f91bf

File tree

5 files changed

+15
-27
lines changed

5 files changed

+15
-27
lines changed

apis/database/v1alpha1/singleinstancedatabase_webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ func (r *SingleInstanceDatabase) ValidateCreate() error {
250250
}
251251
} else {
252252
// LoadBalancer Service is expected.
253-
if r.Spec.EnableTCPS && r.Spec.TcpsListenerPort == 0 && r.Spec.ListenerPort == 1522 {
253+
if r.Spec.EnableTCPS && r.Spec.TcpsListenerPort == 0 && r.Spec.ListenerPort == int(dbcommons.CONTAINER_TCPS_PORT) {
254254
allErrs = append(allErrs,
255255
field.Invalid(field.NewPath("spec").Child("listenerPort"), r.Spec.ListenerPort,
256-
"listenerPort can not be 1522 as the default port for tcpsListenerPort is 1522."))
256+
"listenerPort can not be 2484 as the default port for tcpsListenerPort is 2484."))
257257
}
258258
}
259259
if r.Spec.EnableTCPS && r.Spec.ListenerPort != 0 && r.Spec.TcpsListenerPort != 0 && r.Spec.ListenerPort == r.Spec.TcpsListenerPort {
@@ -271,11 +271,11 @@ func (r *SingleInstanceDatabase) ValidateCreate() error {
271271
"Please provide valid string to parse the tcpsCertRenewInterval."))
272272
}
273273
maxLimit, _ := time.ParseDuration("26280h")
274-
minLimit, _ := time.ParseDuration("5m")
274+
minLimit, _ := time.ParseDuration("24h")
275275
if duration > maxLimit || duration < minLimit {
276276
allErrs = append(allErrs,
277277
field.Invalid(field.NewPath("spec").Child("tcpsCertRenewInterval"), r.Spec.TcpsCertRenewInterval,
278-
"Please specify tcpsCertRenewInterval in the range: 5m to 26280h"))
278+
"Please specify tcpsCertRenewInterval in the range: 24h to 26280h"))
279279
}
280280
}
281281
if len(allErrs) == 0 {

commons/database/constants.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ package commons
4040

4141
const CONTAINER_LISTENER_PORT int32 = 1521
4242

43-
const CONTAINER_TCPS_PORT int32 = 1522
43+
const CONTAINER_TCPS_PORT int32 = 2484
4444

4545
const ORACLE_UID int64 = 54321
4646

@@ -513,7 +513,7 @@ const LsnrPort string = "\"name\": \"listener\", \"protocol\": \"TCP\", \"port\"
513513
const LsnrNodePort string = "\"name\": \"listener\", \"protocol\": \"TCP\", \"port\": 1521, \"nodePort\": %d"
514514

515515
// Payload section for TCPS port
516-
const TcpsPort string = "\"name\": \"listener-tcps\", \"protocol\": \"TCP\", \"port\": %d, \"targetPort\": 1522"
516+
const TcpsPort string = "\"name\": \"listener-tcps\", \"protocol\": \"TCP\", \"port\": %d, \"targetPort\": 2484"
517517

518518
// Payload section for TCPS node port
519-
const TcpsNodePort string = "\"name\": \"listener-tcps\", \"protocol\": \"TCP\", \"port\": 1522, \"nodePort\": %d"
519+
const TcpsNodePort string = "\"name\": \"listener-tcps\", \"protocol\": \"TCP\", \"port\": 2484, \"nodePort\": %d"

config/samples/sidb/singleinstancedatabase.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949

5050
## TCPS Certificate Renewal Interval: The time after which TCPS certificate will be renewed if TCPS connections are enabled.
5151
## tcpsCertRenewInterval can be in hours(h), minutes(m) and seconds(s); e.g. 17520h, 8760h etc.
52-
## Maximum value is 26280h (3 years), Minimum value is 5m; Default value is 17520h (2 years)
52+
## Maximum value is 26280h (3 years), Minimum value is 24h; Default value is 17520h (2 years)
5353
## If this field is commented out/removed from the yaml, it will disable the auto-renewal feature for TCPS certificate
5454
tcpsCertRenewInterval: 17520h
5555

config/samples/sidb/singleinstancedatabase_tcps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ spec:
3636

3737
## TCPS Certificate Renewal Interval: The time after which TCPS certificate will be renewed if TCPS connections are enabled.
3838
## tcpsCertRenewInterval can be in hours(h), minutes(m) and seconds(s); e.g. 17520h, 8760h etc.
39-
## Maximum value is 26280h (3 years), Minimum value is 5m; Default value is 17520h (2 years)
39+
## Maximum value is 26280h (3 years), Minimum value is 24h; Default value is 17520h (2 years)
4040
## If this field is commented out/removed from the yaml, it will disable the auto-renewal feature for TCPS certificate
4141
tcpsCertRenewInterval: 17520h
4242

docs/sidb/README.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,6 @@ Alternatively, you can use the following command:
520520
```bash
521521
kubectl patch --type=merge singleinstancedatabases.database.oracle.com sidb-sample -p '{"spec": {"enableTCPS": true}}'
522522
```
523-
524-
When TCPS connections are enabled, a Kubernetes event is published notifying the same. This event can be seen by any one of the following commands:
525-
```bash
526-
kubectl describe singleinstancedatabases.database.oracle.com sidb-sample
527-
528-
kubectl get events
529-
```
530-
531523
Once TCPS connections are enabled, the database connect string will change accordingly. The TCPS connections status can also be queried by the following command:
532524
```bash
533525
kubectl get singleinstancedatabase sidb-sample -o "jsonpath={.status.isTcpsEnabled}"
@@ -548,26 +540,22 @@ The following steps are required to connect the Database using TCPS:
548540
```bash
549541
sqlplus sys@ORCL1 as sysdba
550542
```
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}"
558-
```
559543
**NOTE:**
560544
- Only database server authentication is supported (no mTLS).
561545
- 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.
562546
- 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 5m, 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.
547+
- 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 24h, 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.
548+
- When the certificate gets created/renewed, the `.status.certCreationTimestamp` status variable gets updated accordingly. You can see this timestamp by using the following command:
549+
```bash
550+
kubectl get singleinstancedatabase sidb-sample -o "jsonpath={.status.certCreationTimestamp}"
551+
```
564552
565553
### Specifying Custom Ports
566554
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.
567555
568556
`listenerPort` is intended for normal database connections. Similarly, `tcpsListenerPort` is intended for TCPS database connections.
569557
570-
If the `LoadBalancer` is enabled, the `listenerPort`, and `tcpsListenerPort` will be the opened ports on the Load Balancer for normal and TCPS database connections respectively.
558+
If the `LoadBalancer` is enabled, the `listenerPort`, and `tcpsListenerPort` will be the opened ports on the Load Balancer for normal and TCPS database connections respectively. The default values of `listenerPort` and `tcpsListenerPort` are 1521 and 2484 respectively when the `LoadBalancer` is enabled.
571559
572560
In case of `NodePort` service, `listenerPort`, and `tcpsListenerPort` will be the opened ports on the Kubernetes nodes for for normal and TCPS database connections respectively. In this case, the allowed range for the `listenerPort`, and `tcpsListenerPort` is 30000-32767.
573561

0 commit comments

Comments
 (0)