Skip to content

Commit

Permalink
Removed Mongo related code and files
Browse files Browse the repository at this point in the history
Removed all mongo related code:
* Making DBType to only accept postgres
* removed mongo external URL
* removed mongo related envs from deployments\statefulsets
* remove Mongo related CLI commands (e.g. dbdump)

Signed-off-by: Danny Zaken <[email protected]>
  • Loading branch information
dannyzaken committed Mar 31, 2024
1 parent 4ee28d6 commit b58a6f1
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 962 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ The following options can be passed to any command:
--aws-sts-arn='': The AWS STS Role ARN which will assume role
--cosi-driver-path='/var/lib/cosi/cosi.sock': unix socket path for COSI
--cosi-sidecar-image='gcr.io/k8s-staging-sig-storage/objectstorage-sidecar/objectstorage-sidecar:v20221117-v0.1.0-22-g0e67387': The cosi side car container image
--db-image='centos/mongodb-36-centos7': The database container image
--db-image='"quay.io/sclorg/postgresql-15-c9s"': The database container image
--db-storage-class='': The database volume storage class name
--db-type='postgres': The type of database container image (mongodb, postgres)
--db-volume-size-gb=0: The database volume size in GB
--debug-level='default_level': The type of debug sets that the system prints (all, nsfs, warn, default_level)
--dev=false: Set sufficient resources for dev env
Expand All @@ -154,7 +153,6 @@ The following options can be passed to any command:
--kubeconfig='': Paths to a kubeconfig. Only required if out-of-cluster.
--manual-default-backingstore=false: allow to delete the default backingstore
--mini=false: Signal the operator that it is running in a low resource environment
--mongodb-url='': url for mongodb
-n, --namespace='default': Target namespace
--noobaa-image='noobaa/noobaa-core:5.16.0': NooBaa image
--operator-image='noobaa/noobaa-operator:5.16.0': Operator image
Expand Down
10 changes: 3 additions & 7 deletions deploy/crds/noobaa.io_noobaas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,10 @@ spec:
buckets, objects meta-data and mapping file parts to storage locations.
type: string
dbType:
description: DBType (optional) overrides the default type image for
the db container
description: |-
DBType (optional) overrides the default type image for the db container.
The only possible value is postgres
enum:
- mongodb
- postgres
type: string
dbVolumeResources:
Expand Down Expand Up @@ -1565,10 +1565,6 @@ spec:
account with new BackingStore in order to delete the DefaultBackingStore
nullable: true
type: boolean
mongoDbURL:
description: MongoDbURL (optional) overrides the default mongo db
remote url
type: string
pvPoolDefaultStorageClass:
description: |-
PVPoolDefaultStorageClass (optional) overrides the default cluster StorageClass for the pv-pool volumes.
Expand Down
17 changes: 8 additions & 9 deletions deploy/internal/deployment-endpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ spec:
secret:
secretName: noobaa-s3-serving-cert
optional: true
# This service account token can be used to provide identity outside the cluster.
# For example, this token can be used with AssumeRoleWithWebIdentity to authenticate with AWS using IAM OIDC provider and STS.
# This service account token can be used to provide identity outside the cluster.
# For example, this token can be used with AssumeRoleWithWebIdentity to authenticate with AWS using IAM OIDC provider and STS.
- name: bound-sa-token
projected:
sources:
- serviceAccountToken:
path: token
# For testing purposes change the audience to api
audience: openshift
- serviceAccountToken:
path: token
# For testing purposes change the audience to api
audience: openshift
- name: noobaa-auth-token
secret:
secretName: noobaa-endpoints
optional: true
- name: noobaa-server
secret:
secretName: noobaa-server
optional: true
optional: true
containers:
- name: endpoint
image: NOOBAA_CORE_IMAGE
Expand Down Expand Up @@ -89,7 +89,6 @@ spec:
- name: MD_ADDR
- name: HOSTED_AGENTS_ADDR
- name: DB_TYPE
- name: MONGODB_URL
- name: POSTGRES_HOST
- name: POSTGRES_PORT
- name: POSTGRES_DBNAME
Expand Down Expand Up @@ -145,6 +144,6 @@ spec:
tcpSocket:
port: 6001 # ready when s3 port is open
timeoutSeconds: 5
securityContext:
securityContext:
runAsUser: 0
runAsGroup: 0
25 changes: 0 additions & 25 deletions deploy/internal/job-upgrade-db.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions deploy/internal/service-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
labels:
app: noobaa
annotations:
service.beta.openshift.io/serving-cert-secret-name: 'noobaa-db-serving-cert'
service.alpha.openshift.io/serving-cert-secret-name: 'noobaa-db-serving-cert'
service.beta.openshift.io/serving-cert-secret-name: "noobaa-db-serving-cert"
service.alpha.openshift.io/serving-cert-secret-name: "noobaa-db-serving-cert"
spec:
type: ClusterIP
selector:
noobaa-db: SYSNAME
ports:
- port: 27017
targetPort: 27017
name: mongodb
- port: 5432
targetPort: 5432
name: postgres
23 changes: 12 additions & 11 deletions deploy/internal/statefulset-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ spec:
secret:
secretName: noobaa-server
optional: true
# This service account token can be used to provide identity outside the cluster.
# For example, this token can be used with AssumeRoleWithWebIdentity to authenticate with AWS using IAM OIDC provider and STS.
# This service account token can be used to provide identity outside the cluster.
# For example, this token can be used with AssumeRoleWithWebIdentity to authenticate with AWS using IAM OIDC provider and STS.
- name: bound-sa-token
projected:
sources:
- serviceAccountToken:
path: token
# For testing purposes change the audience to api
audience: openshift
- serviceAccountToken:
path: token
# For testing purposes change the audience to api
audience: openshift
containers:
#----------------#
# CORE CONTAINER #
Expand Down Expand Up @@ -97,8 +97,6 @@ spec:
configMapKeyRef:
name: noobaa-config
key: NOOBAA_LOG_LEVEL
- name: MONGODB_URL
value: "mongodb://noobaa-db-0.noobaa-db/nbcore"
- name: POSTGRES_HOST
value: "noobaa-db-pg-0.noobaa-db-pg"
- name: POSTGRES_PORT
Expand All @@ -110,7 +108,7 @@ spec:
- name: POSTGRES_SSL_REQUIRED
- name: POSTGRES_SSL_UNAUTHORIZED
- name: DB_TYPE
value: mongodb
value: postgres
- name: CONTAINER_PLATFORM
value: KUBERNETES
- name: NOOBAA_ROOT_SECRET
Expand Down Expand Up @@ -143,7 +141,10 @@ spec:
resource: limits.memory
- name: noobaa-log-processor
image: NOOBAA_CORE_IMAGE
command: ["/root/node_modules/noobaa-core/src/deploy/NVA_build/noobaa_logs.sh"]
command:
[
"/root/node_modules/noobaa-core/src/deploy/NVA_build/noobaa_logs.sh",
]
volumeMounts:
- name: logs
mountPath: /log
Expand Down Expand Up @@ -173,4 +174,4 @@ spec:
- name: CONTAINER_MEM_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
resource: limits.memory
56 changes: 0 additions & 56 deletions deploy/internal/statefulset-db.yaml

