Skip to content

Commit 577a467

Browse files
Merge pull request #114 from IshaanDesai45/idesai_doc_changes
Doc and comments enhancement
2 parents 15c7844 + 72161cd commit 577a467

File tree

3 files changed

+107
-61
lines changed

3 files changed

+107
-61
lines changed
Lines changed: 76 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,94 @@
11
#
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44
#
5-
65
---
7-
# Create a Security Context Contraint
86

9-
kind: SecurityContextConstraints
10-
apiVersion: v1
11-
metadata:
12-
name: sidb-scc
13-
namespace: default
14-
allowPrivilegedContainer: false
15-
users:
16-
- system:serviceaccount:default:sidb-sa
17-
- system:serviceaccount:default:oracle-database-operator
18-
runAsUser:
19-
type: MustRunAsRange
20-
uidRangeMin: 0
21-
uidRangeMax: 60000
22-
seLinuxContext:
23-
type: RunAsAny
24-
fsGroup:
25-
type: MustRunAs
26-
ranges:
27-
- min: 0
28-
max: 60000
29-
supplementalGroups:
7+
# Create a Security Context Contraint
8+
kind: SecurityContextConstraints
9+
apiVersion: security.openshift.io/v1
10+
metadata:
11+
name: sidb-oracle-user-scc
12+
allowPrivilegedContainer: false
13+
allowedCapabilities:
14+
- SYS_NICE
15+
runAsUser:
16+
type: MustRunAs
17+
uid: 54321
18+
seLinuxContext:
19+
type: RunAsAny
20+
fsGroup:
21+
type: MustRunAs
22+
ranges:
23+
- min: 54321
24+
max: 54321
25+
supplementalGroups:
3026
type: MustRunAs
3127
ranges:
32-
- min: 0
33-
max: 60000
28+
- min: 54321
29+
max: 54321
30+
---
3431

32+
# Create a Security Context Contraint
33+
kind: SecurityContextConstraints
34+
apiVersion: security.openshift.io/v1
35+
metadata:
36+
name: sidb-oracle-root-user-scc
37+
allowPrivilegedContainer: false
38+
allowedCapabilities:
39+
- SYS_NICE
40+
runAsUser:
41+
type: MustRunAsRange
42+
uidRangeMin: 0
43+
uidRangeMax: 54321
44+
seLinuxContext:
45+
type: RunAsAny
46+
fsGroup:
47+
type: MustRunAs
48+
ranges:
49+
- min: 0
50+
max: 54321
51+
supplementalGroups:
52+
type: MustRunAs
53+
ranges:
54+
- min: 0
55+
max: 5432
3556
---
36-
# Create Service Account
3757

3858
apiVersion: v1
3959
kind: ServiceAccount
4060
metadata:
4161
name: sidb-sa
42-
namespace: default
43-
62+
namespace: sidb-ns
4463
---
45-
# Create a rbac role
46-
47-
kind: Role
48-
apiVersion: rbac.authorization.k8s.io/v1
49-
metadata:
50-
name: use-sidb-scc
51-
namespace: default
52-
rules:
53-
- apiGroups: ["security.openshift.io"]
54-
resources: ["securitycontextconstraints"]
55-
resourceNames: ["sidb-scc"]
56-
verbs: ["use"]
5764

65+
kind: Role
66+
apiVersion: rbac.authorization.k8s.io/v1
67+
metadata:
68+
name: use-sidb-scc
69+
namespace: sidb-ns
70+
rules:
71+
- apiGroups:
72+
- security.openshift.io
73+
verbs:
74+
- use
75+
resources:
76+
- securitycontextconstraints
77+
resourceNames:
78+
- sidb-oracle-user-scc
79+
- sidb-oracle-root-user-scc
5880
---
59-
# Create a rbac role binding
6081

