Skip to content

Commit 1d76a2c

Browse files
author
abhisbyk
committed
Resolving merge conflicts
Signed-off-by: abhisbyk <[email protected]>
2 parents a22970d + 74a2b94 commit 1d76a2c

File tree

5 files changed

+76
-41
lines changed

5 files changed

+76
-41
lines changed

Makefile

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -104,32 +104,38 @@ operator-yaml: manifests kustomize
104104
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
105105
$(KUSTOMIZE) build config/default | kubectl delete -f -
106106

107+
##@ Build Dependencies
108+
109+
## Location to install dependencies to
110+
LOCALBIN ?= $(shell pwd)/bin
111+
$(LOCALBIN):
112+
mkdir -p $(LOCALBIN)
113+
114+
## Tool Binaries
115+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
116+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
117+
ENVTEST ?= $(LOCALBIN)/setup-envtest
118+
119+
## Tool Versions
120+
KUSTOMIZE_VERSION ?= v3.8.7
121+
CONTROLLER_TOOLS_VERSION ?= v0.6.1
122+
123+
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
124+
.PHONY: kustomize
125+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
126+
$(KUSTOMIZE): $(LOCALBIN)
127+
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
128+
129+
.PHONY: controller-gen
130+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
131+
$(CONTROLLER_GEN): $(LOCALBIN)
132+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
133+
134+
.PHONY: envtest
135+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
136+
$(ENVTEST): $(LOCALBIN)
137+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
107138

108-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
109-
controller-gen: ## Download controller-gen locally if necessary.
110-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
111-
112-
KUSTOMIZE = $(shell pwd)/bin/kustomize
113-
kustomize: ## Download kustomize locally if necessary.
114-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
115-
116-
ENVTEST = $(shell pwd)/bin/setup-envtest
117-
envtest: ## Download envtest-setup locally if necessary.
118-
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
119-
120-
# go-get-tool will 'go get' any package $2 and install it to $1.
121-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
122-
define go-get-tool
123-
@[ -f $(1) ] || { \
124-
set -e ;\
125-
TMP_DIR=$$(mktemp -d) ;\
126-
cd $$TMP_DIR ;\
127-
go mod init tmp ;\
128-
echo "Downloading $(2)" ;\
129-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
130-
rm -rf $$TMP_DIR ;\
131-
}
132-
endef
133139

134140
.PHONY: bundle
135141
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Make Oracle Database Kubernetes Native - Take 2
44

5-
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`). OraOperator extends the Kubernetes API with custom resources and controllers for automating Oracle Database lifecycle management.
5+
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.
66

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

@@ -32,7 +32,7 @@ The upcoming releases will support new configurations, operations and capabiliti
3232

3333
## Release Status
3434

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

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

@@ -67,8 +67,13 @@ Oracle strongly recommends that you ensure your system meets the following [Prer
6767
```sh
6868
kubectl apply -f https://raw.githubusercontent.com/oracle/oracle-database-operator/main/oracle-database-operator.yaml
6969
```
70+
---
71+
**NOTE:**
72+
The above command will also upgrade the existing v0.1.0 `OraOperator` installation to the latest version i.e. v0.2.0.
7073

71-
Ensure that operator pods are up and running. Operator pod replicas are set to a default of 3 for High Availability, which can be scaled up and down.
74+
---
75+
76+
Ensure that the operator pods are up and running. For high availability, Operator pod replicas are set to a default of 3. You can scale this setting up or down.
7277

7378
```sh
7479
$ kubectl get pods -n oracle-database-operator-system
@@ -101,7 +106,7 @@ YAML file templates are available under [`/config/samples`](./config/samples/).
101106

102107
## Uninstall the Operator
103108

104-
To uninstall the operator, the final step consists of deciding whether or not you want to delete the CRDs and APIServices that were introduced to the cluster by the operator. Choose one of the following options:
109+
To uninstall the operator, the final step consists of deciding whether you want to delete the custom resource definitions (CRDs) and Kubernetes APIServices introduced into the cluster by the operator. Choose one of the following options:
105110

106111
* ### Deleting the CRDs and APIServices
107112

