Skip to content

Commit

Permalink
Merge pull request #34 from ganganxiaojiu/main
Browse files Browse the repository at this point in the history
specify the olap volume size
  • Loading branch information
nineinfra authored Jan 7, 2024
2 parents 34aaabb + 02ef082 commit f91d40f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func (t ClusterOptions) Validate() error {
if t.Olap != "" && !strings.Contains(olapsSupported, t.Olap) {
return errors.New(fmt.Sprintf("invalid olap:%s,support [%s]", t.Olap, olapsSupported))
}
if t.OlapVolume <= 10 {
return errors.New("olap volume size should not be less than 10")
}
return nil
}

Expand All @@ -88,9 +91,10 @@ func newClusterCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command {
}
cmd = DisableHelp(cmd)
f := cmd.Flags()
f.IntVarP(&c.clusterOpts.DataVolume, "data-volume", "v", 32, "total raw data volumes of the ninecluster,default uint Gi, e.g. 16")
f.IntVarP(&c.clusterOpts.DataVolume, "data-volume", "v", 32, "total raw data volumes of the ninecluster,the unit is Gi, e.g. 16")
f.StringVarP(&c.clusterOpts.Olap, "olap", "a", "", fmt.Sprintf("add olap to the ninecluster,support [%s]", olapsSupported))
f.IntVar(&c.clusterOpts.OlapVolume, "olap-volume", 100, "olap storage volume size")
f.BoolVar(&DEBUG, "debug", false, "print debug information")
f.StringVarP(&c.clusterOpts.NS, "namespace", "n", "", "k8s namespace for this ninecluster")
return cmd
}
Expand Down Expand Up @@ -128,7 +132,8 @@ func (c *createCmd) run(_ []string) error {
if c.clusterOpts.Olap != "" {
features[FeaturesOlapKey] = c.clusterOpts.Olap
userClusterSet = make([]nineinfrav1alpha1.ClusterInfo, 0)
DefaultDorisBEStoragePVSize = c.clusterOpts.OlapVolume
DorisBeClusterInfo.Resource.ResourceRequirements.Requests["storage"] =
*resource.NewQuantity(int64(c.clusterOpts.OlapVolume*GiMultiplier), resource.BinarySI)
userClusterSet = append(userClusterSet, DorisBeClusterInfo)
}
desiredNineCluster := &nineinfrav1alpha1.NineCluster{
Expand All @@ -148,6 +153,10 @@ func (c *createCmd) run(_ []string) error {
return errors.New("NineCluster:" + c.clusterOpts.Name + " already exists in namespace:" + c.clusterOpts.NS + "!")
}

if DEBUG {
fmt.Printf("Start to create a nine cluster,detail info:%v\n", desiredNineCluster)
}

_, err = nc.NineinfraV1alpha1().NineClusters(c.clusterOpts.NS).Create(context.TODO(), desiredNineCluster, metav1.CreateOptions{})
if err != nil {
return err
Expand Down

0 comments on commit f91d40f

Please sign in to comment.