This file was deleted.

8 changes: 3 additions & 5 deletions doc/noobaa-crd.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ metadata:
namespace: noobaa
spec:
image: noobaa/noobaa-core:v9999.9.9
dbImage: centos/mongodb-36-centos7
dbImage: "quay.io/sclorg/postgresql-15-c9s"
imagePullSecret:
name: <SECRET-NAME>
```
Expand Down Expand Up @@ -236,7 +236,6 @@ metadata:
spec:
image: noobaa/noobaa-core:5.9.0
dbImage: centos/postgresql-12-centos7
dbType: postgres
dbConf: |+
max_connections = 1000
```
Expand All @@ -258,6 +257,5 @@ topologySpreadConstraints:
Users can make changes to `topologySpreadConstraints` configuration after the operator creates it and the changes will not override it. But once user remove the custome `topologySpreadConstraints` default value is resotored.

## Notes
1. `dbConf` field will have no effect if `dbType` is not "postgres".
2. `dbConf` configuration is not validated.
3. NooBaa uses `ConfigMap` to pass database configuration to the databases. Althought the ConfigMap is editable, it should not and cannot be used to pass custom database overrides. The reason being that NooBaa operator, as part of its reconcile process will overwrite the ConfigMap to the default values.
1. `dbConf` configuration is not validated.
2. NooBaa uses `ConfigMap` to pass database configuration to the databases. Althought the ConfigMap is editable, it should not and cannot be used to pass custom database overrides. The reason being that NooBaa operator, as part of its reconcile process will overwrite the ConfigMap to the default values.
11 changes: 3 additions & 8 deletions pkg/apis/noobaa/v1alpha1/noobaa_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ type NooBaaSpec struct {
// +optional
DBConf *string `json:"dbConf,omitempty"`

// DBType (optional) overrides the default type image for the db container
// DBType (optional) overrides the default type image for the db container.
// The only possible value is postgres
// +optional
// +kubebuilder:validation:Enum=mongodb;postgres
// +kubebuilder:validation:Enum=postgres
DBType DBTypes `json:"dbType,omitempty"`

// CoreResources (optional) overrides the default resource requirements for the server container
Expand Down Expand Up @@ -118,10 +119,6 @@ type NooBaaSpec struct {
// +optional
DBStorageClass *string `json:"dbStorageClass,omitempty"`

// MongoDbURL (optional) overrides the default mongo db remote url
// +optional
MongoDbURL string `json:"mongoDbURL,omitempty"`

// ExternalPgSecret (optional) holds an optional secret with a url to an extrenal Postgres DB to be used
// +optional
ExternalPgSecret *corev1.SecretReference `json:"externalPgSecret,omitempty"`
Expand Down Expand Up @@ -528,8 +525,6 @@ type DBTypes string

// These are the valid DB types:
const (
// DBTypeMongo is mongodb
DBTypeMongo DBTypes = "mongodb"
// DBTypePostgres is postgres
DBTypePostgres DBTypes = "postgres"
)
Expand Down
Loading

0 comments on commit b58a6f1

Please sign in to comment.