Skip to content

Commit d4edab2

Browse files
mmalvezzoracle database
and
oracle database
authored
V1 cdb (#167)
* cdb_types v1alpha1 placeholder * pdb types v1alpha1 placeholder --------- Co-authored-by: oracle database <[email protected]>
1 parent ffb4024 commit d4edab2

File tree

2 files changed

+426
-0
lines changed

2 files changed

+426
-0
lines changed

apis/database/v1alpha1/cdb_types.go

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*
2+
** Copyright (c) 2022 Oracle and/or its affiliates.
3+
**
4+
** The Universal Permissive License (UPL), Version 1.0
5+
**
6+
** Subject to the condition set forth below, permission is hereby granted to any
7+
** person obtaining a copy of this software, associated documentation and/or data
8+
** (collectively the "Software"), free of charge and under any and all copyright
9+
** rights in the Software, and any and all patent rights owned or freely
10+
** licensable by each licensor hereunder covering either (i) the unmodified
11+
** Software as contributed to or provided by such licensor, or (ii) the Larger
12+
** Works (as defined below), to deal in both
13+
**
14+
** (a) the Software, and
15+
** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
** one is included with the Software (each a "Larger Work" to which the Software
17+
** is contributed by such licensors),
18+
**
19+
** without restriction, including without limitation the rights to copy, create
20+
** derivative works of, display, perform, and distribute the Software and make,
21+
** use, sell, offer for sale, import, export, have made, and have sold the
22+
** Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
** either these or other terms.
24+
**
25+
** This license is subject to the following condition:
26+
** The above copyright notice and either this complete permission notice or at
27+
** a minimum a reference to the UPL must be included in all copies or
28+
** substantial portions of the Software.
29+
**
30+
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
** SOFTWARE.
37+
*/
38+
39+
package v1alpha1
40+
41+
import (
42+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
43+
)
44+
45+
// CDBSpec defines the desired state of CDB
46+
type CDBSpec struct {
47+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
48+
// Important: Run "make" to regenerate code after modifying this file
49+
50+
// Name of the CDB
51+
CDBName string `json:"cdbName,omitempty"`
52+
// Name of the CDB Service
53+
ServiceName string `json:"serviceName,omitempty"`
54+
55+
// Password for the CDB System Administrator
56+
SysAdminPwd CDBSysAdminPassword `json:"sysAdminPwd,omitempty"`
57+
// User in the root container with sysdba priviledges to manage PDB lifecycle
58+
CDBAdminUser CDBAdminUser `json:"cdbAdminUser,omitempty"`
59+
// Password for the CDB Administrator to manage PDB lifecycle
60+
CDBAdminPwd CDBAdminPassword `json:"cdbAdminPwd,omitempty"`
61+
62+
CDBTlsKey CDBTLSKEY `json:"cdbTlsKey,omitempty"`
63+
CDBTlsCrt CDBTLSCRT `json:"cdbTlsCrt,omitempty"`
64+
65+
// Password for user ORDS_PUBLIC_USER
66+
ORDSPwd ORDSPassword `json:"ordsPwd,omitempty"`
67+
// ORDS server port. For now, keep it as 8888. TO BE USED IN FUTURE RELEASE.
68+
ORDSPort int `json:"ordsPort,omitempty"`
69+
// ORDS Image Name
70+
ORDSImage string `json:"ordsImage,omitempty"`
71+
// The name of the image pull secret in case of a private docker repository.
72+
ORDSImagePullSecret string `json:"ordsImagePullSecret,omitempty"`
73+
// ORDS Image Pull Policy
74+
// +kubebuilder:validation:Enum=Always;Never
75+
ORDSImagePullPolicy string `json:"ordsImagePullPolicy,omitempty"`
76+
// Number of ORDS Containers to create
77+
Replicas int `json:"replicas,omitempty"`
78+
// Web Server User with SQL Administrator role to allow us to authenticate to the PDB Lifecycle Management REST endpoints
79+
WebServerUser WebServerUser `json:"webServerUser,omitempty"`
80+
// Password for the Web Server User
81+
WebServerPwd WebServerPassword `json:"webServerPwd,omitempty"`
82+
// Name of the DB server
83+
DBServer string `json:"dbServer,omitempty"`
84+
// DB server port
85+
DBPort int `json:"dbPort,omitempty"`
86+
// Node Selector for running the Pod
87+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
88+
DeletePDBCascade bool `json:"deletePdbCascade,omitempty"`
89+
DBTnsurl string `json:"dbTnsurl,omitempty"`
90+
CDBPubKey CDBPUBKEY `json:"cdbOrdsPubKey,omitempty"`
91+
CDBPriKey CDBPRIVKEY `json:"cdbOrdsPrvKey,omitempty"`
92+
}
93+
94+
// CDBSecret defines the secretName
95+
type CDBSecret struct {
96+
SecretName string `json:"secretName"`
97+
Key string `json:"key"`
98+
}
99+
100+
// CDBSysAdminPassword defines the secret containing SysAdmin Password mapped to key 'sysAdminPwd' for CDB
101+
type CDBSysAdminPassword struct {
102+
Secret CDBSecret `json:"secret"`
103+
}
104+
105+
// CDBAdminUser defines the secret containing CDB Administrator User mapped to key 'cdbAdminUser' to manage PDB lifecycle
106+
type CDBAdminUser struct {
107+
Secret CDBSecret `json:"secret"`
108+
}
109+
110+
// CDBAdminPassword defines the secret containing CDB Administrator Password mapped to key 'cdbAdminPwd' to manage PDB lifecycle
111+
type CDBAdminPassword struct {
112+
Secret CDBSecret `json:"secret"`
113+
}
114+
115+
// ORDSPassword defines the secret containing ORDS_PUBLIC_USER Password mapped to key 'ordsPwd'
116+
type ORDSPassword struct {
117+
Secret CDBSecret `json:"secret"`
118+
}
119+
120+
// WebServerUser defines the secret containing Web Server User mapped to key 'webServerUser' to manage PDB lifecycle
121+
type WebServerUser struct {
122+
Secret CDBSecret `json:"secret"`
123+
}
124+
125+
// WebServerPassword defines the secret containing password for Web Server User mapped to key 'webServerPwd' to manage PDB lifecycle
126+
type WebServerPassword struct {
127+
Secret CDBSecret `json:"secret"`
128+
}
129+
130+
type CDBTLSKEY struct {
131+
Secret CDBSecret `json:"secret"`
132+
}
133+
134+
type CDBTLSCRT struct {
135+
Secret CDBSecret `json:"secret"`
136+
}
137+
138+
type CDBPUBKEY struct {
139+
Secret CDBSecret `json:"secret"`
140+
}
141+
142+
type CDBPRIVKEY struct {
143+
Secret CDBSecret `json:"secret"`
144+
}
145+
146+
// CDBStatus defines the observed state of CDB
147+
type CDBStatus struct {
148+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
149+
// Important: Run "make" to regenerate code after modifying this file
150+
151+
// Phase of the CDB Resource
152+
Phase string `json:"phase"`
153+
// CDB Resource Status
154+
Status bool `json:"status"`
155+
// Message
156+
Msg string `json:"msg,omitempty"`
157+
}
158+
159+
// +kubebuilder:object:root=true
160+
// +kubebuilder:subresource:status
161+
// +kubebuilder:printcolumn:JSONPath=".spec.cdbName",name="CDB Name",type="string",description="Name of the CDB"
162+
// +kubebuilder:printcolumn:JSONPath=".spec.dbServer",name="DB Server",type="string",description=" Name of the DB Server"
163+
// +kubebuilder:printcolumn:JSONPath=".spec.dbPort",name="DB Port",type="integer",description="DB server port"
164+
// +kubebuilder:printcolumn:JSONPath=".spec.replicas",name="Replicas",type="integer",description="Replicas"
165+
// +kubebuilder:printcolumn:JSONPath=".status.phase",name="Status",type="string",description="Status of the CDB Resource"
166+
// +kubebuilder:printcolumn:JSONPath=".status.msg",name="Message",type="string",description="Error message, if any"
167+
// +kubebuilder:printcolumn:JSONPath=".spec.dbTnsurl",name="TNS STRING",type="string",description=" string of the tnsalias"
168+
// +kubebuilder:resource:path=cdbs,scope=Namespaced
169+
170+
// CDB is the Schema for the cdbs API
171+
type CDB struct {
172+
metav1.TypeMeta `json:",inline"`
173+
metav1.ObjectMeta `json:"metadata,omitempty"`
174+
175+
Spec CDBSpec `json:"spec,omitempty"`
176+
Status CDBStatus `json:"status,omitempty"`
177+
}
178+
179+
//+kubebuilder:object:root=true
180+
181+
// CDBList contains a list of CDB
182+
type CDBList struct {
183+
metav1.TypeMeta `json:",inline"`
184+
metav1.ListMeta `json:"metadata,omitempty"`
185+
Items []CDB `json:"items"`
186+
}
187+
188+
func init() {
189+
SchemeBuilder.Register(&CDB{}, &CDBList{})
190+
}

0 commit comments

Comments
 (0)