Skip to content

New stuff #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 212 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
fe06d36
Merge branch 'fix_operator_yaml' into 'master'
yunus-qureshi Jul 13, 2023
b09ccfe
Fix webhook reject scaling after stop and restart adb
ting-lan-wang Aug 15, 2023
464bf7e
Merge branch 'fix-adb-webhook-lifecyclestate' into 'master'
ting-lan-wang Aug 15, 2023
7f8634f
Update the command of installing cert-manager
ting-lan-wang Aug 23, 2023
f63c1a6
Update cert-manager command installation command in README.md
ting-lan-wang Aug 28, 2023
28dc9f9
Merge branch 'ting-lan_wang-master-patch-27095' into 'master'
ting-lan-wang Aug 28, 2023
53d92cf
Enhance CI/CD pipeline to use commit ID
yunus-qureshi Sep 8, 2023
6cc50e1
Merge branch 'enhancement/cicd-pipeline' into 'master'
yunus-qureshi Sep 8, 2023
1cc8737
Bugfix issue 67
IshaanDesai45 Sep 12, 2023
bc35cfc
Merge branch 'bugfix-issue_67' into 'master'
yunus-qureshi Sep 12, 2023
94e1d84
Fix adb controller reconcile error
ting-lan-wang Sep 22, 2023
4da1609
Merge branch 'fix-adb-reconciler-error' into 'master'
ting-lan-wang Sep 22, 2023
121e0ed
Fix adb reconcile
ting-lan-wang Sep 28, 2023
c2c9e16
Merge branch 'fix-adb-reconcile' into 'master'
ting-lan-wang Sep 28, 2023
2d1126d
Tcps user certs
vatsrahul Oct 13, 2023
08077ad
Merge branch 'tcps_user_certs' into 'master'
yunus-qureshi Oct 13, 2023
1d6361e
Enhance status updation of sidb controller
IshaanDesai45 Nov 7, 2023
124410a
Merge branch 'idesai_enhance_status_updation' into 'master'
yunus-qureshi Nov 7, 2023
75e6c7f
Modifying singleinstancedatabase types attributes, for bug 35430671 r…
IshaanDesai45 Nov 10, 2023
00f72c7
Merge branch 'idesai_hotfix_35430671' into 'master'
yunus-qureshi Nov 10, 2023
33057d6
Bug 35895394
Nov 16, 2023
76e5916
Update libs and Dockerfile
ting-lan-wang Dec 1, 2023
bb921e9
Merge branch 'update-libs' into 'master'
ting-lan-wang Dec 1, 2023
f9a4ef7
Update docs/adb/ADB_PREREQUISITES.md, docs/adb/README.md, docs/adb/AC…
ting-lan-wang Dec 1, 2023
eead5e1
Use oraclelinux 8 image instead of slim
yunus-qureshi Dec 8, 2023
0a5fb18
Merge branch 'enhancement/mqureshi/use-oraclelinux-8' into 'master'
yunus-qureshi Dec 8, 2023
3d4a9ad
bug 36099948
mmalvezz Dec 12, 2023
4e7748f
Merge branch 'mmalvezz' into 'master'
mmalvezz Dec 12, 2023
6aa57b8
Merge branch 'mmalvezz' into 'master'
mmalvezz Dec 12, 2023
a56e15b
Use '[' instead of '[[' to be able to run in Shell
ting-lan-wang Dec 12, 2023
32e354b
Merge branch 'ting-lan_wang-master-patch-90604' into 'master'
ting-lan-wang Dec 12, 2023
cd3f097
issue66: add documentation page
mmalvezz Dec 15, 2023
201e464
Merge branch 'issue66' into 'master'
mmalvezz Dec 15, 2023
08fcecb
Support Wallet expiring date and Conditions
ting-lan-wang Dec 15, 2023
522739b
Merge branch 'adb-support-conditions' into 'master'
ting-lan-wang Dec 15, 2023
7194e30
Feature/idesai/storage expansion
IshaanDesai45 Jan 25, 2024
e20c94a
Merge branch 'feature/idesai/storage_expansion' into 'master'
yunus-qureshi Jan 25, 2024
679b60e
Custom scripts
vatsrahul Feb 6, 2024
89b11ef
Merge branch 'customScripts' into 'master'
yunus-qureshi Feb 6, 2024
8fd6342
Feature/naberin/v1.1.0 release of DatabaseObserver v1.0.final
aberinnj Feb 13, 2024
b02ce95
Merge branch 'databaseobserver-v1.0.final' into 'master'
psaini79 Feb 13, 2024
d2490ac
Fix/idesai/rbac changes
IshaanDesai45 Feb 13, 2024
e2ccbb2
Merge branch 'fix/idesai/rbac_changes' into 'master'
yunus-qureshi Feb 13, 2024
877bcf5
Enhancement/idesai/root permissions fix
IshaanDesai45 Feb 14, 2024
b8563d1
Merge branch 'enhancement/idesai/root_permissions_fix' into 'master'
yunus-qureshi Feb 14, 2024
c7ee2dd
Multinamespaced support for operator deployment
IshaanDesai45 Feb 20, 2024
af4da38
Merge branch 'idesai_sidb_multinamespaced' into 'master'
psaini79 Feb 20, 2024
cd74587
Enhancement namespace webhook logic + updating ords images + updating…
IshaanDesai45 Feb 23, 2024
937eceb
Merge branch 'enhancement/idesai/webhook_logic' into 'master'
yunus-qureshi Feb 23, 2024
feb24c5
Added support for user defined sharding
Feb 23, 2024
d69eefd
Added fix
Feb 23, 2024
5d57f5e
Added fix
Feb 23, 2024
642c544
Changing ResourceRequirements to VolumeResourceRequirement
Feb 23, 2024
08a8f93
Replace ClusterRoleBinding to RoleBinding
Feb 23, 2024
993994a
Added fix
psaini79 Feb 24, 2024
5f3f7be
GO version 1.21.7
yunus-qureshi Feb 27, 2024
106384c
Merge branch 'enhancement/mqureshi/fix-go-compile' into 'master'
yunus-qureshi Feb 27, 2024
02b1984
Added fixes to handle cluster namescope
psaini79 Feb 27, 2024
f666a18
Added fixes for proxy role
psaini79 Feb 27, 2024
121dd2c
Generated new operator file
psaini79 Feb 27, 2024
aad4f43
Added fix for GSM2 region
psaini79 Feb 27, 2024
a292c16
Node watch and list priv for operator manager
IshaanDesai45 Feb 28, 2024
474afed
Merge branch 'idesai_node_priv' into 'master'
yunus-qureshi Feb 28, 2024
3f2f3cd
Documentation Bugs in OraOperator
vatsrahul Feb 28, 2024
85fc147
Merge branch 'rvats_bugfixes' into 'master'
yunus-qureshi Feb 28, 2024
49052bb
fixing dg_webhook
IshaanDesai45 Feb 29, 2024
f535f48
Merge branch 'idesai_dg_fix' into 'master'
yunus-qureshi Feb 29, 2024
301350d
Pdb cdb multinamespace
mmalvezz Mar 4, 2024
9101a7d
Merge branch 'pdb_cdb_multinamespace' into 'master'
mmalvezz Mar 4, 2024
691e78b
rm database.oracle.com_CDBS.yam and database.oracle.com_PDBS.yaml
Mar 6, 2024
570cc10
Merge branch 'mmalvezz' into 'master'
mmalvezz Mar 6, 2024
c6b1733
Idesai bugfix release v1.1
IshaanDesai45 Mar 7, 2024
8fe4920
Merge branch 'idesai_bugfix_release_v1.1' into 'master'
yunus-qureshi Mar 7, 2024
34634ac
Jyoti sharding docs changes
jpverma85 Mar 8, 2024
a32aa1d
Merge branch 'jyoti-sharding-docs-changes' into 'master'
psaini79 Mar 8, 2024
6557e41
add support for namspace scoped
ting-lan-wang Mar 11, 2024
9da58d7
Merge branch 'tinglwan-adb-multinamespace' into 'master'
ting-lan-wang Mar 11, 2024
0ded045
Rvats bugfixes
vatsrahul Mar 12, 2024
4e5f4b1
Merge branch 'rvats_bugfixes' into 'master'
yunus-qureshi Mar 12, 2024
9b4e95d
Minor syntax fixes and renamed Metric Exporter.
Kuassim Mar 13, 2024
2366b96
Fixing prebuilt sidb flow
IshaanDesai45 Mar 13, 2024
15dec08
Merge branch 'idesai_bugfix_36398929' into 'master'
yunus-qureshi Mar 13, 2024
127f2b4
pkeyutl secret change
jpverma85 Mar 14, 2024
f889287
Merge branch 'pkeyutl_secret' into 'master'
psaini79 Mar 14, 2024
7c0e4e4
Bugs and Doc Fixes for operator release v1.1.0
IshaanDesai45 Mar 14, 2024
090f0b8
Merge branch 'idesai_bug_doc_fix' into 'master'
yunus-qureshi Mar 14, 2024
131c4ba
Fixed BUG-36350588: error handling on CR fetch
aberinnj Mar 14, 2024
aa66dc0
Updated rbac for observability
aberinnj Mar 14, 2024
0cefe34
Rvats bugfixes
vatsrahul Mar 15, 2024
4854f75
Merge branch 'rvats_bugfixes' into 'master'
yunus-qureshi Mar 15, 2024
088c42b
Bug 36407635 - NULL POINTER IN SETDBCSSTATUS CAUSES OPERATOR TO CRASH
Mar 15, 2024
2cc32bd
Merge branch 'bug36407635' into 'master'
mmalvezz Mar 15, 2024
a25e5c6
dbcsdoc usecase01
Mar 15, 2024
564f1c9
Merge branch 'dbcsdoc' into 'master'
mmalvezz Mar 15, 2024
b075393
Tinglwan adb multinamespace
ting-lan-wang Mar 15, 2024
b73fcab
Merge branch 'tinglwan-adb-multinamespace' into 'master'
ting-lan-wang Mar 15, 2024
b61f540
Dg tcps validation
vatsrahul Mar 19, 2024
ab8cb3d
Merge branch 'dg-tcps-validation' into 'master'
yunus-qureshi Mar 19, 2024
4f17dcd
standby tcps validation
vatsrahul Mar 20, 2024
1f225ec
Merge branch 'dg-tcps-validation' into 'master'
yunus-qureshi Mar 20, 2024
375a587
Documentation Changes for v1.1.0 release
IshaanDesai45 Mar 20, 2024
d84aa16
Merge branch 'idesai_hotfix_36413221' into 'master'
yunus-qureshi Mar 20, 2024
1a7ef86
Update README.md
yunus-qureshi Mar 20, 2024
14edae3
Fix PV RBAC
yunus-qureshi Mar 21, 2024
52a0651
Merge branch 'enhancement/mqureshi/pv-watch' into 'master'
yunus-qureshi Mar 21, 2024
e5274d3
Same yaml fixes
yunus-qureshi Mar 21, 2024
23f18cf
Fix comments
yunus-qureshi Mar 21, 2024
704aa48
Merge branch 'bugfix/mqureshi/sample-yamls'
yunus-qureshi Mar 21, 2024
7639531
Update README.md
yunus-qureshi Mar 21, 2024
8391a57
Psaini sharding branch1
jpverma85 Mar 21, 2024
b1ef615
Merge branch 'psaini_sharding_branch1' into 'master'
psaini79 Mar 21, 2024
3ded387
Revert "Merge branch 'psaini_sharding_branch1' into 'master'"
psaini79 Mar 21, 2024
4fb8bdf
Enhancing event logs and sidb resource status updation
IshaanDesai45 Mar 22, 2024
7cda4e6
Merge branch 'idesai_enhance_spec_validation_event_primary_db' into '…
yunus-qureshi Mar 22, 2024
3fdc231
Including access and privileges that sidb controller requires in the …
IshaanDesai45 Mar 25, 2024
66f99cb
Merge branch 'idesai_doc_enh_role_priv' into 'master'
yunus-qureshi Mar 25, 2024
d3b1aab
Autonomous Database Controller doc changes
ting-lan-wang Mar 25, 2024
91af7fc
Merge branch 'tinglwan-doc-change' into 'master'
ting-lan-wang Mar 25, 2024
a1101f7
Updated README with security section
aberinnj Mar 25, 2024
b733129
Merge branch 'fix/databaseobserver-rbac-docs-fine-tune' into 'master'
ting-lan-wang Mar 25, 2024
9284c7d
Merge branch 'cleanup/databaseobserver-rbac-cleanup' into 'master'
yunus-qureshi Mar 26, 2024
293c4ee
Merge branch 'fix/databaseobserver-BUG-36350588' into 'master'
yunus-qureshi Mar 26, 2024
76be372
ReadMe fixes
yunus-qureshi Mar 26, 2024
0973179
Merge branch 'bugfix/mqureshi/36413631' into 'master'
yunus-qureshi Mar 26, 2024
0262633
update README file security details
s1saurabh Mar 26, 2024
7c3d07f
Merge branch 'permissions' into 'master'
psaini79 Mar 27, 2024
8ec216b
ReadMe update
yunus-qureshi Mar 28, 2024
713696b
Merge branch 'bugfix/mqureshi/36411472' into 'master'
yunus-qureshi Mar 28, 2024
9ad0784
Update PREREQUISITES.md
yunus-qureshi Mar 28, 2024
53e5b04
patch instructions
yunus-qureshi Mar 29, 2024
664abd3
Merge branch 'bugfix/mqureshi/patching-instructions' into 'master'
yunus-qureshi Mar 29, 2024
a6d3938
Patching Enhancements
IshaanDesai45 Mar 29, 2024
2291391
Merge branch 'idesai_dg_dat_file_loc_change' into 'master'
yunus-qureshi Mar 29, 2024
8a0de28
Tinglwan doc change
ting-lan-wang Mar 29, 2024
7acedc9
Merge branch 'tinglwan-doc-change' into 'master'
ting-lan-wang Mar 29, 2024
ca260cc
ReadMe update for uninstall
yunus-qureshi Apr 2, 2024
705a31b
Merge branch 'bugfix/mqureshi/36462833' into 'master'
yunus-qureshi Apr 2, 2024
c84fa7a
Bugfix/mqureshi/36454509
yunus-qureshi Apr 2, 2024
d5611d4
Merge branch 'bugfix/mqureshi/36454509' into 'master'
yunus-qureshi Apr 2, 2024
9b80b78
Dataguard Controller enhancements and bugfixes
IshaanDesai45 Apr 2, 2024
3e07911
Merge branch 'idesai_dg_bugfix' into 'master'
yunus-qureshi Apr 2, 2024
d85e312
Bugfixes/mqureshi/1.1.0
yunus-qureshi Apr 3, 2024
7305d50
Merge branch 'bugfixes/mqureshi/1.1.0' into 'master'
yunus-qureshi Apr 3, 2024
8b7c6fe
bugfix/idesai/36473360
IshaanDesai45 Apr 3, 2024
f59a9c1
Merge branch 'idesai_dg_bugfix_3' into 'master'
yunus-qureshi Apr 3, 2024
1d10080
Fix shutdown condition
yunus-qureshi Apr 4, 2024
a4b5dcf
Add comments
yunus-qureshi Apr 4, 2024
d486095
Fix standby validation
yunus-qureshi Apr 4, 2024
413eeb2
Merge branch 'bugfix/mqureshi/role' into 'master'
yunus-qureshi Apr 4, 2024
ca2aedd
Update README.md
yunus-qureshi Apr 5, 2024
c2fc6eb
Failover matrix
yunus-qureshi Apr 5, 2024
1ec674e
Merge branch 'bugfix/mqureshi/readme-32982850' into 'master'
yunus-qureshi Apr 5, 2024
92486d6
Added databaseobserver webhook
aberinnj Apr 8, 2024
4f25c62
Merge branch 'feature/databaseobserver-webhook' into 'master'
yunus-qureshi Apr 8, 2024
0d0a800
Update README.md Minor style updates
dwilliams-orcl Apr 15, 2024
4f1f29f
Merge branch 'douglas_williams-master-patch-74801' into 'master'
psaini79 Apr 16, 2024
e68e966
bug fix 36545873
Apr 24, 2024
4dff830
Merge branch 'bug_36545873' into 'master'
mmalvezz Apr 24, 2024
b23f486
Tinglwan merge workload pr
ting-lan-wang May 1, 2024
ee951f5
Merge branch 'tinglwan-merge-workload-pr' into 'master'
ting-lan-wang May 1, 2024
8461f68
Update README.md
ting-lan-wang May 1, 2024
6b8438e
patch/databaseobserver Docs
aberinnj May 1, 2024
e24228b
Merge branch 'patch/databaseobserver-docs' into 'master'
Kuassim May 1, 2024
fff2a74
Update THIRD_PARTY_LICENSES.txt
Kuassim May 2, 2024
10afd19
Updated Readme with Free 23ai and OKE workload Identify
Kuassim May 2, 2024
ced238e
changing 23c references to 23.3.0
IshaanDesai45 May 2, 2024
deb1740
Merge branch 'idesai_readme_version_fix' into 'master'
yunus-qureshi May 2, 2024
959da6a
Idesai readme version fix
yunus-qureshi May 2, 2024
d4d8f70
Merge branch 'idesai_readme_version_fix' into 'master'
yunus-qureshi May 2, 2024
71ac3d7
Update Readme.md
Kuassim May 2, 2024
6f287d8
Tinglwan bug 36349519
ting-lan-wang May 2, 2024
5972fec
Merge branch 'tinglwan_bug_36349519' into 'master'
ting-lan-wang May 2, 2024
e57cfb9
Update README.md
ting-lan-wang May 6, 2024
4815636
Added fix for bug
aberinnj May 7, 2024
732fb0e
use 23.4.0-8
May 16, 2024
7f60048
Merge branch 'useords23.1' into 'master'
mmalvezz May 16, 2024
370e888
Merge branch 'fix/databaseobserver/serivceport-bug' into 'master'
psaini79 May 16, 2024
769809f
update README.md
ting-lan-wang May 29, 2024
e9e7667
Documentation Changes to include openshift pre req
IshaanDesai45 Jul 4, 2024
eef5d69
Merge branch 'idesai_openshift_doc_changes' into 'master'
yunus-qureshi Jul 4, 2024
e953473
Documentation enhancements
IshaanDesai45 Jul 8, 2024
afc3674
Merge branch 'idesai_doc_enh' into 'master'
yunus-qureshi Jul 8, 2024
4d353df
Saurabh basedb
s1saurabh Jul 15, 2024
ec1b0fa
Merge branch 'saurabh_basedb' into 'master'
psaini79 Jul 15, 2024
aa36b61
Sidb resource management and node scheduling
IshaanDesai45 Jul 18, 2024
102b202
Merge branch 'idesai_resource_management' into 'master'
yunus-qureshi Jul 18, 2024
cac2a9a
Psaini sharding branch1
psaini79 Jul 29, 2024
a331d49
Merge branch 'psaini_sharding_branch1' into 'master'
psaini79 Jul 29, 2024
c1b7773
psaini_dbcs_branch1
psaini79 Jul 30, 2024
802d273
Merge branch 'revert-ec1b0fa4' into 'master'
psaini79 Jul 30, 2024
e9ea2bd
Update README.md
s1saurabh Jul 31, 2024
c65709c
Merge branch 'review_github_main_merge' into 'master'
psaini79 Jul 31, 2024
a0986d1
Added fixes
psaini79 Jul 31, 2024
7221671
Added fixes
psaini79 Jul 31, 2024
d94909c
fix bug36752628
Aug 13, 2024
6d79df4
Merge branch 'bug36752628' into 'master'
mmalvezz Aug 13, 2024
183a321
assertive approach on pdb deletion
Aug 19, 2024
87851c2
Merge branch 'assertive_delpdb' into 'master'
mmalvezz Aug 19, 2024
56b3bd6
Review sharding changes
psaini79 Aug 20, 2024
869a2a2
Merge branch 'Review-Sharding-Changes' into 'master'
psaini79 Aug 20, 2024
d4045a1
fix documentation broken links
mmalvezz Aug 20, 2024
12f053d
Merge branch 'fixdocissue' into 'master'
mmalvezz Aug 20, 2024
23ebf0b
Changes in config to create bundle for operatorhub
psilberk Aug 27, 2024
fef1e95
Merge branch 'operatorhub' into 'master'
psilberk Aug 27, 2024
d411bb1
Set default as FALSE for InvitedNodeSubnetFlag
tthathac Aug 28, 2024
d945d3d
Merge branch 'Review-bug36080527-fix' into 'master'
psaini79 Aug 28, 2024
3cd4429
Review bug36738203 fix
tthathac Aug 28, 2024
6b20f7e
Merge branch 'Review-bug36738203-fix' into 'master'
psaini79 Aug 28, 2024
df25575
Fix image repository
ting-lan-wang Aug 28, 2024
b8422c2
Update README.md (#99)
s1saurabh Sep 2, 2024
179b67a
Merge branch 'new_stuff2' into 'master'
psaini79 Sep 2, 2024
dd423ea
Merge remote-tracking branch 'gitlab-origin/master' into new_stuff
s1saurabh Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: oracle.com
layout:
- go.kubebuilder.io/v2
Expand Down Expand Up @@ -67,6 +71,10 @@ resources:
kind: ShardingDatabase
path: github.com/oracle/oracle-database-operator/apis/database/v1alpha1
version: v1alpha1
webhooks:
defaulting: true
validation: true
webhookVersion: v1beta1
- api:
crdVersion: v1
namespaced: true
Expand Down
155 changes: 155 additions & 0 deletions apis/database/v1alpha1/shardingdatabase_webhook.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
** Copyright (c) 2022 Oracle and/or its affiliates.
**
** The Universal Permissive License (UPL), Version 1.0
**
** Subject to the condition set forth below, permission is hereby granted to any
** person obtaining a copy of this software, associated documentation and/or data
** (collectively the "Software"), free of charge and under any and all copyright
** rights in the Software, and any and all patent rights owned or freely
** licensable by each licensor hereunder covering either (i) the unmodified
** Software as contributed to or provided by such licensor, or (ii) the Larger
** Works (as defined below), to deal in both
**
** (a) the Software, and
** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
** one is included with the Software (each a "Larger Work" to which the Software
** is contributed by such licensors),
**
** without restriction, including without limitation the rights to copy, create
** derivative works of, display, perform, and distribute the Software and make,
** use, sell, offer for sale, import, export, have made, and have sold the
** Software and the Larger Work(s), and to sublicense the foregoing rights on
** either these or other terms.
**
** This license is subject to the following condition:
** The above copyright notice and either this complete permission notice or at
** a minimum a reference to the UPL must be included in all copies or
** substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
*/

package v1alpha1

import (
"strings"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// log is for logging in this package.
var shardingdatabaselog = logf.Log.WithName("shardingdatabase-resource")

func (r *ShardingDatabase) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

//+kubebuilder:webhook:path=/mutate-database-oracle-com-v1alpha1-shardingdatabase,mutating=true,failurePolicy=fail,groups=database.oracle.com,resources=shardingdatabases,verbs=create;update,versions=v1alpha1,name=mshardingdatabase.kb.io

var _ webhook.Defaulter = &ShardingDatabase{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
func (r *ShardingDatabase) Default() {
shardingdatabaselog.Info("default", "name", r.Name)

// TODO(user): fill in your defaulting logic.
if r.Spec.GsmDevMode != "" {
r.Spec.GsmDevMode = "dev"
}
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:verbs=create;update,path=/validate-database-oracle-com-v1alpha1-shardingdatabase,mutating=false,failurePolicy=fail,groups=database.oracle.com,resources=shardingdatabases,versions=v1alpha1,name=vshardingdatabase.kb.io,admissionReviewVersions={v1,v1beta1}

var _ webhook.Validator = &ShardingDatabase{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *ShardingDatabase) ValidateCreate() (admission.Warnings, error) {
shardingdatabaselog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
// Check Secret configuration
var validationErr field.ErrorList

//namespaces := db.GetWatchNamespaces()
//_, containsNamespace := namespaces[r.Namespace]
// Check if the allowed namespaces maps contains the required namespace
// if len(namespaces) != 0 && !containsNamespace {
// validationErr = append(validationErr,
// field.Invalid(field.NewPath("metadata").Child("namespace"), r.Namespace,
// "Oracle database operator doesn't watch over this namespace"))
//}

if r.Spec.DbSecret == nil {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret"), r.Spec.DbSecret,
"DbSecret cannot be set to nil"))
} else {
if len(r.Spec.DbSecret.Name) == 0 {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret").Child("Name"), r.Spec.DbSecret.Name,
"Secret name cannot be set empty"))
}
if len(r.Spec.DbSecret.PwdFileName) == 0 {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret").Child("PwdFileName"), r.Spec.DbSecret.PwdFileName,
"Password file name cannot be set empty"))
}
if strings.ToLower(r.Spec.DbSecret.EncryptionType) != "base64" {
if strings.ToLower(r.Spec.DbSecret.KeyFileName) == "" {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret").Child("KeyFileName"), r.Spec.DbSecret.KeyFileName,
"Key file name cannot be empty"))
}
}
if len(r.Spec.DbSecret.PwdFileMountLocation) == 0 {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret").Child("PwdFileMountLocation"), r.Spec.DbSecret.PwdFileMountLocation,
"Password file mount location cannot be empty"))
}