61-
kind: RoleBinding
62-
apiVersion: rbac.authorization.k8s.io/v1
63-
metadata:
64-
name: use-sidb-scc
65-
namespace: default
66-
subjects:
67-
- kind: ServiceAccount
68-
name: sidb-sa
69-
roleRef:
70-
kind: Role
71-
name: use-sidb-scc
72-
apiGroup: rbac.authorization.k8s.io
73-
82+
kind: RoleBinding
83+
apiVersion: rbac.authorization.k8s.io/v1
84+
metadata:
85+
name: use-sidb-scc
86+
namespace: sidb-ns
87+
subjects:
88+
- kind: ServiceAccount
89+
name: sidb-sa
90+
namespace: sidb-ns
91+
roleRef:
92+
kind: Role
93+
name: use-sidb-scc
94+
apiGroup: rbac.authorization.k8s.io

config/samples/sidb/singleinstancedatabase.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ spec:
6464
tcpsCertRenewInterval: 8760h
6565

6666
## N/A for createAs clone or standby
67-
## Specify both sgaSize and pgaSize (in MB) or dont specify both
6867
## Specify Non-Zero value to use
69-
## You cannot change these initParams for Oracle Database Express (XE) edition
68+
## sgaTarget and pgaAggregateTarget must be in MB
69+
## You cannot change these initParams for Oracle Database Express (XE) and Oracle Database Free edition
7070
initParams:
7171
cpuCount: 0
7272
processes: 0

