Skip to content

Commit

Permalink
NDB v0.5.0 Operator Release (#129)
Browse files Browse the repository at this point in the history
Upgrade NDB helm chart to first NDB Operator GA version

---------

Co-authored-by: Manav <[email protected]>
  • Loading branch information
mazin-s and manavrajvanshi authored Nov 8, 2023
1 parent 9c9795c commit 1943f0b
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 124 deletions.
20 changes: 12 additions & 8 deletions charts/ndb-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: ndb-operator
description: A Helm chart for Nutanix Database Kubernetes Operator
type: application
version: 0.0.7
appVersion: v0.0.7
version: 0.5.0
appVersion: v0.5.0
maintainers:
- name: mazin-s
email: [email protected]
Expand All @@ -23,15 +23,19 @@ icon: https://www.nutanix.com/content/dam/nutanix/global/icons/products/svg/Nuta
annotations:
artifacthub.io/changes: |
- kind: added
description: "Added the K8s Webhooks support for the validation of database specs"
description: "Added Clone Functionality"
- kind: added
description: "Added Provisioning Operation Id to the DB Status"
description: "Automation Testing for Time machine"
- kind: added
description: "Integrated Kubernetes events with the operator"
description: "Automation Scaffolding for future db engine tests"
- kind: added
description: "Added description property for Database in the database specs"
description: "Added Operation tracking"
- kind: added
description: "Added end-to-end tests for automated testing of operator"
description: "Support for Engine Specific Inputs in DB Provisioning"
- kind: added
description: "NDB and DB Integration"
- kind: added
description: "Upgrade the versions for controller-runtime & kube-rbac-proxy and Operator-sdk"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/license: Apache-2.0
artifacthub.io/maintainers: |
Expand All @@ -51,4 +55,4 @@ annotations:
email: [email protected]
artifacthub.io/operator: "true"
artifacthub.io/operatorCapabilities: Basic Install
artifacthub.io/prerelease: "true"
artifacthub.io/prerelease: "false"
232 changes: 203 additions & 29 deletions charts/ndb-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
The NDB operator automates and simplifies database administration, provisioning, and life-cycle management of NDB on Kubernetes.

NDB operator supports these functionalities:
1. Provisioning and deprovisioning a single instance postgres database.
2. Creation of a service for the applications to consume the database within Kubernetes.
1. Provisioning and deprovisioning a single instance postgres, mssql, sql server, and mongodb database with or without time machine.
2. Cloning support for the above database engines
3. Creation of a service for the applications to consume the database within Kubernetes.
---

## Pre-requisites
Expand All @@ -19,9 +20,9 @@ helm repo add nutanix https://nutanix.github.io/helm/

helm install ndb-operator nutanix/ndb-operator -n ndb-operator --create-namespace
```
## Using the Operator
## Usage
### Create secrets to be used by the NDBServer and Database resources using the manifest:

1. Create the secrets that are to be used by the custom resource(s):
```yaml
apiVersion: v1
kind: Secret
Expand All @@ -46,42 +47,62 @@ stringData:
ssh_public_key: SSH-PUBLIC-KEY

```
2. To create instances of custom resources (provision databases), edit the CRD file with the NDB installation and database instance details and run:
```sh
kubectl apply -f CRD_FILE.yaml

Create the secrets:

```
kubectl apply -f <path/to/secrets-manifest.yaml>
```

### Create the NDBServer resource. The manifest for NDBServer is described as follows:

```yaml
apiVersion: ndb.nutanix.com/v1alpha1
kind: NDBServer
metadata:
labels:
app.kubernetes.io/name: ndbserver
app.kubernetes.io/instance: ndbserver
app.kubernetes.io/part-of: ndb-operator
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: ndb-operator
name: ndb
spec:
# Name of the secret that holds the credentials for NDB: username, password and ca_certificate created earlier
credentialSecret: ndb-secret-name
# NDB Server's API URL
server: https://[NDB IP]:8443/era/v0.9
# Set to true to skip SSL certificate validation, should be false if ca_certificate is provided in the credential secret.
skipCertificateVerification: true

```
3. To delete instances of custom resources (deprovision databases) run:
Create the NDBServer resource using:
```sh
kubectl delete -f CRD_FILE.yaml
kubectl apply -f <path/to/NDBServer-manifest.yaml>
```
The CRD is described as follows:

### Create a Database Resource. A database can either be provisioned or cloned on NDB based on the inputs specified in the database manifest.

#### Provisioning manifest
```yaml
apiVersion: ndb.nutanix.com/v1alpha1
kind: Database
metadata:
# This name that will be used within the kubernetes cluster
name: db
spec:
# NDB server specific details
ndb:
# Name of the NDBServer resource created earlier
ndbRef: ndb
isClone: false
# Database instance specific details (that is to be provisioned)
databaseInstance:
# Cluster id of the cluster where the Database has to be provisioned
# Can be fetched from the GET /clusters endpoint
clusterId: "Nutanix Cluster Id"
# Credentials secret name for NDB installation
# data: username, password,
# stringData: ca_certificate
credentialSecret: ndb-secret-name
# The NDB Server
server: https://[NDB IP]:8443/era/v0.9
# Set to true to skip SSL verification, default: false.
skipCertificateVerification: true
# Database instance specific details (that is to be provisioned)
databaseInstance:
# The database instance name on NDB
databaseInstanceName: "Database-Instance-Name"
# Description for the database instance. Optional.
# Default : "Database provisioned by ndb-operator: <database name>"
description: "Database provisioned by ndb-operator"
name: "Database-Instance-Name"
# The description of the database instance
description: Database Description
# Names of the databases on that instance
databaseNames:
- database_one
Expand All @@ -102,7 +123,7 @@ spec:
compute:
id: ""
name: ""
# A Software profile is a mandatory input for closed-source engines: MSSQL
# A Software profile is a mandatory input for closed-source engines: SQL Server & Oracle
software:
name: ""
id: ""
Expand All @@ -116,16 +137,169 @@ spec:
dbParamInstance:
name: ""
id: ""
timeMachine:
sla : "NAME OF THE SLA" # Name of the SLA to use for the Time Machine
timeMachine: # Optional block, if removed the SLA defaults to NONE
sla : "NAME OF THE SLA"
dailySnapshotTime: "12:34:56" # Time for daily snapshot in hh:mm:ss format
snapshotsPerDay: 4 # Number of snapshots per day
logCatchUpFrequency: 90 # Frequency (in minutes)
weeklySnapshotDay: "WEDNESDAY" # Day of the week for weekly snapshot
monthlySnapshotDay: 24 # Day of the month for monthly snapshot
quarterlySnapshotMonth: "Jan" # Start month of the quarterly snapshot
additionalArguments: # Optional block, can specify additional arguments that are unique to database engines.
listener_port: "8080"

```

#### Cloning manifest
```yaml
apiVersion: ndb.nutanix.com/v1alpha1
kind: Database
metadata:
# This name that will be used within the kubernetes cluster
name: db
spec:
# Name of the NDBServer resource created earlier
ndbRef: ndb
isClone: true
# Clone specific details (that is to be provisioned)
clone:
# Type of the database to be cloned
type: postgres
# The clone instance name on NDB
name: "Clone-Instance-Name"
# The description of the clone instance
description: Database Description
# Cluster id of the cluster where the Database has to be provisioned
# Can be fetched from the GET /clusters endpoint
clusterId: "Nutanix Cluster Id"
# You can specify any (or none) of these types of profiles: compute, software, network, dbParam
# If not specified, the corresponding Out-of-Box (OOB) profile will be used wherever applicable
# Name is case-sensitive. ID is the UUID of the profile. Profile should be in the "READY" state
# "id" & "name" are optional. If none provided, OOB may be resolved to any profile of that type
profiles:
compute:
id: ""
name: ""
# A Software profile is a mandatory input for closed-source engines: SQL Server & Oracle
software:
name: ""
id: ""
network:
id: ""
name: ""
dbParam:
name: ""
id: ""
# Only applicable for MSSQL databases
dbParamInstance:
name: ""
id: ""
# Name of the secret with the
# data: password, ssh_public_key
credentialSecret: clone-instance-secret-name
timezone: "UTC"
# ID of the database to clone from, can be fetched from NDB REST API Explorer
sourceDatabaseId: source-database-id
# ID of the snapshot to clone from, can be fetched from NDB REST API Explorer
snapshotId: snapshot-id
additionalArguments: # Optional block, can specify additional arguments that are unique to database engines.
expireInDays: 3

```

Create the Database resource:
```sh
kubectl apply -f <path/to/database-manifest.yaml>
```

### Additional Arguments for Databases
Below are the various optional addtionalArguments you can specify along with examples of their corresponding values. Arguments that have defaults will be indicated.

Provisioning Additional Arguments:
```yaml
# PostGres
additionalArguments:
listener_port: "1111" # Default: "5432"

# MySQL
additionalArguments:
listener_port: "1111" # Default: "3306"

# MongoDB
additionalArguments:
listener_port: "1111" # Default: "27017"
log_size: "150" # Default: "100"
journal_size: "150" # Default: "100"

# MSSQL
additionalArguments:
sql_user_name: "mazin" # Defualt: "sa".
authentication_mode: "mixed" # Default: "windows". Options are "windows" or "mixed". Must specify sql_user.
server_collation: "<server-collation>" # Default: "SQL_Latin1_General_CP1_CI_AS".
database_collation: "<server-collation>" # Default: "SQL_Latin1_General_CP1_CI_AS".
dbParameterProfileIdInstance: "<id-instance>" # Default: Fetched from profile.
vm_dbserver_admin_password: "<admin-password>" # Default: Fetched from database secret.
sql_user_password: "<sq-user-password>" # NO Default. Must specify authentication_mode as "mixed".
windows_domain_profile_id: <domain-profile-id> # NO Default. Must specify vm_db_server_user.
vm_db_server_user: <vm-db-server-use> # NO Default. Must specify windows_domain_profile_id.
vm_win_license_key: <licenseKey> # NO Default.
```
Cloning Additional Arguments:
```yaml
MSSQL:
windows_domain_profile_id
era_worker_service_user
sql_service_startup_account
vm_win_license_key
target_mountpoints_location
expireInDays
expiryDateTimezone
deleteDatabase
refreshInDays
refreshTime
refreshDateTimezone

MongoDB:
expireInDays
expiryDateTimezone
deleteDatabase
refreshInDays
refreshTime
refreshDateTimezone

Postgres:
expireInDays
expiryDateTimezone
deleteDatabase
refreshInDays
refreshTime
refreshDateTimezone

MySQL:
expireInDays
expiryDateTimezone
deleteDatabase
refreshInDays
refreshTime
refreshDateTimezone
```
### Deleting the Database resource
To deregister the database and delete the VM run:
```sh
kubectl delete -f <path/to/database-manifest.yaml>
```

### Deleting the NDBServer resource
To deregister the database and delete the VM run:
```sh
kubectl delete -f <path/to/NDBServer-manifest.yaml>
```

---

## Uninstalling the Chart
To uninstall/delete the operator deployment/chart:
```console
Expand Down
Loading

0 comments on commit 1943f0b

Please sign in to comment.