diff --git a/docs/user_docs/cli/kbcli_cluster_configure.md b/docs/user_docs/cli/kbcli_cluster_configure.md index edf95bd20..1e3489d36 100644 --- a/docs/user_docs/cli/kbcli_cluster_configure.md +++ b/docs/user_docs/cli/kbcli_cluster_configure.md @@ -35,7 +35,6 @@ kbcli cluster configure NAME --set key=value[,key=value] [--components=component -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) --replace Boolean flag to enable replacing config file. Default with false. --set strings Specify parameters list to be updated. For more details, refer to 'kbcli cluster describe-config'. - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed ``` diff --git a/docs/user_docs/cli/kbcli_cluster_create_llm.md b/docs/user_docs/cli/kbcli_cluster_create_llm.md index 1b4344156..f2fe5415b 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_llm.md +++ b/docs/user_docs/cli/kbcli_cluster_create_llm.md @@ -30,7 +30,7 @@ kbcli cluster create llm NAME [flags] --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0, 1000]. --model string Model name (default "facebook/opt-125m") - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --monitor-enabled Enable or disable monitor. --publicly-accessible Specify whether the cluster can be accessed from the public internet. --quantize string Model's quantized file name, only work for CPU mode --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. diff --git a/docs/user_docs/cli/kbcli_cluster_create_mongodb.md b/docs/user_docs/cli/kbcli_cluster_create_mongodb.md index 880f4ce8f..622db3e9b 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_mongodb.md +++ b/docs/user_docs/cli/kbcli_cluster_create_mongodb.md @@ -27,11 +27,12 @@ kbcli cluster create mongodb NAME [flags] --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0.5, 1000]. (default 0.5) --mode string Cluster topology mode. Legal values [standalone, replicaset]. (default "standalone") - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --monitor-enabled Enable or disable monitor. --publicly-accessible Specify whether the cluster can be accessed from the public internet. --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. --replicas int The number of replicas, for standalone mode, the replicas is 1, for replicaset mode, the default replicas is 3. Value range [1, 5]. (default 1) --storage float Storage size, the unit is Gi. Value range [1, 10000]. (default 20) + --storage-class-name string Storage class name of the data volume --tenancy string The tenancy of cluster. Legal values [SharedNode, DedicatedNode]. (default "SharedNode") --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Halt, Delete, WipeOut]. (default "Delete") --version string Cluster version. diff --git a/docs/user_docs/cli/kbcli_cluster_create_mysql.md b/docs/user_docs/cli/kbcli_cluster_create_mysql.md index 28737701d..b9256b69f 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_mysql.md +++ b/docs/user_docs/cli/kbcli_cluster_create_mysql.md @@ -27,12 +27,13 @@ kbcli cluster create mysql NAME [flags] --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0.5, 1000]. (default 0.5) --mode string Cluster topology mode. Legal values [standalone, raftGroup]. (default "standalone") - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --monitor-enabled Enable or disable monitor. --proxy-enabled Enable proxy or not. --publicly-accessible Specify whether the cluster can be accessed from the public internet. --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. --replicas int The number of replicas, for standalone mode, the replicas is 1, for raftGroup mode, the default replicas is 3. Value range [1, 5]. (default 1) --storage float Storage size, the unit is Gi. Value range [1, 10000]. (default 20) + --storage-class-name string Storage class name of the data volume --tenancy string The tenancy of cluster. Legal values [SharedNode, DedicatedNode]. (default "SharedNode") --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Halt, Delete, WipeOut]. (default "Delete") --version string Cluster version. diff --git a/docs/user_docs/cli/kbcli_cluster_create_postgresql.md b/docs/user_docs/cli/kbcli_cluster_create_postgresql.md index d356e840a..7373af036 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_postgresql.md +++ b/docs/user_docs/cli/kbcli_cluster_create_postgresql.md @@ -27,11 +27,12 @@ kbcli cluster create postgresql NAME [flags] --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0.5, 1000]. (default 0.5) --mode string Cluster topology mode. Legal values [standalone, replication]. (default "standalone") - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --monitor-enabled Enable or disable monitor. --publicly-accessible Specify whether the cluster can be accessed from the public internet. --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. --replicas int The number of replicas, for standalone mode, the replicas is 1, for replication mode, the default replicas is 2. Value range [1, 5]. (default 1) --storage float Storage size, the unit is Gi. Value range [1, 10000]. (default 20) + --storage-class-name string Storage class name of the data volume --tenancy string The tenancy of cluster. Legal values [SharedNode, DedicatedNode]. (default "SharedNode") --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Halt, Delete, WipeOut]. (default "Delete") --version string Cluster version. diff --git a/docs/user_docs/cli/kbcli_cluster_create_redis.md b/docs/user_docs/cli/kbcli_cluster_create_redis.md index 73b610088..b96cc4e80 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_redis.md +++ b/docs/user_docs/cli/kbcli_cluster_create_redis.md @@ -26,8 +26,8 @@ kbcli cluster create redis NAME [flags] -h, --help help for redis --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0.5, 1000]. (default 0.5) - --mode string Cluster topology mode. Legal values [standalone, replication, cluster]. (default "replication") - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --mode string Cluster topology mode. Legal values [standalone, replication, cluster, sentinel]. (default "replication") + --monitor-enabled Enable or disable monitor. --node-port-enabled Whether NodePort service is enabled, default is true --publicly-accessible Specify whether the cluster can be accessed from the public internet. --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. @@ -39,6 +39,7 @@ kbcli cluster create redis NAME [flags] --sentinel.replicas float Sentinel component replicas Value range [1, 5]. (default 3) --sentinel.storage float Sentinel component storage size, the unit is Gi. Value range [1, 1024]. (default 20) --storage float Storage size, the unit is Gi. Value range [1, 10000]. (default 20) + --storage-class-name string Storage class name of the data volume --tenancy string The tenancy of cluster. Legal values [SharedNode, DedicatedNode]. (default "SharedNode") --termination-policy string The termination policy of cluster. Legal values [DoNotTerminate, Halt, Delete, WipeOut]. (default "Delete") --twemproxy.cpu float twemproxy component cpu cores. Value range [0.1, 8]. (default 0.2) diff --git a/docs/user_docs/cli/kbcli_cluster_create_xinference.md b/docs/user_docs/cli/kbcli_cluster_create_xinference.md index 638509a3b..4e3bae91b 100644 --- a/docs/user_docs/cli/kbcli_cluster_create_xinference.md +++ b/docs/user_docs/cli/kbcli_cluster_create_xinference.md @@ -28,7 +28,7 @@ kbcli cluster create xinference NAME [flags] -h, --help help for xinference --host-network-accessible Specify whether the cluster can be accessed from within the VPC. --memory float Memory, the unit is Gi. Value range [0.5, 1000]. (default 6) - --monitoring-interval int The monitoring interval of cluster, 0 is disabled, the unit is second. Value range [0, 60]. + --monitor-enabled Enable or disable monitor. --publicly-accessible Specify whether the cluster can be accessed from the public internet. --rbac-enabled Specify whether rbac resources will be created by client, otherwise KubeBlocks server will try to create rbac resources. --replicas int The number of replicas, for standalone mode, the replicas is 1, for replication mode, the default replicas is 2. Value range [1, 5]. (default 1) diff --git a/docs/user_docs/cli/kbcli_cluster_edit-config.md b/docs/user_docs/cli/kbcli_cluster_edit-config.md index 32a7323fb..3bcea146f 100644 --- a/docs/user_docs/cli/kbcli_cluster_edit-config.md +++ b/docs/user_docs/cli/kbcli_cluster_edit-config.md @@ -31,7 +31,6 @@ kbcli cluster edit-config NAME [--component=component-name] [--config-spec=confi -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) --replace Boolean flag to enable replacing config file. Default with false. --set strings Specify parameters list to be updated. For more details, refer to 'kbcli cluster describe-config'. - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed ``` diff --git a/docs/user_docs/cli/kbcli_cluster_expose.md b/docs/user_docs/cli/kbcli_cluster_expose.md index a18574d5c..2ec6d1065 100644 --- a/docs/user_docs/cli/kbcli_cluster_expose.md +++ b/docs/user_docs/cli/kbcli_cluster_expose.md @@ -32,7 +32,6 @@ kbcli cluster expose NAME --enable=[true|false] --type=[vpc|internet] [flags] -h, --help help for expose --name string OpsRequest name. if not specified, it will be randomly generated -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed --type string Expose type, currently supported types are 'vpc', 'internet' ``` diff --git a/docs/user_docs/cli/kbcli_cluster_hscale.md b/docs/user_docs/cli/kbcli_cluster_hscale.md index ec2d09391..ee8f1c75c 100644 --- a/docs/user_docs/cli/kbcli_cluster_hscale.md +++ b/docs/user_docs/cli/kbcli_cluster_hscale.md @@ -26,7 +26,6 @@ kbcli cluster hscale NAME [flags] --name string OpsRequest name. if not specified, it will be randomly generated -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) --replicas int Replicas with the specified components - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed ``` diff --git a/docs/user_docs/cli/kbcli_cluster_restart.md b/docs/user_docs/cli/kbcli_cluster_restart.md index d26cf3361..4f5f9af25 100644 --- a/docs/user_docs/cli/kbcli_cluster_restart.md +++ b/docs/user_docs/cli/kbcli_cluster_restart.md @@ -28,7 +28,6 @@ kbcli cluster restart NAME [flags] -h, --help help for restart --name string OpsRequest name. if not specified, it will be randomly generated -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed ``` diff --git a/docs/user_docs/cli/kbcli_cluster_volume-expand.md b/docs/user_docs/cli/kbcli_cluster_volume-expand.md index 4bffb80ad..42fed0c33 100644 --- a/docs/user_docs/cli/kbcli_cluster_volume-expand.md +++ b/docs/user_docs/cli/kbcli_cluster_volume-expand.md @@ -25,7 +25,6 @@ kbcli cluster volume-expand NAME [flags] -h, --help help for volume-expand --name string OpsRequest name. if not specified, it will be randomly generated -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) - --shardings strings sharding names to this operations --storage string Volume storage size (required) --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed -t, --volume-claim-templates strings VolumeClaimTemplate names in components (required) diff --git a/docs/user_docs/cli/kbcli_cluster_vscale.md b/docs/user_docs/cli/kbcli_cluster_vscale.md index 0ba702175..c254d9af7 100644 --- a/docs/user_docs/cli/kbcli_cluster_vscale.md +++ b/docs/user_docs/cli/kbcli_cluster_vscale.md @@ -27,7 +27,6 @@ kbcli cluster vscale NAME [flags] --memory string Request and limit size of component memory --name string OpsRequest name. if not specified, it will be randomly generated -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) - --shardings strings sharding names to this operations --ttlSecondsAfterSucceed int Time to live after the OpsRequest succeed ``` diff --git a/pkg/action/template/cluster_operations_template.cue b/pkg/action/template/cluster_operations_template.cue index d9494e4ea..421386505 100644 --- a/pkg/action/template/cluster_operations_template.cue +++ b/pkg/action/template/cluster_operations_template.cue @@ -27,7 +27,6 @@ options: { component: string instance: string componentNames: [...string] - shardingNames: [...string] rebuildInstanceFrom: [ ...{ componentName: string @@ -111,35 +110,18 @@ content: { name: vctName storage: options.storage }] - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - volumeClaimTemplates: [ for _, vctName in options.vctNames { - name: vctName - storage: options.storage - }] - }] + }] } if options.type == "HorizontalScaling" { horizontalScaling: [ for _, cName in options.componentNames { componentName: cName replicas: options.replicas - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - replicas: options.replicas - }] + }] } if options.type == "Restart" { restart: [ for _, cName in options.componentNames { componentName: cName - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - }] + }] } if options.type == "VerticalScaling" { verticalScaling: [ for _, cName in options.componentNames { @@ -160,27 +142,7 @@ content: { cpu: options.cpu } } - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - requests: { - if options.memory != "" { - memory: options.memory - } - if options.cpu != "" { - cpu: options.cpu - } - } - limits: { - if options.memory != "" { - memory: options.memory - } - if options.cpu != "" { - cpu: options.cpu - } - } - }] + }] } if options.type == "Reconfiguring" { if len(options.componentNames) == 1 { @@ -227,29 +189,7 @@ content: { } }] }] - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - configurations: [ { - name: options.cfgTemplateName - if options.forceRestart { - policy: "simple" - } - keys: [{ - key: options.cfgFile - if options.fileContent != "" { - fileContent: options.fileContent - } - if options.hasPatch { - parameters: [ for k, v in options.keyValues { - key: k - value: v - }] - } - }] - }] - }] + }] } } if options.type == "Expose" { @@ -269,25 +209,7 @@ content: { } }] - }, - for _, sName in options.shardingNames { - componentName: sName - isSharding: true - if options.exposeEnabled == "true" { - switch: "Enable" - } - if options.exposeEnabled == "false" { - switch: "Disable" - } - services: [ for _, svc in options.services { - name: svc.name - serviceType: svc.serviceType - if len(svc.annotations) > 0 { - annotations: svc.annotations - } - - }] - }] + }] } if options.type == "Switchover" { switchover: [{ diff --git a/pkg/cmd/cluster/operations.go b/pkg/cmd/cluster/operations.go index c58ec545b..eba27745e 100755 --- a/pkg/cmd/cluster/operations.go +++ b/pkg/cmd/cluster/operations.go @@ -59,12 +59,11 @@ import ( const oceanbase = "oceanbase" type OperationsOptions struct { - action.CreateOptions `json:"-"` - HasCompNamesOrShardingNamesFlag bool `json:"-"` + action.CreateOptions `json:"-"` + HasComponentNamesFlag bool `json:"-"` // AutoApprove when set true, skip the double check. AutoApprove bool `json:"-"` ComponentNames []string `json:"componentNames,omitempty"` - ShardingNames []string `json:"shardingNames,omitempty"` OpsRequestName string `json:"opsRequestName"` TTLSecondsAfterSucceed int `json:"ttlSecondsAfterSucceed"` Force bool `json:"force"` @@ -118,7 +117,7 @@ type OperationsOptions struct { } func newBaseOperationsOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, - opsType appsv1alpha1.OpsType, hasCompNamesOrShardingNamesFlag bool) *OperationsOptions { + opsType appsv1alpha1.OpsType, hasComponentNamesFlag bool) *OperationsOptions { customOutPut := func(opt *action.CreateOptions) { output := fmt.Sprintf("OpsRequest %s created successfully, you can view the progress:", opt.Name) printer.PrintLine(output) @@ -128,11 +127,11 @@ func newBaseOperationsOptions(f cmdutil.Factory, streams genericiooptions.IOStre o := &OperationsOptions{ // nil cannot be set to a map struct in CueLang, so init the map of KeyValues. - KeyValues: map[string]*string{}, - HasPatch: true, - OpsType: opsType, - HasCompNamesOrShardingNamesFlag: hasCompNamesOrShardingNamesFlag, - AutoApprove: false, + KeyValues: map[string]*string{}, + HasPatch: true, + OpsType: opsType, + HasComponentNamesFlag: hasComponentNamesFlag, + AutoApprove: false, CreateOptions: action.CreateOptions{ Factory: f, IOStreams: streams, @@ -156,9 +155,8 @@ func (o *OperationsOptions) addCommonFlags(cmd *cobra.Command, f cmdutil.Factory cmd.Flags().IntVar(&o.TTLSecondsAfterSucceed, "ttlSecondsAfterSucceed", 0, "Time to live after the OpsRequest succeed") cmd.Flags().StringVar(&o.DryRun, "dry-run", "none", `Must be "client", or "server". If with client strategy, only print the object that would be sent, and no data is actually sent. If with server strategy, submit the server-side request, but no data is persistent.`) cmd.Flags().Lookup("dry-run").NoOptDefVal = "unchanged" - if o.HasCompNamesOrShardingNamesFlag { + if o.HasComponentNamesFlag { flags.AddComponentsFlag(f, cmd, &o.ComponentNames, "Component names to this operations") - cmd.Flags().StringSliceVar(&o.ShardingNames, "shardings", nil, "sharding names to this operations") } } @@ -168,7 +166,7 @@ func (o *OperationsOptions) CompleteRestartOps() error { if o.Name == "" { return makeMissingClusterNameErr() } - if len(o.ComponentNames) != 0 || len(o.ShardingNames) != 0 { + if len(o.ComponentNames) != 0 { return nil } clusterObj, err := cluster.GetClusterByName(o.Dynamic, o.Name, o.Namespace) @@ -176,12 +174,12 @@ func (o *OperationsOptions) CompleteRestartOps() error { return err } componentSpecs := clusterObj.Spec.ComponentSpecs - o.ComponentNames = make([]string, len(componentSpecs)) + o.ComponentNames = make([]string, 0) for i := range componentSpecs { - o.ComponentNames[i] = componentSpecs[i].Name + o.ComponentNames = append(o.ComponentNames, componentSpecs[i].Name) } for i := range clusterObj.Spec.ShardingSpecs { - o.ShardingNames = append(o.ShardingNames, clusterObj.Spec.ShardingSpecs[i].Name) + o.ComponentNames = append(o.ComponentNames, clusterObj.Spec.ShardingSpecs[i].Name) } return nil } @@ -427,8 +425,8 @@ func (o *OperationsOptions) Validate() error { } // common validate for componentOps - if o.HasCompNamesOrShardingNamesFlag && len(o.ComponentNames) == 0 && len(o.ShardingNames) == 0 { - return fmt.Errorf(`missing components or shardings, please specify the "--components" or "--shardings" flag for the cluster`) + if o.HasComponentNamesFlag && len(o.ComponentNames) == 0 { + return fmt.Errorf(`missing components, please specify the "--components" flag for the cluster`) } switch o.OpsType { @@ -730,7 +728,7 @@ func NewVerticalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStreams cmd.Flags().StringVar(&o.CPU, "cpu", "", "Request and limit size of component cpu") cmd.Flags().StringVar(&o.Memory, "memory", "", "Request and limit size of component memory") cmd.Flags().BoolVar(&o.AutoApprove, "auto-approve", false, "Skip interactive approval before vertically scaling the cluster") - cmd.MarkFlagsOneRequired("components", "shardings") + _ = cmd.MarkFlagRequired("components") return cmd } @@ -761,7 +759,7 @@ func NewHorizontalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStrea cmd.Flags().IntVar(&o.Replicas, "replicas", 0, "Replicas with the specified components") cmd.Flags().BoolVar(&o.AutoApprove, "auto-approve", false, "Skip interactive approval before horizontally scaling the cluster") _ = cmd.MarkFlagRequired("replicas") - cmd.MarkFlagsOneRequired("components", "shardings") + _ = cmd.MarkFlagRequired("components") return cmd } @@ -793,7 +791,7 @@ func NewVolumeExpansionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams cmd.Flags().BoolVar(&o.AutoApprove, "auto-approve", false, "Skip interactive approval before expanding the cluster volume") _ = cmd.MarkFlagRequired("volume-claim-templates") _ = cmd.MarkFlagRequired("storage") - cmd.MarkFlagsOneRequired("components", "shardings") + _ = cmd.MarkFlagRequired("components") return cmd } diff --git a/pkg/cmd/cluster/operations_test.go b/pkg/cmd/cluster/operations_test.go index f780a3bb4..ac3acb674 100644 --- a/pkg/cmd/cluster/operations_test.go +++ b/pkg/cmd/cluster/operations_test.go @@ -185,7 +185,7 @@ var _ = Describe("operations", func() { } o := initCommonOperationOps(appsv1alpha1.VolumeExpansionType, clusterName, true, persistentVolumeClaim) By("validate volumeExpansion when components is null") - Expect(o.Validate()).To(MatchError(`missing components or shardings, please specify the "--components" or "--shardings" flag for the cluster`)) + Expect(o.Validate()).To(MatchError(`missing components, please specify the "--components" flag for the cluster`)) By("validate volumeExpansion when vct-names is null") o.ComponentNames = []string{compName}