Skip to content

Commit

Permalink
Merge pull request #39 from oracle/release/0.2.1
Browse files Browse the repository at this point in the history
Release/0.2.1
  • Loading branch information
psaini79 authored Dec 8, 2022
2 parents 86f22f5 + 2847800 commit 187707d
Show file tree
Hide file tree
Showing 92 changed files with 3,790 additions and 725 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

As part of Oracle's resolution to make Oracle Database Kubernetes-native (that is, observable and operable by Kubernetes), Oracle released _Oracle Database Operator for Kubernetes_ (`OraOperator` or the operator). OraOperator extends the Kubernetes API with custom resources and controllers for automating Oracle Database lifecycle management.

In this v0.2.0 release, `OraOperator` supports the following database configurations and infrastructure:
In this v0.2.1 release, `OraOperator` supports the following database configurations and infrastructure:

* Oracle Autonomous Database on shared Oracle Cloud Infrastructure (OCI) (ADB-S)
* Oracle Autonomous Database on dedicated Cloud infrastructure (ADB-D)
* Containerized Single Instance databases (SIDB) deployed in the Oracle Kubernetes Engine (OKE) and any k8s where OraOperator is deployed
* Containerized Sharded databases (SHARDED) deployed in OKE and any k8s where OraOperator is deployed
* Oracle On-Premises Databases (CDB/PDBs, Exadata)
* Oracle Multitenant Databases (CDB/PDBs)
* Oracle Database Cloud Service (DBCS) (VMDB)
* Oracle Autonomous Container Database (ACD) (infrastructure) the infrastructure for provisionning Autonomous Databases.

Expand All @@ -25,14 +25,14 @@ This release of Oracle Database Operator for Kubernetes (the operator) supports
* ACD: provision, bind, restart, terminate (soft/hard)
* SIDB: Provision, clone, patch (in-place/out-of-place), update database initialization parameters, update database configuration (Flashback, archiving), Oracle Enterprise Manager (EM) Express (a basic observability console), Oracle REST Data Service (ORDS) to support REST based SQL, PDB management, SQL Developer Web, and Application Express (Apex)
* SHARDED: Provision/deploy sharded databases and the shard topology, Add a new shard, Delete an existing shard
* On-Premises Database: Bind to a CDB, Create a  PDB, Plug a  PDB, Unplug a PDB, Delete a PDB, Clone a PDB, Open/Close a PDB
* Oracle Multitenant Database: Bind to a CDB, Create a  PDB, Plug a  PDB, Unplug a PDB, Delete a PDB, Clone a PDB, Open/Close a PDB
* Database Cloud Service: Provision, Bind, Scale Up/Down, Liveness Probe, Manual Backup

The upcoming releases will support new configurations, operations and capabilities.

## Release Status

**CAUTION:** The current release of `OraOperator` (v0.2.0) is for development and testing only. DO NOT USE IN PRODUCTION.
**CAUTION:** The current release of `OraOperator` (v0.2.1) is for development and testing only. DO NOT USE IN PRODUCTION.

This release has been installed and tested on the following Kubernetes platforms:

