Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions apis/catalog/v1alpha1/mongodb_version_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package v1alpha1

import (
"kubedb.dev/apimachinery/apis/migrator/v1alpha1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1"
)
Expand Down Expand Up @@ -87,6 +89,9 @@ type MongoDBVersionSpec struct {
Archiver ArchiverSpec `json:"archiver,omitempty"`
// +optional
UI []ChartInfo `json:"ui,omitempty"`
// Migrator defines the migration related CLI/Tools images for this MongoDB version
// +optional
Migrator v1alpha1.DBMigratorImages `json:"migrator,omitempty"`
}

// MongoDBVersionDatabase is the MongoDB Database image
Expand Down
9 changes: 8 additions & 1 deletion apis/catalog/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apis/catalog/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions apis/migrator/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ func (m Migrator) GetDBKindAndCommand() (string, string) {
switch {
case m.Spec.Source.Postgres != nil && m.Spec.Target.Postgres != nil:
return "Postgres", "postgres"
case m.Spec.Source.MongoDB != nil && m.Spec.Target.MongoDB != nil:
return "MongoDB", "mongodb"
}

return "", ""
}

func (m Migrator) GetConnectionInfos() (*ConnectionInfo, *ConnectionInfo) {
switch {
case m.Spec.Source.Postgres != nil && m.Spec.Target.Postgres != nil:
return &m.Spec.Source.Postgres.ConnectionInfo, &m.Spec.Target.Postgres.ConnectionInfo
case m.Spec.Source.MongoDB != nil && m.Spec.Target.MongoDB != nil:
return &m.Spec.Source.MongoDB.ConnectionInfo, &m.Spec.Target.MongoDB.ConnectionInfo
}
return nil, nil
}
1 change: 1 addition & 0 deletions apis/migrator/v1alpha1/migrator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
// +kubebuilder:printcolumn:name="DBType",type="string",JSONPath=".status.progress.dbType"
// +kubebuilder:printcolumn:name="Stage",type="string",JSONPath=".status.progress.info.Stage"
// +kubebuilder:printcolumn:name="Lag",type="string",JSONPath=".status.progress.info.Lag"
// +kubebuilder:printcolumn:name="Progress",type="string",JSONPath=".status.progress.info.Progress"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type Migrator struct {
metav1.TypeMeta `json:",inline"`
Expand Down
72 changes: 72 additions & 0 deletions apis/migrator/v1alpha1/mongodb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

