Skip to content

Commit 1356892

Browse files
committed
Merge branch 'AbhiK_tcps_bugfixes1' into 'master'
Bugfixes for 34578825 and 34582087 See merge request rac-docker-dev/oracle-database-operator!222
2 parents 6f5d369 + ea62445 commit 1356892

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

apis/database/v1alpha1/singleinstancedatabase_webhook.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,25 +243,27 @@ func (r *SingleInstanceDatabase) ValidateCreate() error {
243243
field.Invalid(field.NewPath("spec").Child("listenerPort"), r.Spec.ListenerPort,
244244
"listenerPort should be in 30000-32767 range."))
245245
}
246-
if r.Spec.TcpsListenerPort != 0 && (r.Spec.TcpsListenerPort < 30000 || r.Spec.TcpsListenerPort > 32767) {
246+
if r.Spec.EnableTCPS && r.Spec.TcpsListenerPort != 0 && (r.Spec.TcpsListenerPort < 30000 || r.Spec.TcpsListenerPort > 32767) {
247247
allErrs = append(allErrs,
248248
field.Invalid(field.NewPath("spec").Child("tcpsListenerPort"), r.Spec.TcpsListenerPort,
249249
"tcpsListenerPort should be in 30000-32767 range."))
250250
}
251+
} else {
252+
// LoadBalancer Service is expected.
253+
if r.Spec.EnableTCPS && r.Spec.TcpsListenerPort == 0 && r.Spec.ListenerPort == 1522 {
254+
allErrs = append(allErrs,
255+
field.Invalid(field.NewPath("spec").Child("listenerPort"), r.Spec.ListenerPort,
256+
"listenerPort can not be 1522 as the default port for tcpsListenerPort is 1522."))
257+
}
251258
}
252-
if r.Spec.ListenerPort != 0 && r.Spec.TcpsListenerPort != 0 && r.Spec.ListenerPort == r.Spec.TcpsListenerPort {
259+
if r.Spec.EnableTCPS && r.Spec.ListenerPort != 0 && r.Spec.TcpsListenerPort != 0 && r.Spec.ListenerPort == r.Spec.TcpsListenerPort {
253260
allErrs = append(allErrs,
254261
field.Invalid(field.NewPath("spec").Child("tcpsListenerPort"), r.Spec.TcpsListenerPort,
255262
"listenerPort and tcpsListenerPort can not be equal."))
256263
}
257-
if r.Spec.EnableTCPS && r.Spec.TcpsListenerPort == 0 && r.Spec.ListenerPort == 1522 {
258-
allErrs = append(allErrs,
259-
field.Invalid(field.NewPath("spec").Child("listenerPort"), r.Spec.ListenerPort,
260-
"listenerPort can not be 1522 as the default port for tcpsListenerPort is 1522."))
261-
}
262264

263265
// Certificate Renew Duration Validation
264-
if r.Spec.TcpsCertRenewInterval != "" {
266+
if r.Spec.EnableTCPS && r.Spec.TcpsCertRenewInterval != "" {
265267
duration, err := time.ParseDuration(r.Spec.TcpsCertRenewInterval)
266268
if err != nil {
267269
allErrs = append(allErrs,

commons/database/constants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ const ThreePortPayload string = "{\"spec\": { \"ports\": [{\"name\": \"xmldb\",
507507
const TwoPortPayload string = "{\"spec\": { \"ports\": [{\"name\": \"xmldb\", \"port\": 5500, \"protocol\": \"TCP\"},{%s}]}}"
508508

509509
// Payload section for listener port
510-
const LsnrPort string = "\"name\": \"listener\", \"protocol\": \"TCP\", \"port\": %d"
510+
const LsnrPort string = "\"name\": \"listener\", \"protocol\": \"TCP\", \"port\": %d, \"targetPort\": 1521"
511511

512512
// Payload section for listener node 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"
516+
const TcpsPort string = "\"name\": \"listener-tcps\", \"protocol\": \"TCP\", \"port\": %d, \"targetPort\": 1522"
517517

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

0 commit comments

Comments
 (0)