github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/cli/create/template/migration_template.cue (about)

     1  //Copyright (C) 2022-2023 ApeCloud Co., Ltd
     2  //
     3  //This file is part of KubeBlocks project
     4  //
     5  //This program is free software: you can redistribute it and/or modify
     6  //it under the terms of the GNU Affero General Public License as published by
     7  //the Free Software Foundation, either version 3 of the License, or
     8  //(at your option) any later version.
     9  //
    10  //This program is distributed in the hope that it will be useful
    11  //but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  //GNU Affero General Public License for more details.
    14  //
    15  //You should have received a copy of the GNU Affero General Public License
    16  //along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  // required, command line input options for parameters and flags
    19  options: {
    20  	name:      string
    21  	namespace: string
    22  	teplate:   string
    23  	taskType:  string
    24  	source:    string
    25  	sourceEndpointModel: {}
    26  	sink: string
    27  	sinkEndpointModel: {}
    28  	migrationObject: [...]
    29  	migrationObjectModel: {}
    30  	steps: [...]
    31  	stepsModel: [...]
    32  	tolerations: [...]
    33  	tolerationModel: {}
    34  	resources: [...]
    35  	resourceModel: {}
    36  	serverId: int
    37  }
    38  
    39  // required, k8s api resource content
    40  content: {
    41  	apiVersion: "datamigration.apecloud.io/v1alpha1"
    42  	kind:       "MigrationTask"
    43  	metadata: {
    44  		name:      options.name
    45  		namespace: options.namespace
    46  	}
    47  	spec: {
    48  		taskType:       options.taskType
    49  		template:       options.template
    50  		sourceEndpoint: options.sourceEndpointModel
    51  		sinkEndpoint:   options.sinkEndpointModel
    52  		initialization: {
    53  			steps: options.stepsModel
    54  			config: {
    55  				preCheck: {
    56  					resource: {
    57  						limits: options.resourceModel["precheck"]
    58  					}
    59  					tolerations: options.tolerationModel["precheck"]
    60  				}
    61  				initStruct: {
    62  					resource: {
    63  						limits: options.resourceModel["init-struct"]
    64  					}
    65  					tolerations: options.tolerationModel["init-struct"]
    66  				}
    67  				initData: {
    68  					resource: {
    69  						limits: options.resourceModel["init-data"]
    70  					}
    71  					tolerations: options.tolerationModel["init-data"]
    72  				}
    73  			}
    74  		}
    75  		cdc: {
    76  			config: {
    77  				resource: {
    78  					limits: options.resourceModel["cdc"]
    79  				}
    80  				tolerations: options.tolerationModel["cdc"]
    81  				param: {
    82  					"extractor.server_id": options.serverId
    83  				}
    84  			}
    85  		}
    86  		migrationObj:      options.migrationObjectModel
    87  		globalTolerations: options.tolerationModel["global"]
    88  		globalResources: {
    89  			limits: options.resourceModel["global"]
    90  		}
    91  	}
    92  }