type MongoSource struct {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectionInfo ConnectionInfo `yaml:"connectionInfo" json:"connectionInfo"`
Mongoshake *Mongoshake `yaml:"mongoshake" json:"mongoshake,omitempty"`
}
type MongoTarget struct {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectionInfo ConnectionInfo `yaml:"connectionInfo" json:"connectionInfo"`
}
type Mongoshake struct {
// SyncMode: full, incr, or fullSync
SyncMode string `yaml:"syncMode" json:"syncMode,omitempty" config:"sync_mode"`

MongoSslRootCaFile string `yaml:"mongoSslRootCaFile" json:"mongoSslRootCaFile,omitempty" config:"mongo_ssl_root_ca_file"`
MongoSslClientCaFile string `yaml:"mongoSslClientCaFile" json:"mongoSslClientCaFile,omitempty" config:"mongo_ssl_root_ca_file"`

FilterOpTypes []string `yaml:"filterOpTypes" json:"filterOpTypes,omitempty" config:"filter.op_types"`
FilterNamespaceBlack []string `yaml:"filterNamespaceBlack" json:"filterNamespaceBlack,omitempty" config:"filter.namespace.black"`
FilterNamespaceWhite []string `yaml:"filterNamespaceWhite" json:"filterNamespaceWhite,omitempty" config:"filter.namespace.white"`
FilterPassSpecialDb []string `yaml:"filterPassSpecialDb" json:"filterPassSpecialDb,omitempty" config:"filter.pass.special.db"`

// ---------------- BOOLS → POINTERS ----------------
FilterDDLEnable *bool `yaml:"filterDdlEnable" json:"filterDdlEnable,omitempty" config:"filter.ddl_enable"`
FilterOplogGids *bool `yaml:"filterOplogGids" json:"filterOplogGids,omitempty" config:"filter.oplog.gids"`

CheckpointStartPosition int64 `yaml:"checkpointStartPosition" json:"checkpointStartPosition,omitempty" config:"checkpoint.start_position" type:"date"`

TransformNamespace []string `yaml:"transformNamespace" json:"transformNamespace,omitempty" config:"transform.namespace"`

FullSyncReaderCollectionParallel int `yaml:"fullSyncReaderCollectionParallel" json:"fullSyncReaderCollectionParallel,omitempty" config:"full_sync.reader.collection_parallel"`
FullSyncReaderWriteDocumentParallel int `yaml:"fullSyncReaderWriteDocumentParallel" json:"fullSyncReaderWriteDocumentParallel,omitempty" config:"full_sync.reader.write_document_parallel"`
FullSyncReaderDocumentBatchSize int `yaml:"fullSyncReaderDocumentBatchSize" json:"fullSyncReaderDocumentBatchSize,omitempty" config:"full_sync.reader.document_batch_size"`
FullSyncReaderFetchBatchSize int `yaml:"fullSyncReaderFetchBatchSize" json:"fullSyncReaderFetchBatchSize,omitempty" config:"full_sync.reader.fetch_batch_size"`
FullSyncReaderParallelThread int `yaml:"fullSyncReaderParallelThread" json:"fullSyncReaderParallelThread,omitempty" config:"full_sync.reader.parallel_thread"`

FullSyncReaderParallelIndex string `yaml:"fullSyncReaderParallelIndex" json:"fullSyncReaderParallelIndex,omitempty" config:"full_sync.reader.parallel_index"`
FullSyncReaderSplitMaxChunkSize int `yaml:"fullSyncReaderSplitMaxChunkSize" json:"fullSyncReaderSplitMaxChunkSize,omitempty" config:"full_sync.reader.split_max_chunk_size"`

// ---------------- BOOLS → POINTERS ----------------
FullSyncCollectionDrop *bool `yaml:"fullSyncCollectionDrop" json:"fullSyncCollectionDrop,omitempty" config:"full_sync.collection_exist_drop"`
FullSyncReaderOplogStoreDisk *bool `yaml:"fullSyncReaderOplogStoreDisk" json:"fullSyncReaderOplogStoreDisk,omitempty" config:"full_sync.reader.oplog_store_disk"`
FullSyncExecutorInsertOnDupUpdate *bool `yaml:"fullSyncExecutorInsertOnDupUpdate" json:"fullSyncExecutorInsertOnDupUpdate,omitempty" config:"full_sync.executor.insert_on_dup_update"`
FullSyncExecutorFilterOrphanDocument *bool `yaml:"fullSyncExecutorFilterOrphanDocument" json:"fullSyncExecutorFilterOrphanDocument,omitempty" config:"full_sync.executor.filter.orphan_document"`
FullSyncExecutorMajorityEnable *bool `yaml:"fullSyncExecutorMajorityEnable" json:"fullSyncExecutorMajorityEnable,omitempty" config:"full_sync.executor.majority_enable"`
FullSyncDoNotShardDest *bool `yaml:"fullSyncDoNotShardDest" json:"fullSyncDoNotShardDest,omitempty" config:"full_sync.do_not_shard_destination"`

FullSyncCreateIndex string `yaml:"fullSyncCreateIndex" json:"fullSyncCreateIndex,omitempty" config:"full_sync.create_index"`
FullSyncReaderOplogStoreDiskMaxSize int64 `yaml:"fullSyncReaderOplogStoreDiskMaxSize" json:"fullSyncReaderOplogStoreDiskMaxSize,omitempty" config:"full_sync.reader.oplog_store_disk_max_size"`

IncrSyncReaderFetchBatchSize int `yaml:"incrSyncReaderFetchBatchSize" json:"incrSyncReaderFetchBatchSize,omitempty" config:"incr_sync.reader.fetch_batch_size"`
IncrSyncWorker int `yaml:"incrSyncWorker" json:"incrSyncWorker,omitempty" config:"incr_sync.worker"`
IncrSyncTunnelWriteThread int `yaml:"incrSyncTunnelWriteThread" json:"incrSyncTunnelWriteThread,omitempty" config:"incr_sync.tunnel.write_thread"`

// +optional
ExtraConfiguration map[string]string `yaml:"extraConfiguration" json:"extraConfiguration,omitempty"`
}
Loading