Expand Down Expand Up @@ -69,7 +69,7 @@ Oracle strongly recommends that you ensure your system meets the following [Prer
```
---
**NOTE:**
The above command will also upgrade the existing v0.1.0 `OraOperator` installation to the latest version i.e. v0.2.0.
The above command will also upgrade the existing v0.2.0 `OraOperator` installation to the latest version i.e. v0.2.1.

---

Expand Down Expand Up @@ -99,7 +99,7 @@ The quickstarts are designed for specific database configurations:
* [Oracle Autonomous Container Database](./docs/acd/README.md)
* [Containerized Oracle Single Instance Database](./docs/sidb/README.md)
* [Containerized Oracle Sharded Database](./docs/sharding/README.md)
* [Oracle On-Premises Database](./docs/onpremdb/README.md)
* [Oracle Multitenant Database](./docs/multitenant/README.md)
* [Oracle Database Cloud Service](./docs/dbcs/README.md)

YAML file templates are available under [`/config/samples`](./config/samples/). You can copy and edit these template files to configure them for your use cases.
Expand Down
19 changes: 16 additions & 3 deletions apis/database/v1alpha1/cdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ type CDBSpec struct {
CDBName string `json:"cdbName,omitempty"`
// Name of the CDB Service
ServiceName string `json:"serviceName,omitempty"`


// Password for the CDB System Administrator
SysAdminPwd CDBSysAdminPassword `json:"sysAdminPwd,omitempty"`
// User in the root container with sysdba priviledges to manage PDB lifecycle
CDBAdminUser CDBAdminUser `json:"cdbAdminUser,omitempty"`
// Password for the CDB Administrator to manage PDB lifecycle
CDBAdminPwd CDBAdminPassword `json:"cdbAdminPwd,omitempty"`

CDBTlsKey CDBTLSKEY `json:"cdbTlsKey,omitempty"`
CDBTlsCrt CDBTLSCRT `json:"cdbTlsCrt,omitempty"`

// Password for user ORDS_PUBLIC_USER
ORDSPwd ORDSPassword `json:"ordsPwd,omitempty"`
// ORDS server port. For now, keep it as 8888. TO BE USED IN FUTURE RELEASE.
Expand All @@ -74,14 +80,13 @@ type CDBSpec struct {
WebServerUser WebServerUser `json:"webServerUser,omitempty"`
// Password for the Web Server User
WebServerPwd WebServerPassword `json:"webServerPwd,omitempty"`
// SCAN Name
SCANName string `json:"scanName,omitempty"`
// Name of the DB server
DBServer string `json:"dbServer,omitempty"`
// DB server port
DBPort int `json:"dbPort,omitempty"`
// Node Selector for running the Pod
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
DBTnsurl string `json:"dbTnsurl,omitempty"`
}

// CDBSecret defines the secretName
Expand Down Expand Up @@ -120,6 +125,14 @@ type WebServerPassword struct {
Secret CDBSecret `json:"secret"`
}

type CDBTLSKEY struct {
Secret CDBSecret `json:"secret"`
}

type CDBTLSCRT struct {
Secret CDBSecret `json:"secret"`
}

// CDBStatus defines the observed state of CDB
type CDBStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand All @@ -138,7 +151,7 @@ type CDBStatus struct {
// +kubebuilder:printcolumn:JSONPath=".spec.cdbName",name="CDB Name",type="string",description="Name of the CDB"
// +kubebuilder:printcolumn:JSONPath=".spec.dbServer",name="DB Server",type="string",description=" Name of the DB Server"
// +kubebuilder:printcolumn:JSONPath=".spec.dbPort",name="DB Port",type="integer",description="DB server port"
// +kubebuilder:printcolumn:JSONPath=".spec.scanName",name="SCAN Name",type="string",description="SCAN Name"
// +kubebuilder:printcolumn:JSONPath=".spec.dbTnsurl",name="TNS STRING",type="string",description=" string of the tnsalias"
// +kubebuilder:printcolumn:JSONPath=".spec.replicas",name="Replicas",type="integer",description="Replicas"
// +kubebuilder:printcolumn:JSONPath=".status.phase",name="Status",type="string",description="Status of the CDB Resource"
// +kubebuilder:printcolumn:JSONPath=".status.msg",name="Message",type="string",description="Error message, if any"
Expand Down
32 changes: 25 additions & 7 deletions apis/database/v1alpha1/cdb_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,41 @@ func (r *CDB) ValidateCreate() error {

var allErrs field.ErrorList

if r.Spec.ServiceName == "" {
if r.Spec.ServiceName == "" && r.Spec.DBServer != "" {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("serviceName"), "Please specify CDB Service name"))
}
if r.Spec.SCANName == "" {

if reflect.ValueOf(r.Spec.CDBTlsKey).IsZero() {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("cdbTlsKey"), "Please specify CDB Tls key(secret)"))
}

if reflect.ValueOf(r.Spec.CDBTlsCrt).IsZero() {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("cdbTlsCrt"), "Please specify CDB Tls Certificate(secret)"))
}

/*if r.Spec.SCANName == "" {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("scanName"), "Please specify SCAN Name for CDB"))
}
if r.Spec.DBServer == "" {
}*/

if ((r.Spec.DBServer == "" && r.Spec.DBTnsurl == "") || (r.Spec.DBServer != "" && r.Spec.DBTnsurl != "")) {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("dbServer"), "Please specify Database Server Name or IP Address"))
field.Required(field.NewPath("spec").Child("dbServer"), "Please specify Database Server Name/IP Address or tnsalias string"))
}
if r.Spec.DBPort == 0 {

if r.Spec.DBTnsurl != "" && ( r.Spec.DBServer != "" || r.Spec.DBPort != 0 || r.Spec.ServiceName != "" ) {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("dbServer"), "DBtnsurl is orthogonal to (DBServer,DBport,Services)"))
}

if r.Spec.DBPort == 0 && r.Spec.DBServer != "" {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("dbPort"), "Please specify DB Server Port"))
}
if r.Spec.DBPort < 0 {
if r.Spec.DBPort < 0 && r.Spec.DBServer != "" {
allErrs = append(allErrs,
field.Required(field.NewPath("spec").Child("dbPort"), "Please specify a valid DB Server Port"))
}
Expand Down
1 change: 0 additions & 1 deletion apis/database/v1alpha1/oraclerestdataservice_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
package v1alpha1

import (

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down
18 changes: 17 additions & 1 deletion apis/database/v1alpha1/pdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ type PDBSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

PDBTlsKey PDBTLSKEY `json:"pdbTlsKey,omitempty"`
PDBTlsCrt PDBTLSCRT `json:"pdbTlsCrt,omitempty"`
PDBTlsCat PDBTLSCAT `json:"pdbTlsCat,omitempty"`

// Name of the CDB Custom Resource that runs the ORDS container
CDBResName string `json:"cdbResName,omitempty"`
// Name of the CDB
Expand Down Expand Up @@ -132,6 +136,18 @@ type PDBSecret struct {
Key string `json:"key"`
}

type PDBTLSKEY struct {
Secret PDBSecret `json:"secret"`
}

type PDBTLSCRT struct {
Secret PDBSecret `json:"secret"`
}

type PDBTLSCAT struct {
Secret PDBSecret `json:"secret"`
}

// PDBStatus defines the observed state of PDB
type PDBStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand All @@ -157,7 +173,7 @@ type PDBStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:JSONPath=".status.connString",name="Connect String",type="string",description="The connect string to be used"
// +kubebuilder:printcolumn:JSONPath=".status.connString",name="Connect_String",type="string",description="The connect string to be used"
// +kubebuilder:printcolumn:JSONPath=".spec.cdbName",name="CDB Name",type="string",description="Name of the CDB"
// +kubebuilder:printcolumn:JSONPath=".spec.pdbName",name="PDB Name",type="string",description="Name of the PDB"
// +kubebuilder:printcolumn:JSONPath=".status.openMode",name="PDB State",type="string",description="PDB Open Mode"
Expand Down
31 changes: 29 additions & 2 deletions apis/database/v1alpha1/pdb_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
** SOFTWARE.
*/

/* MODIFIED (MM/DD/YY)
** rcitton 07/14/22 - 33822886
*/

package v1alpha1

import (
Expand Down Expand Up @@ -143,6 +147,21 @@ func (r *PDB) validateAction(allErrs *field.ErrorList) {

pdblog.Info("Valdiating PDB Resource Action : " + action)

if reflect.ValueOf(r.Spec.PDBTlsKey).IsZero() {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("pdbTlsKey"), "Please specify PDB Tls Key(secret)"))
}

if reflect.ValueOf(r.Spec.PDBTlsCrt).IsZero() {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("pdbTlsCrt"), "Please specify PDB Tls Certificate(secret)"))
}

if reflect.ValueOf(r.Spec.PDBTlsCat).IsZero() {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("pdbTlsCat"), "Please specify PDB Tls Certificate Authority(secret)"))
}

switch action {
case "CREATE":
if reflect.ValueOf(r.Spec.AdminName).IsZero() {
Expand All @@ -157,6 +176,14 @@ func (r *PDB) validateAction(allErrs *field.ErrorList) {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("fileNameConversions"), "Please specify a value for fileNameConversions. Values can be a filename convert pattern or NONE"))
}
if r.Spec.TotalSize == "" {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("totalSize"), "When the storage is not UNLIMITED the Total Size must be specified"))
}
if r.Spec.TempSize == "" {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("tempSize"), "When the storage is not UNLIMITED the Temp Size must be specified"))
}
if *(r.Spec.TDEImport) {
r.validateTDEInfo(allErrs)
}
Expand All @@ -168,11 +195,11 @@ func (r *PDB) validateAction(allErrs *field.ErrorList) {
}
if r.Spec.TotalSize == "" {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("totalSize"), "Please specify size of the tablespace"))
field.Required(field.NewPath("spec").Child("totalSize"), "When the storage is not UNLIMITED the Total Size must be specified"))
}
if r.Spec.TempSize == "" {
*allErrs = append(*allErrs,
field.Required(field.NewPath("spec").Child("tempSize"), "Please specify size of the temporary tablespace"))
field.Required(field.NewPath("spec").Child("tempSize"), "When the storage is not UNLIMITED the Temp Size must be specified"))
}
case "PLUG":
if r.Spec.XMLFileName == "" {
Expand Down
61 changes: 37 additions & 24 deletions apis/database/v1alpha1/singleinstancedatabase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ type SingleInstanceDatabaseSpec struct {
// +k8s:openapi-gen=true
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]+$`
// +kubebuilder:validation:MaxLength:=12
Sid string `json:"sid,omitempty"`
Charset string `json:"charset,omitempty"`
Pdbname string `json:"pdbName,omitempty"`
LoadBalancer bool `json:"loadBalancer,omitempty"`
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
FlashBack bool `json:"flashBack,omitempty"`
ArchiveLog bool `json:"archiveLog,omitempty"`
ForceLogging bool `json:"forceLog,omitempty"`
Sid string `json:"sid,omitempty"`
Charset string `json:"charset,omitempty"`
Pdbname string `json:"pdbName,omitempty"`
LoadBalancer bool `json:"loadBalancer,omitempty"`
ListenerPort int `json:"listenerPort,omitempty"`
TcpsListenerPort int `json:"tcpsListenerPort,omitempty"`
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
FlashBack bool `json:"flashBack,omitempty"`
ArchiveLog bool `json:"archiveLog,omitempty"`
ForceLogging bool `json:"forceLog,omitempty"`
EnableTCPS bool `json:"enableTCPS,omitempty"`
TcpsCertRenewInterval string `json:"tcpsCertRenewInterval,omitempty"`

CloneFrom string `json:"cloneFrom,omitempty"`
ReadinessCheckPeriod int `json:"readinessCheckPeriod,omitempty"`
Expand Down Expand Up @@ -128,24 +132,31 @@ type SingleInstanceDatabaseStatus struct {
DatafilesPatched string `json:"datafilesPatched,omitempty"`
ConnectString string `json:"connectString,omitempty"`
ClusterConnectString string `json:"clusterConnectString,omitempty"`
TcpsConnectString string `json:"tcpsConnectString,omitempty"`
StandbyDatabases map[string]string `json:"standbyDatabases,omitempty"`
// +kubebuilder:default:="false"
DatafilesCreated string `json:"datafilesCreated,omitempty"`
Sid string `json:"sid,omitempty"`
Edition string `json:"edition,omitempty"`
Charset string `json:"charset,omitempty"`
Pdbname string `json:"pdbName,omitempty"`
InitSgaSize int `json:"initSgaSize,omitempty"`
InitPgaSize int `json:"initPgaSize,omitempty"`
CloneFrom string `json:"cloneFrom,omitempty"`
FlashBack string `json:"flashBack,omitempty"`
ArchiveLog string `json:"archiveLog,omitempty"`
ForceLogging string `json:"forceLog,omitempty"`
OemExpressUrl string `json:"oemExpressUrl,omitempty"`
OrdsReference string `json:"ordsReference,omitempty"`
PdbConnectString string `json:"pdbConnectString,omitempty"`
ApexInstalled bool `json:"apexInstalled,omitempty"`
PrebuiltDB bool `json:"prebuiltDB,omitempty"`
DatafilesCreated string `json:"datafilesCreated,omitempty"`
Sid string `json:"sid,omitempty"`
Edition string `json:"edition,omitempty"`
Charset string `json:"charset,omitempty"`
Pdbname string `json:"pdbName,omitempty"`
InitSgaSize int `json:"initSgaSize,omitempty"`
InitPgaSize int `json:"initPgaSize,omitempty"`
CloneFrom string `json:"cloneFrom,omitempty"`
FlashBack string `json:"flashBack,omitempty"`
ArchiveLog string `json:"archiveLog,omitempty"`
ForceLogging string `json:"forceLog,omitempty"`
OemExpressUrl string `json:"oemExpressUrl,omitempty"`
OrdsReference string `json:"ordsReference,omitempty"`
PdbConnectString string `json:"pdbConnectString,omitempty"`
TcpsPdbConnectString string `json:"tcpsPdbConnectString,omitempty"`
ApexInstalled bool `json:"apexInstalled,omitempty"`
PrebuiltDB bool `json:"prebuiltDB,omitempty"`
// +kubebuilder:default:=false
IsTcpsEnabled bool `json:"isTcpsEnabled"`
CertCreationTimestamp string `json:"certCreationTimestamp,omitempty"`
CertRenewInterval string `json:"certRenewInterval,omitempty"`
ClientWalletLoc string `json:"clientWalletLoc,omitempty"`

// +patchMergeKey=type
// +patchStrategy=merge
Expand All @@ -165,7 +176,9 @@ type SingleInstanceDatabaseStatus struct {
// +kubebuilder:printcolumn:JSONPath=".status.role",name="Role",type="string",priority=1
// +kubebuilder:printcolumn:JSONPath=".status.releaseUpdate",name="Version",type="string"
// +kubebuilder:printcolumn:JSONPath=".status.connectString",name="Connect Str",type="string"
// +kubebuilder:printcolumn:JSONPath=".status.tcpsConnectString",name="TCPS Connect Str",type="string"
// +kubebuilder:printcolumn:JSONPath=".status.pdbConnectString",name="Pdb Connect Str",type="string",priority=1
// +kubebuilder:printcolumn:JSONPath=".status.tcpsPdbConnectString",name="TCPS Pdb Connect Str",type="string", priority=1
// +kubebuilder:printcolumn:JSONPath=".status.oemExpressUrl",name="Oem Express Url",type="string"

// SingleInstanceDatabase is the Schema for the singleinstancedatabases API
Expand Down
Loading

0 comments on commit 187707d

Please sign in to comment.