docs/sidb/README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Oracle Database Operator for Kubernetes (`OraOperator`) includes the Single Inst
55
* [Prerequisites](#prerequisites)
66
* [Mandatory Resource Privileges](#mandatory-resource-privileges)
77
* [Optional Resource Privileges](#optional-resource-privileges)
8+
* [OpenShift Security Context Constraints](#openshift-security-context-constraints)
89
* [SingleInstanceDatabase Resource](#singleinstancedatabase-resource)
910
* [Create a Database](#create-a-database)
1011
* [New Database](#new-database)
@@ -47,6 +48,7 @@ Oracle Database Operator for Kubernetes (`OraOperator`) includes the Single Inst
4748
* [Maintenance Operations](#maintenance-operations)
4849
* [Additional Information](#additional-information)
4950

51+
5052
## Prerequisites
5153

5254
Oracle strongly recommends to comply with the [prerequisites](./PREREQUISITES.md) and the following requirements
@@ -89,7 +91,30 @@ Oracle strongly recommends to comply with the [prerequisites](./PREREQUISITES.md
8991
```sh
9092
kubectl apply -f rbac/persistent-volume-rbac.yaml
9193
```
94+
95+
### OpenShift Security Context Constraints
96+
97+
OpenShift requires additional Security Context Constraints (SCC) for deploying and managing the SingleInstanceDatabase resource. Follow these steps to create the appropriate SCCs before deploying the SingleInstanceDatabase resource.
98+
99+
1. Create a new project/namespace for deploying the SingleInstanceDatabase resource
100+
101+
```sh
102+
oc new-project sidb-ns
103+
```
104+
105+
**Note:** OpenShift recommends not to deploy in namespaces starting with `kube`, `openshift` and the `default` namespace.
106+
107+
2. Apply the file [openshift_rbac.yaml](../../config/samples/sidb/openshift_rbac.yaml) with cluster-admin user privileges.
108+
109+
```sh
110+
oc apply -f openshift-rbac.yaml
111+
```
112+
113+
This would result in creation of SCC (Security Context Constraints) and serviceaccount `sidb-sa` in the namespace `sidb-ns` which has access to the SCC.
114+
115+
**Note:** The above config yaml file will bind the SCC to the serviceaccount `sidb-sa` in namespace `sidb-ns`. For any other project/namespace update the file appropriately with the namespace before applying.
92116

117+
3. Set the `serviceAccountName` attribute to `sidb-sa` and the namespace to `sidb-ns` in **[config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml)** before deploying the SingleInstanceDatabase resource.
93118

94119
## SingleInstanceDatabase Resource
95120

@@ -961,12 +986,12 @@ $ kubectl describe oraclerestdataservice ords-sample
961986

962987
### Template YAML
963988

964-
The template `.yaml` file for Oracle Rest Data Services (`OracleRestDataService` kind), including all the configurable options, is available at **[config/samples/sidb/oraclerestdataservice.yaml](config/samples/sidb/oraclerestdataservice.yaml)**.
989+
The template `.yaml` file for Oracle Rest Data Services (`OracleRestDataService` kind), including all the configurable options, is available at **[config/samples/sidb/oraclerestdataservice.yaml](../../config/samples/sidb/oraclerestdataservice.yaml)**.
965990

966991
**Note:**
967992
- The `adminPassword` and `ordsPassword` fields in the `oraclerestdataservice.yaml` file contains secrets for authenticating the Single Instance Database and the ORDS user with the following roles: `SQL Administrator, System Administrator, SQL Developer, oracle.dbtools.autorest.any.schema`.
968993
- To build the ORDS image, use the following instructions: [Building Oracle REST Data Services Install Images](https://github.com/oracle/docker-images/tree/main/OracleRestDataServices#building-oracle-rest-data-services-install-images).
969-
- By default, ORDS uses self-signed certificates. To use certificates from the Certificate Authority, the ORDS image needs to be rebuilt after specifying the values of `ssl.cert` and `ssl.cert.key` in the [standalone.properties](https://github.com/oracle/docker-images/blob/main/OracleRestDataServices/dockerfiles/standalone.properties.tmpl) file. After you rebuild the ORDS image, use the rebuilt image in the **[config/samples/sidb/oraclerestdataservice.yaml](config/samples/sidb/oraclerestdataservice.yaml)** file.
994+
- By default, ORDS uses self-signed certificates. To use certificates from the Certificate Authority, the ORDS image needs to be rebuilt after specifying the values of `ssl.cert` and `ssl.cert.key` in the [standalone.properties](https://github.com/oracle/docker-images/blob/main/OracleRestDataServices/dockerfiles/standalone.properties.tmpl) file. After you rebuild the ORDS image, use the rebuilt image in the **[config/samples/sidb/oraclerestdataservice.yaml](../../config/samples/sidb/oraclerestdataservice.yaml)** file.
970995
- If you want to install ORDS in a [prebuilt database](#provision-a-pre-built-database), make sure to attach the **database persistence** by uncommenting the `persistence` section in the **[config/samples/sidb/singleinstancedatabase_prebuiltdb.yaml](../../config/samples/sidb/singleinstancedatabase_prebuiltdb.yaml)** file, while provisioning the prebuilt database.
971996

972997
### REST Enable a Database
@@ -1114,7 +1139,7 @@ Fetch all entries from 'DEPT' table by calling the following API
11141139
Database Actions is a web-based interface that uses Oracle REST Data Services to provide development, data tools, administration and monitoring features for Oracle Database.
11151140

11161141
* To use Database Actions, you must sign in as a database user whose schema has been REST-enabled.
1117-
* To enable a schema for REST, you can specify appropriate values for the `.spec.restEnableSchemas` attributes details in the sample `yaml` **[config/samples/sidb/oraclerestdataservice.yaml](config/samples/sidb/oraclerestdataservice.yaml)**, which are needed for authorizing Database Actions.
1142+
* To enable a schema for REST, you can specify appropriate values for the `.spec.restEnableSchemas` attributes details in the sample `yaml` **[config/samples/sidb/oraclerestdataservice.yaml](../../config/samples/sidb/oraclerestdataservice.yaml)**, which are needed for authorizing Database Actions.
11181143
* Schema are created (if they exist) with the username as `.spec.restEnableSchema[].schema` and password as `.spec.ordsPassword.`.
11191144
* UrlMapping `.spec.restEnableSchema[].urlMapping` is optional and is defaulted to `.spec.restEnableSchema[].schema`.
11201145

@@ -1148,7 +1173,7 @@ Using APEX, developers can quickly develop and deploy compelling apps that solve
11481173
11491174
The `OraOperator` facilitates installation of APEX in the database and also configures ORDS for it. The following section will explain installing APEX with configured ORDS:
11501175
1151-
* For quick provisioning, use the sample **[config/samples/sidb/oraclerestdataservice_apex.yaml](../../confi/samples/sidb/oraclerestdataservice_apex.yaml)** file. For example:
1176+
* For quick provisioning, use the sample **[config/samples/sidb/oraclerestdataservice_apex.yaml](../../config/samples/sidb/oraclerestdataservice_apex.yaml)** file. For example:
11521177
11531178
kubectl apply -f oraclerestdataservice_apex.yaml
11541179

0 commit comments

Comments
 (0)