support adjustable volume count and filer count
This commit is contained in:
parent
30e457b814
commit
a55feda96d
|
@ -32,13 +32,10 @@ type SeaweedSpec struct {
|
||||||
MetricsAddress string `json:"metricsAddress,omitempty"`
|
MetricsAddress string `json:"metricsAddress,omitempty"`
|
||||||
|
|
||||||
// VolumeServerCount is the number of volume servers, default to 1
|
// VolumeServerCount is the number of volume servers, default to 1
|
||||||
VolumeServerCount int `json:"volumeServerCount,omitempty"`
|
VolumeServerCount int32 `json:"volumeServerCount,omitempty"`
|
||||||
|
|
||||||
// FilerCount is the number of filers, default to 1
|
// FilerCount is the number of filers, default to 1
|
||||||
FilerCount int `json:"filerCount,omitempty"`
|
FilerCount int32 `json:"filerCount,omitempty"`
|
||||||
|
|
||||||
// S3Count is the number of s3, default to 1
|
|
||||||
S3Count int `json:"s3Count,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeaweedStatus defines the observed state of Seaweed
|
// SeaweedStatus defines the observed state of Seaweed
|
||||||
|
|
|
@ -38,16 +38,15 @@ spec:
|
||||||
properties:
|
properties:
|
||||||
filerCount:
|
filerCount:
|
||||||
description: FilerCount is the number of filers, default to 1
|
description: FilerCount is the number of filers, default to 1
|
||||||
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
metricsAddress:
|
metricsAddress:
|
||||||
description: MetricsAddress is Prometheus gateway address
|
description: MetricsAddress is Prometheus gateway address
|
||||||
type: string
|
type: string
|
||||||
s3Count:
|
|
||||||
description: S3Count is the number of s3, default to 1
|
|
||||||
type: integer
|
|
||||||
volumeServerCount:
|
volumeServerCount:
|
||||||
description: VolumeServerCount is the number of volume servers, default
|
description: VolumeServerCount is the number of volume servers, default
|
||||||
to 1
|
to 1
|
||||||
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
|
|
|
@ -4,4 +4,5 @@ metadata:
|
||||||
name: seaweed1
|
name: seaweed1
|
||||||
spec:
|
spec:
|
||||||
# Add fields here
|
# Add fields here
|
||||||
foo: bar
|
volumeServerCount: 4
|
||||||
|
filerCount: 2
|
||||||
|
|
|
@ -48,6 +48,17 @@ func (r *SeaweedReconciler) ensureFilerStatefulSet(seaweedCR *seaweedv1.Seaweed)
|
||||||
log.Error(err, "Failed to get filer statefulset")
|
log.Error(err, "Failed to get filer statefulset")
|
||||||
return ReconcileResult(err)
|
return ReconcileResult(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *filerStatefulSet.Spec.Replicas != seaweedCR.Spec.FilerCount {
|
||||||
|
filerStatefulSet.Spec.Replicas = &seaweedCR.Spec.FilerCount
|
||||||
|
if err = r.Update(ctx, filerStatefulSet); err != nil {
|
||||||
|
log.Error(err, "Failed to update filer statefulset", "Namespace", filerStatefulSet.Namespace, "Name", filerStatefulSet.Name)
|
||||||
|
return ReconcileResult(err)
|
||||||
|
}
|
||||||
|
// Deployment created successfully - return and requeue
|
||||||
|
return ReconcileResult(err)
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("Get filer stateful set " + filerStatefulSet.Name)
|
log.Info("Get filer stateful set " + filerStatefulSet.Name)
|
||||||
return ReconcileResult(err)
|
return ReconcileResult(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,17 @@ func (r *SeaweedReconciler) ensureVolumeServerStatefulSet(seaweedCR *seaweedv1.S
|
||||||
log.Error(err, "Failed to get volume server statefulset")
|
log.Error(err, "Failed to get volume server statefulset")
|
||||||
return ReconcileResult(err)
|
return ReconcileResult(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *volumeServerStatefulSet.Spec.Replicas != seaweedCR.Spec.VolumeServerCount {
|
||||||
|
volumeServerStatefulSet.Spec.Replicas = &seaweedCR.Spec.VolumeServerCount
|
||||||
|
if err = r.Update(ctx, volumeServerStatefulSet); err != nil {
|
||||||
|
log.Error(err, "Failed to update volume statefulset", "Namespace", volumeServerStatefulSet.Namespace, "Name", volumeServerStatefulSet.Name)
|
||||||
|
return ReconcileResult(err)
|
||||||
|
}
|
||||||
|
// Deployment created successfully - return and requeue
|
||||||
|
return ReconcileResult(err)
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("Get volume stateful set " + volumeServerStatefulSet.Name)
|
log.Info("Get volume stateful set " + volumeServerStatefulSet.Name)
|
||||||
return ReconcileResult(err)
|
return ReconcileResult(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,6 @@ func (r *SeaweedReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
||||||
if seaweedCR.Spec.FilerCount == 0 {
|
if seaweedCR.Spec.FilerCount == 0 {
|
||||||
seaweedCR.Spec.FilerCount = 1
|
seaweedCR.Spec.FilerCount = 1
|
||||||
}
|
}
|
||||||
if seaweedCR.Spec.S3Count == 0 {
|
|
||||||
seaweedCR.Spec.S3Count = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if done, result, err = r.ensureMaster(seaweedCR); done {
|
if done, result, err = r.ensureMaster(seaweedCR); done {
|
||||||
return result, err
|
return result, err
|
||||||
|
|
Loading…
Reference in New Issue