@@ -120,13 +125,13 @@ YAML file templates are available under [`/config/samples`](./config/samples/).
120125
kubectl delete pdb.database.oracle.com --all -n <namespace>
121126
```
122127

123-
After all CRD instances are deleted, it is safe to remove the CRDs, APISerivces and operator deployment.
128+
After all CRD instances are deleted, it is safe to remove the CRDs, APISerivces and operator deployment. Use the following command:
124129

125130
```sh
126131
kubectl delete -f oracle-database-operator.yaml --ignore-not-found=true
127132
```
128133

129-
Note: If the CRD instances are not deleted, and the operator is deleted by using the preceding command, then operator deployment and instance objects (pods,services, PVCs, and so on) are deleted. However, the CRD deletion stops responding, because the CRD instances have properties that prevent its deletion and that can only be removed by the operator pod, which is deleted when the APIServices are deleted.
134+
Note: If the CRD instances are not deleted, and the operator is deleted by using the preceding command, then operator deployment and instance objects (pods, services, PVCs, and so on) are deleted. However, if that happens, then the CRD deletion stops responding. This is because the CRD instances have properties that prevent their deletion, and that can only be removed by the operator pod, which is deleted when the APIServices are deleted.
130135

131136

132137
## Docs of the supported Oracle Database configurations

controllers/database/oraclerestdataservice_controller.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,18 @@ func (r *OracleRestDataServiceReconciler) createSVC(ctx context.Context, req ctr
855855
m.Status.ServiceIP = ""
856856
if m.Spec.LoadBalancer {
857857
if len(svc.Status.LoadBalancer.Ingress) > 0 {
858-
m.Status.DatabaseApiUrl = "https://" + svc.Status.LoadBalancer.Ingress[0].IP + ":" +
858+
// 'lbAddress' will contain the Fully Qualified Hostname of the LB. If the hostname is not available it will contain the IP address of the LB
859+
lbAddress := svc.Status.LoadBalancer.Ingress[0].Hostname
860+
if lbAddress == "" {
861+
lbAddress = svc.Status.LoadBalancer.Ingress[0].IP
862+
}
863+
m.Status.DatabaseApiUrl = "https://" + lbAddress + ":" +
859864
fmt.Sprint(svc.Spec.Ports[0].Port) + "/ords/" + n.Status.Pdbname + "/_/db-api/stable/"
860-
m.Status.ServiceIP = svc.Status.LoadBalancer.Ingress[0].IP
861-
m.Status.DatabaseActionsUrl = "https://" + svc.Status.LoadBalancer.Ingress[0].IP + ":" +
865+
m.Status.ServiceIP = lbAddress
866+
m.Status.DatabaseActionsUrl = "https://" + lbAddress + ":" +
862867
fmt.Sprint(svc.Spec.Ports[0].Port) + "/ords/sql-developer"
863868
if m.Status.ApexConfigured {
864-
m.Status.ApxeUrl = "https://" + svc.Status.LoadBalancer.Ingress[0].IP + ":" +
869+
m.Status.ApxeUrl = "https://" + lbAddress + ":" +
865870
fmt.Sprint(svc.Spec.Ports[0].Port) + "/ords/" + n.Status.Pdbname + "/apex"
866871
}
867872
}

controllers/database/singleinstancedatabase_controller.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,9 +1178,14 @@ func (r *SingleInstanceDatabaseReconciler) createOrReplaceSVC(ctx context.Contex
11781178
if m.Spec.LoadBalancer {
11791179
m.Status.ClusterConnectString = userSvc.Name + "." + userSvc.Namespace + ":" + fmt.Sprint(userSvc.Spec.Ports[0].Port) + "/" + strings.ToUpper(sid)
11801180
if len(userSvc.Status.LoadBalancer.Ingress) > 0 {
1181-
m.Status.ConnectString = userSvc.Status.LoadBalancer.Ingress[0].IP + ":" + fmt.Sprint(userSvc.Spec.Ports[0].Port) + "/" + strings.ToUpper(sid)
1182-
m.Status.PdbConnectString = userSvc.Status.LoadBalancer.Ingress[0].IP + ":" + fmt.Sprint(userSvc.Spec.Ports[0].Port) + "/" + strings.ToUpper(pdbName)
1183-
m.Status.OemExpressUrl = "https://" + userSvc.Status.LoadBalancer.Ingress[0].IP + ":" + fmt.Sprint(userSvc.Spec.Ports[1].Port) + "/em"
1181+
// 'lbAddress' will contain the Fully Qualified Hostname of the LB. If the hostname is not available it will contain the IP address of the LB
1182+
lbAddress := userSvc.Status.LoadBalancer.Ingress[0].Hostname
1183+
if lbAddress == "" {
1184+
lbAddress = userSvc.Status.LoadBalancer.Ingress[0].IP
1185+
}
1186+
m.Status.ConnectString = lbAddress + ":" + fmt.Sprint(userSvc.Spec.Ports[0].Port) + "/" + strings.ToUpper(sid)
1187+
m.Status.PdbConnectString = lbAddress + ":" + fmt.Sprint(userSvc.Spec.Ports[0].Port) + "/" + strings.ToUpper(pdbName)
1188+
m.Status.OemExpressUrl = "https://" + lbAddress + ":" + fmt.Sprint(userSvc.Spec.Ports[1].Port) + "/em"
11841189
}
11851190
return requeueN, nil
11861191
}

docs/sidb/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Oracle Database Operator for Kubernetes (`OraOperator`) includes the Single Inst
3232
* [APEX Installation](#apex-installation)
3333
* [Delete ORDS](#delete-ords)
3434
* [Maintenance Operations](#maintenance-operations)
35+
* [Additional Information](#additional-information)
3536

3637
## Prerequisites
3738

@@ -307,7 +308,7 @@ nodeSelector:
307308
```
308309

