Skip to content

Commit 33172c8

Browse files
committed
Merge branch 'master' into release-0.2.0
2 parents a117ea8 + 7eedef6 commit 33172c8

File tree

321 files changed

+31031
-2715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+31031
-2715
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
operator.tgz
2+
cover.out
3+
bin
4+
testbin/*
5+
onpremtest/*
6+
ords/*zip
7+
.gitattributes
8+
.vscode

.gitlab-ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
build-operator:
2+
stage: build
3+
variables:
4+
IMAGE: "$DOCKER_REPO:$CI_COMMIT_BRANCH"
5+
OP_YAML: oracle-database-operator.yaml
6+
script:
7+
- make docker-build IMG="$IMAGE"
8+
- docker push "$IMAGE"
9+
- newimage=$(docker inspect $IMAGE | python -c 'import json,sys; print json.load(sys.stdin)[0]["RepoDigests"][0]')
10+
- echo $newimage
11+
- docker rmi "$IMAGE" && docker system prune -f
12+
- make operator-yaml IMG=$newimage
13+
- if [ "$CI_COMMIT_BRANCH" != "master" ]; then sed -i "s/\(replicas.\) 3/\1 1/g" ./$OP_YAML; fi
14+
- curl -s -n $ARTIFACTORY_REPO/$CI_COMMIT_BRANCH/$OP_YAML -T ./$OP_YAML
15+
only:
16+
variables:
17+
- $CI_COMMIT_MESSAGE =~ /\#run-pipeline/
18+
- $CI_COMMIT_BRANCH =~ /master/
19+
- $CI_MERGE_REQUEST_ID != ""
20+
except:
21+
variables:
22+
- $CI_COMMIT_MESSAGE =~ /\#skip-pipeline/
23+
24+
cleanup:
25+
stage: .post
26+
script:
27+
- echo "Clean up downloaded binaries"
28+
- rm -rf bin/

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Contributing to This Repository
22

3-
We welcome your contributions! There are multiple ways to contribute.
3+
Oracle welcomes your contributions! There are multiple ways that you can contribute.
44

55
## Opening issues
66

7-
For bugs or enhancement requests, please file a GitHub issue unless the problem is security-related. When filing a bug, remember that the more specific the bug is, the more likely it is to be fixed. If you think you've found a security
8-
vulnerability, then do not raise a GitHub issue. Instead, follow the instructions in our
9-
[security policy](./SECURITY.md).
7+
For bugs or enhancement requests, please file a GitHub issue, unless the problem is security-related.
8+
9+
When filing a bug, remember that the more specific the bug is, the more likely it is to be fixed. If you think you've found a security vulnerability, then do not raise a GitHub issue. Instead, follow the instructions in our [security policy](./SECURITY.md).
1010

1111
## Contributing code
1212

13-
We welcome your code contributions. Before submitting code by using a pull request,
13+
Oracle welcomes your code contributions. Before submitting code by using a pull request,
1414
you must sign the [Oracle Contributor Agreement][OCA] (OCA), and your commits must include the following line, using the name and e-mail address you used to sign the OCA:
1515

1616
```text
@@ -29,22 +29,22 @@ can be accepted.
2929

3030
## Pull request process
3131

32-
1. Ensure there is an issue created to track and discuss the fix or enhancement that you intend to submit.
32+
1. Ensure that there is an issue created to track and discuss the fix or enhancement that you intend to submit.
3333
1. Fork this repository.
3434
1. Create a branch in your fork to implement the changes. Oracle recommends using
3535
the issue number as part of your branch name. For example: `1234-fixes`
3636
1. Ensure that any documentation is updated with the changes that are required
3737
by your change.
38-
1. Ensure that any samples are updated, if the base image has been changed.
38+
1. If the base image has been changed, then ensure that any examples are updated.
3939
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
4040
what your changes are meant to do, and provide simple steps to indicate how to validate
4141
your changes. Ensure that you reference the issue that you created as well.
42-
1. Before the changes are merged, Oracle will assign the pull request to 2 or 3 people for review.
42+
1. Before the changes are merged, Oracle will assign the pull request to two or three people for review.
4343

4444
## Code of conduct
4545

4646
Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd
47-
like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC].
47+
like more specific guidelines, then see the [Contributor Covenant Code of Conduct][COC].
4848

4949
[OCA]: https://oca.opensource.oracle.com
5050
[COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Copyright (c) 2021, Oracle and/or its affiliates.
1+
# Copyright (c) 2022, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
#
44

55
# Build the manager binary
6-
FROM golang:1.16 as builder
6+
FROM golang:1.17 as builder
77

88
WORKDIR /workspace
99
# Copy the Go Modules manifests

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021 Oracle and/or its affiliates.
1+
Copyright (c) 2022 Oracle and/or its affiliates.
22

33
The Universal Permissive License (UPL), Version 1.0
44

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2022, 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
#
55

@@ -23,6 +23,8 @@ IMG ?= controller:latest
2323
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
2424
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
2525
ENVTEST_K8S_VERSION = 1.21
26+
# Operator YAML file
27+
OPERATOR_YAML=$$(basename $$(pwd)).yaml
2628

2729
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
2830
ifeq (,$(shell go env GOBIN))
@@ -53,13 +55,13 @@ fmt: ## Run go fmt against code.
5355
vet: ## Run go vet against code.
5456
go vet ./...
5557

56-
TEST ?= ./apis/... ./commons/... ./controllers/...
58+
TEST ?= ./apis/database/v1alpha1 ./commons/... ./controllers/...
5759
test: manifests generate fmt vet envtest ## Run unit tests.
5860
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $(TEST) -coverprofile cover.out
5961

6062
E2ETEST ?= ./test/e2e/
6163
e2e: manifests generate fmt vet envtest ## Run e2e tests.
62-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $(E2ETEST) -v -timeout 40m -ginkgo.v -ginkgo.failFast
64+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" ginkgo -v --timeout=2h30m --fail-fast $(E2ETEST)
6365

6466
##@ Build
6567

@@ -69,7 +71,7 @@ build: generate fmt vet ## Build manager binary.
6971
run: manifests generate fmt vet ## Run a controller from your host.
7072
go run ./main.go
7173

72-
docker-build: test ## Build docker image with the manager.
74+
docker-build: manifests generate fmt vet #test ## Build docker image with the manager. Disable the test but keep the validations to fail fast
7375
docker build --no-cache=true --build-arg http_proxy=${HTTP_PROXY} --build-arg https_proxy=${HTTPS_PROXY} . -t ${IMG}
7476

7577
#docker-build-proxy: test
@@ -90,9 +92,14 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
9092
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
9193
$(KUSTOMIZE) build config/default | kubectl apply -f -
9294

95+
# Bug:34265574
96+
# Used sed to reposition the controller-manager Deployment after the certificate creation in the OPERATOR_YAML
9397
operator-yaml: manifests kustomize
9498
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
95-
$(KUSTOMIZE) build config/default > $$(basename $$(pwd)).yaml
99+
$(KUSTOMIZE) build config/default > "${OPERATOR_YAML}"
100+
sed -i.bak -e '/^apiVersion: apps\/v1/,/---/d' "${OPERATOR_YAML}"
101+
(echo --- && sed '/^apiVersion: apps\/v1/,/---/!d' "${OPERATOR_YAML}.bak") >> "${OPERATOR_YAML}"
102+
rm "${OPERATOR_YAML}.bak"
96103

97104
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
98105
$(KUSTOMIZE) build config/default | kubectl delete -f -

PREREQUISITES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
## Prerequisites for Using Oracle Database Operator for Kubernetes
44

5-
Oracle Database operator for Kubernetes (OraOperator) manages all Cloud deployments of Oracle Database, including:
5+
Oracle Database Operator for Kubernetes (OraOperator) manages all Cloud deployments of Oracle Database, including:
66

77
* Oracle Autonomous Database (ADB)
88
* Containerized Oracle Database Single Instance (SIDB)
99
* Containerized Sharded Oracle Database (SHARDING)
1010

1111
### Setting Up a Kubernetes Cluster and Volumes
12+
Review and complete each step as needed.
1213

1314
#### Setting Up an OKE Cluster on Oracle Cloud Infrastructure (OCI)
1415

@@ -26,7 +27,7 @@ If you intent to use `OraOperator` to handle Oracle Autonomous Database lifecycl
2627

2728
### Prerequites for Single Instance Databases (SIDB)
2829

29-
If you intent to use `OraOperator` to handle Oracle Database Single Instance lifecycles, then read [Single Instance Database Prerequisites](./docs/sidb/SIDB_PREREQUISITES.md)
30+
If you intent to use `OraOperator` to handle Oracle Database Single Instance lifecycles, then read [Single Instance Database Prerequisites](./docs/sidb/PREREQUISITES.md)
3031

3132
### Prerequites for Sharded Databases (SHARDING)
3233

PROJECT

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ layout:
33
- go.kubebuilder.io/v2
44
multigroup: true
55
plugins:
6-
go.sdk.operatorframework.io/v2-alpha: {}
6+
manifests.sdk.operatorframework.io/v2: {}
7+
scorecard.sdk.operatorframework.io/v2: {}
78
projectName: oracle-database-operator
89
repo: github.com/oracle/oracle-database-operator
910
resources:
@@ -16,6 +17,34 @@ resources:
1617
kind: AutonomousDatabase
1718
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
1819
version: v1alpha1
20+
webhooks:
21+
validation: true
22+
webhookVersion: v1
23+
- api:
24+
crdVersion: v1
25+
namespaced: true
26+
controller: true
27+
domain: oracle.com
28+
group: database
29+
kind: AutonomousDatabaseBackup
30+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
31+
version: v1alpha1
32+
webhooks:
33+
defaulting: true
34+
validation: true
35+
webhookVersion: v1beta1
36+
- api:
37+
crdVersion: v1beta1
38+
namespaced: true
39+
controller: true
40+
domain: oracle.com
41+
group: database
42+
kind: AutonomousDatabaseRestore
43+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
44+
version: v1alpha1
45+
webhooks:
46+
validation: true
47+
webhookVersion: v1beta1
1948
- api:
2049
crdVersion: v1
2150
namespaced: true
@@ -38,4 +67,60 @@ resources:
3867
kind: ShardingDatabase
3968
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
4069
version: v1alpha1
70+
- api:
71+
crdVersion: v1
72+
namespaced: true
73+
controller: true
74+
domain: oracle.com
75+
group: database
76+
kind: PDB
77+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
78+
version: v1alpha1
79+
webhooks:
80+
defaulting: true
81+
validation: true
82+
webhookVersion: v1
83+
- api:
84+
crdVersion: v1
85+
namespaced: true
86+
controller: true
87+
domain: oracle.com
88+
group: database
89+
kind: CDB
90+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
91+
version: v1alpha1
92+
webhooks:
93+
defaulting: true
94+
validation: true
95+
webhookVersion: v1
96+
- api:
97+
crdVersion: v1beta1
98+
namespaced: true
99+
controller: true
100+
domain: oracle.com
101+
group: database
102+
kind: OracleRestDataService
103+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
104+
version: v1alpha1
105+
- api:
106+
crdVersion: v1beta1
107+
namespaced: true
108+
controller: true
109+
domain: oracle.com
110+
group: database
111+
kind: AutonomousContainerDatabase
112+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
113+
version: v1alpha1
114+
webhooks:
115+
validation: true
116+
webhookVersion: v1
117+
- api:
118+
crdVersion: v1beta1
119+
namespaced: true
120+
controller: true
121+
domain: oracle.com
122+
group: database
123+
kind: DbcsSystem
124+
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
125+
version: v1alpha1
41126
version: "3"

0 commit comments

Comments
 (0)