Skip to content

Commit f8e273c

Browse files
committed
Doc and comments enhancement to support openshift
1 parent 15c7844 commit f8e273c

File tree

3 files changed

+77
-32
lines changed

3 files changed

+77
-32
lines changed

config/samples/sidb/openshift_rbac.yaml

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,93 @@
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
---
76
# Create a Security Context Contraint
87

98
kind: SecurityContextConstraints
10-
apiVersion: v1
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:
26+
type: MustRunAs
27+
ranges:
28+
- min: 54321
29+
max: 54321
30+
---
31+
# Create a Security Context Contraint
32+
33+
kind: SecurityContextConstraints
34+
apiVersion: security.openshift.io/v1
1135
metadata:
12-
name: sidb-scc
13-
namespace: default
36+
name: sidb-oracle-root-user-scc
1437
allowPrivilegedContainer: false
15-
users:
16-
- system:serviceaccount:default:sidb-sa
17-
- system:serviceaccount:default:oracle-database-operator
38+
allowedCapabilities:
39+
- SYS_NICE
1840
runAsUser:
1941
type: MustRunAsRange
2042
uidRangeMin: 0
21-
uidRangeMax: 60000
43+
uidRangeMax: 54321
2244
seLinuxContext:
2345
type: RunAsAny
2446
fsGroup:
2547
type: MustRunAs
2648
ranges:
2749
- min: 0
28-
max: 60000
50+
max: 54321
2951
supplementalGroups:
3052
type: MustRunAs
3153
ranges:
3254
- min: 0
33-
max: 60000
34-
55+
max: 54321
3556
---
36-
# Create Service Account
37-
3857
apiVersion: v1
3958
kind: ServiceAccount
4059
metadata:
4160
name: sidb-sa
42-
namespace: default
61+
namespace: sidb-ns
4362

4463
---
45-
# Create a rbac role
46-
4764
kind: Role
4865
apiVersion: rbac.authorization.k8s.io/v1
4966
metadata:
5067
name: use-sidb-scc
51-
namespace: default
68+
namespace: sidb-ns
5269
rules:
53-
- apiGroups: ["security.openshift.io"]
54-
resources: ["securitycontextconstraints"]
55-
resourceNames: ["sidb-scc"]
56-
verbs: ["use"]
70+
- verbs:
71+
- use
72+
apiGroups:
73+
- security.openshift.io
74+
resources:
75+
- securitycontextconstraints
76+
resourceNames:
77+
- oracle-user-scc
78+
- oracle-root-scc
5779

5880
---
59-
# Create a rbac role binding
60-
6181
kind: RoleBinding
6282
apiVersion: rbac.authorization.k8s.io/v1
6383
metadata:
6484
name: use-sidb-scc
65-
namespace: default
85+
namespace: sidb-ns
6686
subjects:
6787
- kind: ServiceAccount
6888
name: sidb-sa
89+
namespace: sidb-ns
6990
roleRef:
7091
kind: Role
7192
name: use-sidb-scc
7293
apiGroup: rbac.authorization.k8s.io
73-

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 pagAggregateTarget 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)