Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default value for clean cache #2529

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@ type CleanCachePolicy struct {
// The grace period is the duration in seconds after the processes running in the pod are sent
// a termination signal and the time when the processes are forcibly halted with timeout command.
// Set this value longer than the expected cleanup time for your process.
// +kubebuilder:default=60
// +optional
GracePeriodSeconds *int32 `json:"gracePeriodSeconds,omitempty"`

// Optional max retry Attempts when cleanCache function returns an error after execution, runtime attempts
// to run it three more times by default. With Maximum Retry Attempts, you can customize the maximum number
// of retries. This gives you the option to continue processing retries.
// +kubebuilder:default=3
// +optional
MaxRetryAttempts *int32 `json:"maxRetryAttempts,omitempty"`
}
2 changes: 1 addition & 1 deletion charts/fluid/fluid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version: 0.9.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.9.0-d4ca4e7
appVersion: 0.9.0-ba4c973
home: https://github.com/fluid-cloudnative/fluid
keywords:
- category:data
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -248,6 +249,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_eacruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -93,6 +94,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -178,6 +179,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -93,6 +94,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -82,6 +83,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
28 changes: 14 additions & 14 deletions charts/fluid/fluid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

workdir: /tmp
crdUpgrade:
image: fluidcloudnative/fluid-crd-upgrader:v0.9.0-d4ca4e7
image: fluidcloudnative/fluid-crd-upgrader:v0.9.0-ba4c973

image:
imagePullSecrets: []

dataset:
replicas: 1
controller:
image: fluidcloudnative/dataset-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/dataset-controller:v0.9.0-ba4c973

csi:
featureGates: "FuseRecovery=false"
Expand All @@ -21,7 +21,7 @@ csi:
registrar:
image: registry.aliyuncs.com/acs/csi-node-driver-registrar:v2.3.0-038aeb6-aliyun
plugins:
image: fluidcloudnative/fluid-csi:v0.9.0-d4ca4e7
image: fluidcloudnative/fluid-csi:v0.9.0-ba4c973
kubelet:
rootDir: /var/lib/kubelet
pruneFs: fuse.alluxio-fuse,fuse.jindofs-fuse,fuse.juicefs,fuse.goosefs-fuse,ossfs
Expand All @@ -37,9 +37,9 @@ runtime:
portAllocatePolicy: bitmap
enabled: false
init:
image: fluidcloudnative/init-users:v0.9.0-d4ca4e7
image: fluidcloudnative/init-users:v0.9.0-ba4c973
controller:
image: fluidcloudnative/alluxioruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/alluxioruntime-controller:v0.9.0-ba4c973
runtime:
image: alluxio/alluxio-dev:2.9.0
fuse:
Expand All @@ -56,20 +56,20 @@ runtime:
fuse:
image: registry.cn-shanghai.aliyuncs.com/jindofs/jindo-fuse:4.5.2
controller:
image: fluidcloudnative/jindoruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/jindoruntime-controller:v0.9.0-ba4c973
init:
portCheck:
enabled: false
image: fluidcloudnative/init-users:v0.9.0-d4ca4e7
image: fluidcloudnative/init-users:v0.9.0-ba4c973
goosefs:
replicas: 1
runtimeWorkers: 3
portRange: 26000-32000
enabled: false
init:
image: fluidcloudnative/init-users:v0.9.0-d4ca4e7
image: fluidcloudnative/init-users:v0.9.0-ba4c973
controller:
image: fluidcloudnative/goosefsruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/goosefsruntime-controller:v0.9.0-ba4c973
runtime:
image: ccr.ccs.tencentyun.com/qcloud/goosefs:v1.2.0
fuse:
Expand All @@ -78,19 +78,19 @@ runtime:
replicas: 1
enabled: false
controller:
image: fluidcloudnative/juicefsruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/juicefsruntime-controller:v0.9.0-ba4c973
fuse:
image: juicedata/juicefs-fuse:v1.0.0-4.8.0
thin:
replicas: 1
enabled: false
controller:
image: fluidcloudnative/thinruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/thinruntime-controller:v0.9.0-ba4c973
eac:
replicas: 1
enabled: false
controller:
image: fluidcloudnative/eacruntime-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/eacruntime-controller:v0.9.0-ba4c973
imagePullPolicy: Always
init:
image: registry.cn-zhangjiakou.aliyuncs.com/nascache/init-alifuse:v0.1.0-196d2b1
Expand All @@ -103,12 +103,12 @@ runtime:

webhook:
enabled: true
image: fluidcloudnative/fluid-webhook:v0.9.0-d4ca4e7
image: fluidcloudnative/fluid-webhook:v0.9.0-ba4c973
replicas: 1
timeoutSeconds: 15

fluidapp:
enabled: true
replicas: 1
controller:
image: fluidcloudnative/application-controller:v0.9.0-d4ca4e7
image: fluidcloudnative/application-controller:v0.9.0-ba4c973
2 changes: 2 additions & 0 deletions config/crd/bases/data.fluid.io_alluxioruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -248,6 +249,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/data.fluid.io_eacruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -93,6 +94,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/data.fluid.io_goosefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -178,6 +179,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/data.fluid.io_jindoruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -93,6 +94,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/data.fluid.io_juicefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ spec:
description: CleanCachePolicy defines cleanCache Policy
properties:
gracePeriodSeconds:
default: 60
description: Optional duration in seconds the cache needs to clean
gracefully. May be decreased in delete runtime request. Value
must be non-negative integer. The value zero indicates clean
Expand All @@ -82,6 +83,7 @@ spec:
format: int32
type: integer
maxRetryAttempts:
default: 3
description: Optional max retry Attempts when cleanCache function
returns an error after execution, runtime attempts to run it
three more times by default. With Maximum Retry Attempts, you
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddc/alluxio/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func TestAlluxioEngine_getGracefulShutdownLimits(t *testing.T) {
Spec: datav1alpha1.AlluxioRuntimeSpec{},
},
},
wantGracefulShutdownLimits: 5,
wantGracefulShutdownLimits: 3,
wantErr: false,
}, {
name: "clean_cache_policy",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddc/alluxio/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ const (
wokrerPodRole = "alluxio-worker"

// defaultGracefulShutdownLimits is the limit for the system to forcibly clean up.
defaultGracefulShutdownLimits int32 = 5
defaultGracefulShutdownLimits int32 = 3
defaultCleanCacheGracePeriodSeconds int32 = 60
)
3 changes: 1 addition & 2 deletions pkg/ddc/alluxio/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"sort"
"strings"
"time"

"k8s.io/client-go/util/retry"

Expand Down Expand Up @@ -150,7 +149,7 @@ func (e *AlluxioEngine) cleanupCache() (err error) {
e.Log.Info("Clean up the cache successfully")
}

time.Sleep(time.Duration(5 * time.Second))
// time.Sleep(time.Duration(5 * time.Second))
return fmt.Errorf("to make sure if the remaining cache is cleaned up, check again")
}

Expand Down
1 change: 1 addition & 0 deletions samples/accelerate/dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ spec:
mounts:
- mountPoint: https://mirrors.bit.edu.cn/apache/hbase/stable/
name: hbase
path: /
---
apiVersion: data.fluid.io/v1alpha1
kind: AlluxioRuntime
Expand Down