Skip to content

Commit

Permalink
update ETCDUnitSize IN KubeInKubeConfig for virtualcluster design
Browse files Browse the repository at this point in the history
  • Loading branch information
gao12312 committed Aug 23, 2024
1 parent 85ec12c commit 6e38f32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions pkg/apis/kosmos/v1alpha1/virtualcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ type VirtualClusterSpec struct {
// datasource for plugin yaml
// +optional
PluginOptions []PluginOptions `json:"pluginOptions,omitempty"`

//definites the EtcdSize
// +optional
EtcdSize string `json:"etcdSize,omitempty"`
}

// PluginSet specifies enabled and disabled plugins .
Expand Down
9 changes: 5 additions & 4 deletions pkg/kubenest/controlplane/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ func installEtcd(client clientset.Interface, name, namespace string, kubeNestCon

var resourceQuantity resource.Quantity
var err error
if vc.Spec.EtcdSize != "" {
resourceQuantity, err = resource.ParseQuantity(vc.Spec.EtcdSize)

if vc.Spec.KubeInKubeConfig.ETCDUnitSize != "" {
resourceQuantity, err = resource.ParseQuantity(vc.Spec.KubeInKubeConfig.ETCDUnitSize)
if err != nil {
klog.Errorf("Failed to parse etcdSize %s: %v", vc.Spec.EtcdSize, err)
klog.Errorf("Failed to parse etcdSize %s: %v", vc.Spec.KubeInKubeConfig.ETCDUnitSize, err)
return err
}
if resourceQuantity.Value() <= 0 {
klog.Errorf("Invalid vc.spec.etcdSize: must be greater than zero")
klog.Errorf("Invalid vc.Spec.KubeInKubeConfig.ETCDUnitSize: must be greater than zero")
return err
}
resourceQuantity.Set(resourceQuantity.Value())
Expand Down

0 comments on commit 6e38f32

Please sign in to comment.