if len(r.Spec.DbSecret.KeyFileMountLocation) == 0 {
validationErr = append(validationErr,
field.Invalid(field.NewPath("spec").Child("DbSecret").Child("KeyFileMountLocation"), r.Spec.DbSecret.KeyFileMountLocation,
"KeyFileMountLocation file mount location cannot be empty"))
}
}

return nil, apierrors.NewInvalid(
schema.GroupKind{Group: "database.oracle.com", Kind: "ShardingDatabase"},
r.Name, validationErr)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *ShardingDatabase) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
shardingdatabaselog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *ShardingDatabase) ValidateDelete() (admission.Warnings, error) {
shardingdatabaselog.Info("validate delete", "name", r.Name)

// TODO(user): fill in your validation logic upon object deletion.
return nil, nil
}
3 changes: 1 addition & 2 deletions commons/sharding/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ import (
"reflect"
"strconv"

databasev1alpha1 "github.com/oracle/oracle-database-operator/apis/database/v1alpha1"

"github.com/go-logr/logr"
databasev1alpha1 "github.com/oracle/oracle-database-operator/apis/database/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down
1 change: 1 addition & 0 deletions config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ resources:
- dbcs/database_v1alpha1_dbcssystem.yaml
- database_v1alpha1_dataguardbroker.yaml
- observability/databaseobserver.yaml
- database_v1alpha1_shardingdatabase.yaml
# +kubebuilder:scaffold:manifestskustomizesamples
26 changes: 0 additions & 26 deletions controllers/database/shardingdatabase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,32 +902,6 @@ func (r *ShardingDatabaseReconciler) validateSpex(instance *databasev1alpha1.Sha
}
}

