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"`
|
||||
|
||||
// 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 int `json:"filerCount,omitempty"`
|
||||
|
||||
// S3Count is the number of s3, default to 1
|
||||
S3Count int `json:"s3Count,omitempty"`
|
||||
FilerCount int32 `json:"filerCount,omitempty"`
|
||||
}
|
||||
|
||||
// SeaweedStatus defines the observed state of Seaweed
|
||||
|
|
|
@ -38,16 +38,15 @@ spec:
|
|||
properties:
|
||||
filerCount:
|
||||
description: FilerCount is the number of filers, default to 1
|
||||
format: int32
|
||||
type: integer
|
||||
metricsAddress:
|
||||
description: MetricsAddress is Prometheus gateway address
|
||||
type: string
|
||||
s3Count:
|
||||
description: S3Count is the number of s3, default to 1
|
||||
type: integer
|
||||
volumeServerCount:
|
||||
description: VolumeServerCount is the number of volume servers, default
|
||||
to 1
|
||||
format: int32
|
||||
type: integer
|
||||
type: object
|
||||
status:
|
||||
|
|
|
@ -4,4 +4,5 @@ metadata:
|
|||
name: seaweed1
|
||||
spec:
|
||||
# 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")
|
||||
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)
|
||||
return ReconcileResult(err)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,17 @@ func (r *SeaweedReconciler) ensureVolumeServerStatefulSet(seaweedCR *seaweedv1.S
|
|||
log.Error(err, "Failed to get volume server statefulset")
|
||||
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)
|
||||
return ReconcileResult(err)
|
||||
}
|
||||
|
|
|
@ -57,9 +57,6 @@ func (r *SeaweedReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
|||
if seaweedCR.Spec.FilerCount == 0 {
|
||||
seaweedCR.Spec.FilerCount = 1
|
||||
}
|
||||
if seaweedCR.Spec.S3Count == 0 {
|
||||
seaweedCR.Spec.S3Count = 1
|
||||
}
|
||||
|
||||
if done, result, err = r.ensureMaster(seaweedCR); done {
|
||||
return result, err
|
||||
|
|
Loading…
Reference in New Issue