309310
##### OCI NFS Volume Static Provisioning
310-
Similar to the block volume static provisioning, you have to manually create a file system resource from the OCI console, and fetch its `OCID, Mount Target and Export Path`. Mention these values in the following YAML file to create the persistent volume:
311+
Similar to the block volume static provisioning, you have to manually create a file system resource from the OCI console, and fetch its `OCID, Mount Target IP Address and Export Path`. Mention these values in the following YAML file to create the persistent volume:
311312

312313
```yaml
313314
apiVersion: v1
@@ -323,10 +324,17 @@ spec:
323324
persistentVolumeReclaimPolicy: Retain
324325
csi:
325326
driver: fss.csi.oraclecloud.com
326-
volumeHandle: "<OCID of the file system>:<Mount Target>/<Export Path>"
327+
volumeHandle: "<OCID of the file system>:<Mount Target IP Address>:/<Export Path>"
327328
```
328329

329-
**Note:** Whenever a mount target is provisioned in OCI, its `Reported Size (GiB)` values are very large. This is visible on the mount target page when logged in to the OCI console. Some applications will fail to install if the results of a space requirements check show too much available disk space. So specify, in gibibytes (GiB), the maximum capacity reported by file systems exported through this mount target. This setting does not limit the actual amount of data you can store.
330+
**Note:**
331+
- Example volumeHandle in the above config file :
332+
333+
`volumeHandle: "ocid1.filesystem.oc1.eu_frankfurt_1.aaaaaqe3bj...eaaa:10.0.10.156:/FileSystem-20220713-1036-02"`
334+
335+
- Whenever a mount target is provisioned in OCI, its `Reported Size (GiB)` values are very large. This is visible on the mount target page when logged in to the OCI console. Some applications will fail to install if the results of a space requirements check show too much available disk space. So in the OCI Console, click the little "Pencil" icon besides the **Reported Size** parameter of the Mount Target to specify, in gigabytes (GiB), the maximum capacity reported by file systems exported through this mount target. This setting does not limit the actual amount of data you can store.
336+
337+
- Make sure to open the required ports to access the NFS volume from the K8S cluster: add the required ports to the security list of the subnet where your K8S nodes are connected to; see **[here](https://docs.oracle.com/en-us/iaas/Content/File/Tasks/securitylistsfilestorage.htm)** for the details.
330338

331339
### Configuring a Database
332340
The `OraOperator` facilitates you to configure the database. Various database configuration options are explained in the following subsections:
@@ -786,3 +794,9 @@ If you need to perform some maintenance operations (Database/ORDS) manually, the
786794
3. Log In to `sqlplus` to perform manual operations by using the following command:
787795
788796
sqlplus / as sysdba
797+
798+
## Additional information
799+
Detailed instructions for setting up Single Instance Database by OraOperator using OCI free trial account is available now in the LiveLab format. Please use the following link:
800+
[https://oracle.github.io/cloudtestdrive/AppDev/database-operator/workshops/freetier/?lab=introduction](https://oracle.github.io/cloudtestdrive/AppDev/database-operator/workshops/freetier/?lab=introduction)
801+
802+
Thanks, [Jan Leemans](https://github.com/janleemans), for this effort!!

0 commit comments

Comments
 (0)