// Check Secret configuration
if instance.Spec.DbSecret == nil {
return fmt.Errorf("Secret specification cannot be null, you need to set secret details")
} else {
if len(instance.Spec.DbSecret.Name) == 0 {
return fmt.Errorf("instance.Spec.DbSecret.Name cannot be empty")
}
if len(instance.Spec.DbSecret.PwdFileName) == 0 {
return fmt.Errorf("instance.Spec.DbSecret.PwdFileName cannot be empty")
}
if strings.ToLower(instance.Spec.DbSecret.EncryptionType) != "base64" {
if strings.ToLower(instance.Spec.DbSecret.KeyFileName) == "" {
return fmt.Errorf("instance.Spec.DbSecret.KeyFileName cannot be empty")
}
}
if len(instance.Spec.DbSecret.PwdFileMountLocation) == 0 {
msg := "instance.Spec.DbSecret.PwdFileMountLocation is not set. Setting it to default " + shardingv1.GetSecretMount()
shardingv1.LogMessages("INFO", msg, nil, instance, r.Log)
}

if len(instance.Spec.DbSecret.KeyFileMountLocation) == 0 {
msg := "instance.Spec.DbSecret.KeyFileMountLocation is not set. Setting it to default " + shardingv1.GetSecretMount()
shardingv1.LogMessages("INFO", msg, nil, instance, r.Log)
}
}

