mirror of
https://github.com/chrislusf/seaweedfs
synced 2025-09-08 12:22:46 +02:00
Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
63f4bc64a3 | ||
|
0ac3c65480 | ||
|
b3b1316b54 | ||
|
cd78e653e1 | ||
|
e030530aab |
10 changed files with 33 additions and 9 deletions
|
@ -15,7 +15,6 @@ spec:
|
|||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: objectstorage-provisioner
|
||||
template:
|
||||
|
|
|
@ -96,13 +96,16 @@ Inject extra environment vars in the format key:value, if populated
|
|||
{{/* Computes the container image name for all components (if they are not overridden) */}}
|
||||
{{- define "common.image" -}}
|
||||
{{- $registryName := default .Values.image.registry .Values.global.registry | toString -}}
|
||||
{{- $repositoryName := .Values.image.repository | toString -}}
|
||||
{{- $repositoryName := default .Values.image.repository .Values.global.repository | toString -}}
|
||||
{{- $name := .Values.global.imageName | toString -}}
|
||||
{{- $tag := default .Chart.AppVersion .Values.image.tag | toString -}}
|
||||
{{- if $repositoryName -}}
|
||||
{{- $name = printf "%s/%s" (trimSuffix "/" $repositoryName) (base $name) -}}
|
||||
{{- end -}}
|
||||
{{- if $registryName -}}
|
||||
{{- printf "%s/%s%s:%s" $registryName $repositoryName $name $tag -}}
|
||||
{{- printf "%s/%s:%s" $registryName $name $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s%s:%s" $repositoryName $name $tag -}}
|
||||
{{- printf "%s:%s" $name $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ metadata:
|
|||
{{- with $.Values.global.monitoring.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.volume.annotations }}
|
||||
{{- with $volume.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.volume.annotations | nindent 4 }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
global:
|
||||
createClusterRole: true
|
||||
registry: ""
|
||||
# if repository is set, it overrides the namespace part of imageName
|
||||
repository: ""
|
||||
imageName: chrislusf/seaweedfs
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
|
|
@ -50,6 +50,7 @@ copy_2 = 6 # create 2 x 6 = 12 actual volumes
|
|||
copy_3 = 3 # create 3 x 3 = 9 actual volumes
|
||||
copy_other = 1 # create n x 1 = n actual volumes
|
||||
threshold = 0.9 # create threshold
|
||||
disable = false # disables volume growth if true
|
||||
|
||||
# configuration flags for replication
|
||||
[master.replication]
|
||||
|
|
|
@ -89,7 +89,7 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
|
|||
|
||||
for time.Now().Sub(startTime) < maxTimeout {
|
||||
fid, count, dnList, shouldGrow, err := ms.Topo.PickForWrite(req.Count, option, vl)
|
||||
if shouldGrow && !vl.HasGrowRequest() {
|
||||
if shouldGrow && !vl.HasGrowRequest() && !ms.option.VolumeGrowthDisabled {
|
||||
if err != nil && ms.Topo.AvailableSpaceFor(option) <= 0 {
|
||||
err = fmt.Errorf("%s and no free volumes left for %s", err.Error(), option.String())
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ const (
|
|||
)
|
||||
|
||||
func (ms *MasterServer) DoAutomaticVolumeGrow(req *topology.VolumeGrowRequest) {
|
||||
if ms.option.VolumeGrowthDisabled {
|
||||
glog.V(1).Infof("automatic volume grow disabled")
|
||||
return
|
||||
}
|
||||
glog.V(1).Infoln("starting automatic volume grow")
|
||||
start := time.Now()
|
||||
newVidLocations, err := ms.vg.AutomaticGrowByType(req.Option, ms.grpcDialOption, ms.Topo, req.Count)
|
||||
|
|
|
@ -57,6 +57,7 @@ type MasterOption struct {
|
|||
IsFollower bool
|
||||
TelemetryUrl string
|
||||
TelemetryEnabled bool
|
||||
VolumeGrowthDisabled bool
|
||||
}
|
||||
|
||||
type MasterServer struct {
|
||||
|
@ -105,6 +106,9 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.Se
|
|||
v.SetDefault("master.volume_growth.copy_3", topology.VolumeGrowStrategy.Copy3Count)
|
||||
v.SetDefault("master.volume_growth.copy_other", topology.VolumeGrowStrategy.CopyOtherCount)
|
||||
v.SetDefault("master.volume_growth.threshold", topology.VolumeGrowStrategy.Threshold)
|
||||
v.SetDefault("master.volume_growth.disable", false)
|
||||
option.VolumeGrowthDisabled = v.GetBool("master.volume_growth.disable")
|
||||
|
||||
topology.VolumeGrowStrategy.Copy1Count = v.GetUint32("master.volume_growth.copy_1")
|
||||
topology.VolumeGrowStrategy.Copy2Count = v.GetUint32("master.volume_growth.copy_2")
|
||||
topology.VolumeGrowStrategy.Copy3Count = v.GetUint32("master.volume_growth.copy_3")
|
||||
|
|
|
@ -142,7 +142,7 @@ func (ms *MasterServer) dirAssignHandler(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
for time.Since(startTime) < maxTimeout {
|
||||
fid, count, dnList, shouldGrow, err := ms.Topo.PickForWrite(requestedCount, option, vl)
|
||||
if shouldGrow && !vl.HasGrowRequest() {
|
||||
if shouldGrow && !vl.HasGrowRequest() && !ms.option.VolumeGrowthDisabled {
|
||||
glog.V(0).Infof("dirAssign volume growth %v from %v", option.String(), r.RemoteAddr)
|
||||
if err != nil && ms.Topo.AvailableSpaceFor(option) <= 0 {
|
||||
err = fmt.Errorf("%s and no free volumes left for %s", err.Error(), option.String())
|
||||
|
|
|
@ -250,7 +250,19 @@ func collectStatForOneVolume(vid needle.VolumeId, v *Volume) (s *VolumeInfo) {
|
|||
DiskId: v.diskId,
|
||||
}
|
||||
s.RemoteStorageName, s.RemoteStorageKey = v.RemoteStorageNameKey()
|
||||
s.Size, _, _ = v.FileStat()
|
||||
|
||||
v.dataFileAccessLock.RLock()
|
||||
defer v.dataFileAccessLock.RUnlock()
|
||||
|
||||
if v.nm == nil {
|
||||
return
|
||||
}
|
||||
|
||||
s.FileCount = v.nm.FileCount()
|
||||
s.DeleteCount = v.nm.DeletedCount()
|
||||
s.DeletedByteCount = v.nm.DeletedSize()
|
||||
s.Size = v.nm.ContentSize()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue