Skip to content

Commit 8b1219d

Browse files
author
jiuyu
committed
Feat: support Runtime Fuse UpdateStrategy - OnIdle
Signed-off-by: 玖宇 <guotongyu.gty@alibaba-inc.com>
1 parent 441d216 commit 8b1219d

46 files changed

Lines changed: 1250 additions & 327 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/v1alpha1/constant.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,16 @@ const (
5353
// OnRuntimeDeletedCleanPolicy cleans fuse pod only when the cache runtime is deleted
5454
OnRuntimeDeletedCleanPolicy FuseCleanPolicy = "OnRuntimeDeleted"
5555
)
56+
57+
type FuseUpdateStrategy string
58+
59+
const (
60+
// NoneFuseUpdateStrategy is the default clean policy. It will be transformed to OnDeleteFuseUpdateStrategy automatically.
61+
NoneFuseUpdateStrategy FuseUpdateStrategy = ""
62+
63+
// OnDeleteFuseUpdateStrategy cleans fuse pod once th fuse pod on some node is deleted
64+
OnDeleteFuseUpdateStrategy FuseUpdateStrategy = "OnDelete"
65+
66+
// OnIdleFuseUpdateStrategy cleans fuse pod once th fuse pod on some node is in idle
67+
OnIdleFuseUpdateStrategy FuseUpdateStrategy = "OnIdle"
68+
)

api/v1alpha1/juicefsruntime_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ type JuiceFSFuseSpec struct {
164164
// +optional
165165
CleanPolicy FuseCleanPolicy `json:"cleanPolicy,omitempty"`
166166

167+
// UpdateStrategy decides when to update Fuse pods.
168+
// Currently Fluid supports two UpdateStrategy: OnDelete and OnIdle
169+
// OnDelete update fuse pod by native daemonset once the fuse pod on some node is deleted
170+
// OnIdle update fuse pod once the fuse pod on some node is in idle
171+
// Defaults to OnDelete
172+
// +optional
173+
UpdateStrategy FuseUpdateStrategy `json:"updateStrategy,omitempty"`
174+
167175
// PodMetadata defines labels and annotations that will be propagated to JuiceFs's pods.
168176
// +optional
169177
PodMetadata PodMetadata `json:"podMetadata,omitempty"`

api/v1alpha1/openapi_generated.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ spec:
328328
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
329329
type: object
330330
type: object
331+
updateStrategy:
332+
description: |-
333+
UpdateStrategy decides when to update Fuse pods.
334+
Currently Fluid supports two UpdateStrategy: OnDelete and OnIdle
335+
OnDelete update fuse pod by native daemonset once the fuse pod on some node is deleted
336+
OnIdle update fuse pod once the fuse pod on some node is in idle
337+
Defaults to OnDelete
338+
type: string
331339
volumeMounts:
332340
description: VolumeMounts specifies the volumes listed in ".spec.volumes"
333341
to mount into runtime component's filesystem.

charts/juicefs/templates/fuse/daemonset.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ spec:
150150
- name: juicefs-fuse-mount
151151
mountPath: {{ .Values.fuse.hostMountPath }}
152152
mountPropagation: Bidirectional
153+
{{/* - name: juicefs-fuse-meta*/}}
154+
{{/* mountPath: {{ .Values.fuse.hostMetaPath }}*/}}
155+
- name: juicefs-fuse-labels
156+
mountPath: {{ .Values.fuse.hostMountPath }}/.meta/fuse/
153157
- mountPath: /root/script
154158
name: script
155159
{{- if .Values.fuse.volumeMounts }}
@@ -161,6 +165,12 @@ spec:
161165
hostPath:
162166
path: {{ .Values.fuse.hostMountPath }}
163167
type: DirectoryOrCreate
168+
- name: juicefs-fuse-labels
169+
downwardAPI:
170+
items:
171+
- path: labels
172+
fieldRef:
173+
fieldPath: metadata.labels
164174
- name: script
165175
configMap:
166176
name: {{ template "juicefs.fullname" . }}-fuse-script

charts/juicefs/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ fuse:
9595
mountPath: /mnt/jfs
9696
cacheDir: ""
9797
hostMountPath: /mnt/jfs
98+
hostMetaPath: /mnt/.meta
9899
command: "/usr/local/bin/juicefs mount /mnt/jfs"
99100
statCmd: "stat -c %i /mnt/jfs"
100101
updateStrategy:

config/crd/bases/data.fluid.io_juicefsruntimes.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ spec:
328328
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
329329
type: object
330330
type: object
331+
updateStrategy:
332+
description: |-
333+
UpdateStrategy decides when to update Fuse pods.
334+
Currently Fluid supports two UpdateStrategy: OnDelete and OnIdle
335+
OnDelete update fuse pod by native daemonset once the fuse pod on some node is deleted
336+
OnIdle update fuse pod once the fuse pod on some node is in idle
337+
Defaults to OnDelete
338+
type: string
331339
volumeMounts:
332340
description: VolumeMounts specifies the volumes listed in ".spec.volumes"
333341
to mount into runtime component's filesystem.

pkg/common/constants.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ const (
156156
AccelerateCategory Category = "Accelerate"
157157
)
158158

159-
var (
160-
ExpectedFluidAnnotations = map[string]string{
159+
func GetExpectedFluidAnnotations() map[string]string {
160+
return map[string]string{
161161
"CreatedBy": "fluid",
162162
}
163-
)
163+
}
164164

165165
const (
166166
FluidExclusiveKey string = "fluid_exclusive"

pkg/common/env_names.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const (
2525

2626
EnvRuntimeInfoCacheSize = "RUNTIMEINFO_CACHE_SIZE"
2727

28+
EnvRuntimeFuseImageVersion = "RUNTIMEINFO_FUSE_IMAGE_VERSION"
29+
2830
EnvEnableRuntimeInfoCache = "ENABLE_RUNTIMEINFO_CACHE"
2931

3032
EnvRuntimeInfoCacheTTL = "RUNTIMEINFO_CACHE_TTL"

pkg/common/label.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const (
8383
)
8484

8585
const (
86+
// i.e. fuse.runtime.fluid.io/image-version
87+
AnnotationRuntimeFuseGeneration = "fuse.runtime." + LabelAnnotationPrefix + "generation"
88+
8689
// i.e. controller.runtime.fluid.io/replicas
8790
RuntimeControllerReplicas = "controller.runtime." + LabelAnnotationPrefix + "replicas"
8891

0 commit comments

Comments
 (0)