// Once the initial Spec is been validated then update the last Sucessful Spec
err = instance.UpdateLastSuccessfulSpec(r.Client)
if err != nil {
Expand Down
17 changes: 17 additions & 0 deletions docs/sharding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,23 @@ In this example, the deployment uses the YAML file based on `OCI OKE` cluster. T
[6. Scale Out - Add Shards to an existing Oracle Sharded Database provisioned earlier with User Defined Sharding](./provisioning/user-defined-sharding/udsharding_scale_out_add_shards.md)
[7. Scale In - Delete an existing Shard from a working Oracle Sharded Database provisioned earlier with User Defined Sharding](./provisioning/user-defined-sharding/udsharding_scale_in_delete_an_existing_shard.md)


## Provisioning Sharding Topology with System Sharding with SNR RAFT enabled in a Cloud-Based Kubernetes Cluster

Deploy Oracle Database Sharding Topology with `System Sharding with SNR RAFT enabled` on your Cloud based Kubernetes cluster.

**NOTE: SNR RAFT Feature is available only for Oracle 23c RDBMS and Oracle 23c GSM version.**

In this example, the deployment uses the YAML file based on `OCI OKE` cluster. There are multiple use case possible for deploying the Oracle Database Sharding Topology covered by below examples:

[1. Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled without Database Gold Image](./provisioning/snr_system_sharding/snr_ssharding_provisioning_without_db_gold_image.md)
[2. Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled with additional control on resources like Memory and CPU allocated to Pods](./provisioning/snr_system_sharding/snr_ssharding_provisioning_with_control_on_resources.md)
[3. Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled by cloning database from your own Database Gold Image in the same Availability Domain(AD)](./provisioning/snr_system_sharding/snr_ssharding_provisioning_by_cloning_db_gold_image_in_same_ad.md)
[4. Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled by cloning database from your own Database Gold Image across Availability Domains(ADs)](./provisioning/snr_system_sharding/snr_ssharding_provisioning_by_cloning_db_from_gold_image_across_ads.md)
[5. Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled and send Notification using OCI Notification Service](./provisioning/snr_system_sharding/snr_ssharding_provisioning_with_notification_using_oci_notification.md)
[6. Scale Out - Add Shards to an existing Oracle Sharded Database provisioned earlier with System Sharding with SNR RAFT enabled](./provisioning/snr_system_sharding/snr_ssharding_scale_out_add_shards.md)
[7. Scale In - Delete an existing Shard from a working Oracle Sharded Database provisioned earlier with System Sharding with SNR RAFT enabled](./provisioning/snr_system_sharding/snr_ssharding_scale_in_delete_an_existing_shard.md)

## Connecting to Shard Databases

After the Oracle Database Sharding Topology has been provisioned using the Sharding Controller in Oracle Database Kubernetes Operator, you can follow the steps in this document to connect to the Sharded Database or to the individual Shards: [Database Connectivity](./provisioning/database_connection.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Provisioning Oracle Sharded Database with System Sharding with SNR RAFT enabled by cloning database from your own Database Gold Image across Availability Domains(ADs)

**NOTE: SNR RAFT Feature is available only for Oracle 23c RDBMS and Oracle 23c GSM version.**

**IMPORTANT:** Make sure you have completed the steps for [Prerequsites for Running Oracle Sharding Database Controller](../../README.md#prerequsites-for-running-oracle-sharding-database-controller) before using Oracle Sharding Controller.

In this test case, you provision the Oracle Database sharding topology with System Sharding with SNR RAFT enabled while provisioning the Catalog and Shard Databases by cloning from an existing Oracle Database Gold Image created earlier.

This use case applies when you want to provision the database Pods on a Kubernetes Node in any availability domain (AD), which can also be different from the availability domain (AD) of the Block Volume that has the Oracle Database Gold Image provisioned earlier.

Choosing this option takes substantially less time during the Oracle Database Sharding Topology setup across ADs.

NOTE:

* Cloning from Block Volume Backup in OCI enables the new Persistent Volumes to be created in other ADs.
* To specify the AD where you want to provision the database Pod, use the tag `nodeSelector` and the POD will be provisioned in a node running in that AD.
* To specify GSM containers, you can also use the tag `nodeSelector` to specify the AD.
* Before you can provision with the Gold Image, you need the OCID of the Persistent Volume that has the Oracle Database Gold Image.

1. Check the OCID of the Persistent Volume provisioned for the Oracle Database Gold Image:
```sh
kubectl get pv -n shns
```
2. Create a Block Volume Backup for this Block Volume, and use the OCID of the Block Volume Backup in the next step. This example uses `snr_ssharding_shard_prov_clone_across_ads.yaml` to provision an Oracle Database sharding topology using Oracle Sharding controller with:

* Primary GSM Pods `gsm1` and standby GSM Pod `gsm2`
* Three sharding Pods: `shard1`, `shard2` and `shard3`
* One Catalog Pod: `catalog`
* Namespace: `shns`
* Database Cloning from the `BLOCK VOLUME FULL BACKUP` of the Persistent Volume which had the Gold Image.
* OCID of the Block Volume Backup: `ocid1.volumebackup.oc1.phx.abyhqljrxtv7tu5swqb3lzc7vpzwbwzdktd2y4k2vjjy2srmgu2w7bqdftjq`
* `SNR RAFT` enabled

NOTE: In this case, the Persistent Volume with DB Gold Image was provisioned in the Availability Domain `PHX-AD-1`. The Shards and Catalog will be provisioned across multiple Availability Domains by cloning the database.

In this example, we are using pre-built Oracle Database and Global Data Services container images available on [Oracle Container Registry](https://container-registry.oracle.com/)
* To pull the above images from Oracle Container Registry, create a Kubernetes secret named `ocr-reg-cred` using your credentials with type set to `kubernetes.io/dockerconfigjson` in the namespace `shns`.
* If you plan to use images built by you, you need to change `dbImage` and `gsmImage` tag with the images you have built in your enviornment in file `snr_ssharding_shard_prov_clone_across_ads.yaml`.
* The `dbImage` used during provisioning the Persistent Volume with Database Gold Image and the `dbImage` used for deploying the Shard or Catalog Database by cloning should be same.
* To understand the Pre-requisite of Database and Global Data Services docker images, refer [Oracle Database and Global Data Services Docker Images](../../README.md#3-oracle-database-and-global-data-services-docker-images)

Use the file: [snr_ssharding_shard_prov_clone_across_ads.yaml](./snr_ssharding_shard_prov_clone_across_ads.yaml) for this use case as below:

1. Deploy the `snr_ssharding_shard_prov_clone_across_ads.yaml` file:
```sh
kubectl apply -f snr_ssharding_shard_prov_clone_across_ads.yaml
```
2. Check the status of the deployment:
```sh
# Check the status of the Kubernetes Pods:
kubectl get all -n shns

# Check the logs of a particular pod. For example, to check status of pod "shard1-0":
kubectl logs -f pod/shard1-0 -n shns

Loading