Skip to content

Commit df56d22

Browse files
committed
fix Copilot
Signed-off-by: xliuqq <xlzq1992@gmail.com>
1 parent a29c0b7 commit df56d22

File tree

11 files changed

+87
-17
lines changed

11 files changed

+87
-17
lines changed

api/v1alpha1/cacheruntimeclass_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ type ExecutionEntries struct {
7777
type ExecutionCommonEntry struct {
7878
Command []string `json:"command"`
7979

80-
// Timeout is the timeout(seconds) for the execution entry
81-
Timeout int `json:"timeout,omitempty"`
80+
// TimeoutSeconds is the timeout(seconds) for the execution entry, at least(default) 20 seconds.
81+
TimeoutSeconds int32 `json:"timeout,omitempty"`
8282
}
8383

8484
// EncryptOptionComponentDependency defines the configuration for encrypt option dependency

api/v1alpha1/openapi_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 50 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_cacheruntimeclasses.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ spec:
7272
type: string
7373
type: array
7474
timeout:
75+
format: int32
7576
type: integer
7677
required:
7778
- command
@@ -83,6 +84,7 @@ spec:
8384
type: string
8485
type: array
8586
timeout:
87+
format: int32
8688
type: integer
8789
required:
8890
- command
@@ -3487,6 +3489,7 @@ spec:
34873489
type: string
34883490
type: array
34893491
timeout:
3492+
format: int32
34903493
type: integer
34913494
required:
34923495
- command
@@ -3498,6 +3501,7 @@ spec:
34983501
type: string
34993502
type: array
35003503
timeout:
3504+
format: int32
35013505
type: integer
35023506
required:
35033507
- command
@@ -6902,6 +6906,7 @@ spec:
69026906
type: string
69036907
type: array
69046908
timeout:
6909+
format: int32
69056910
type: integer
69066911
required:
69076912
- command
@@ -6913,6 +6918,7 @@ spec:
69136918
type: string
69146919
type: array
69156920
timeout:
6921+
format: int32
69166922
type: integer
69176923
required:
69186924
- command

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ spec:
7272
type: string
7373
type: array
7474
timeout:
75+
format: int32
7576
type: integer
7677
required:
7778
- command
@@ -83,6 +84,7 @@ spec:
8384
type: string
8485
type: array
8586
timeout:
87+
format: int32
8688
type: integer
8789
required:
8890
- command
@@ -3487,6 +3489,7 @@ spec:
34873489
type: string
34883490
type: array
34893491
timeout:
3492+
format: int32
34903493
type: integer
34913494
required:
34923495
- command
@@ -3498,6 +3501,7 @@ spec:
34983501
type: string
34993502
type: array
35003503
timeout:
3504+
format: int32
35013505
type: integer
35023506
required:
35033507
- command
@@ -6902,6 +6906,7 @@ spec:
69026906
type: string
69036907
type: array
69046908
timeout:
6909+
format: int32
69056910
type: integer
69066911
required:
69076912
- command
@@ -6913,6 +6918,7 @@ spec:
69136918
type: string
69146919
type: array
69156920
timeout:
6921+
format: int32
69166922
type: integer
69176923
required:
69186924
- command

pkg/common/constants.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ const (
184184
PodRoleType = "role"
185185
DataloadPod = "dataload-pod"
186186
NamespaceFluidSystem = "fluid-system"
187-
188-
DefaultNameSpace = "default"
189187
)
190188

191189
const (

pkg/ddc/cache/engine/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (e *CacheEngine) SetupClientInternal(clientValue *common.CacheRuntimeCompon
8282
if len(runtimeToUpdate.Status.Conditions) == 0 {
8383
runtimeToUpdate.Status.Conditions = []datav1alpha1.RuntimeCondition{}
8484
}
85-
cond := utils.NewRuntimeCondition(datav1alpha1.RuntimeMasterInitialized, datav1alpha1.RuntimeMasterInitializedReason,
85+
cond := utils.NewRuntimeCondition(datav1alpha1.RuntimeFusesInitialized, datav1alpha1.RuntimeFusesInitializedReason,
8686
"The client setup finished.", corev1.ConditionTrue)
8787
runtimeToUpdate.Status.Conditions =
8888
utils.UpdateRuntimeCondition(runtimeToUpdate.Status.Conditions,

pkg/ddc/cache/engine/cm.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (e *CacheEngine) generateRuntimeConfigData(runtime *datav1alpha1.CacheRunti
154154
config.Worker = &common.CacheRuntimeComponentConfig{
155155
Enabled: true,
156156
Name: GetComponentName(e.name, common.ComponentTypeWorker),
157-
Replicas: runtime.Spec.Master.Replicas,
157+
Replicas: runtime.Spec.Worker.Replicas,
158158
Options: utils.UnionMapsWithOverride(
159159
utils.UnionMapsWithOverride(runtimeClass.Topology.Worker.Options, runtime.Spec.Options), runtime.Spec.Worker.Options),
160160
}
@@ -165,10 +165,10 @@ func (e *CacheEngine) generateRuntimeConfigData(runtime *datav1alpha1.CacheRunti
165165
}
166166
}
167167
if !runtime.Spec.Client.Disabled {
168-
config.Worker = &common.CacheRuntimeComponentConfig{
169-
Enabled: true,
170-
Name: GetComponentName(e.name, common.ComponentTypeClient),
171-
Replicas: runtime.Spec.Master.Replicas,
168+
config.Client = &common.CacheRuntimeComponentConfig{
169+
Enabled: true,
170+
Name: GetComponentName(e.name, common.ComponentTypeClient),
171+
// Replicas: 1,
172172
Options: utils.UnionMapsWithOverride(
173173
utils.UnionMapsWithOverride(runtimeClass.Topology.Client.Options, runtime.Spec.Options), runtime.Spec.Client.Options),
174174
}

pkg/ddc/cache/engine/transform.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,14 @@ func (e *CacheEngine) addCommonConfigForComponent(commonConfig *CacheRuntimeComp
131131
componentDefinition *datav1alpha1.RuntimeComponentDefinition) error {
132132
componentValue.PodTemplateSpec.Spec.Volumes = append(componentValue.PodTemplateSpec.Spec.Volumes, commonConfig.RuntimeConfigs.RuntimeConfigVolume)
133133

134+
if len(componentValue.PodTemplateSpec.Spec.Containers) == 0 {
135+
return fmt.Errorf("component %s must define at least one container", componentValue.ComponentType)
136+
}
137+
134138
// assume the first container uses the runtime config
135-
componentValue.PodTemplateSpec.Spec.InitContainers[0].VolumeMounts = append(componentValue.PodTemplateSpec.Spec.InitContainers[0].VolumeMounts, commonConfig.RuntimeConfigs.RuntimeConfigVolumeMount)
139+
if len(componentValue.PodTemplateSpec.Spec.InitContainers) > 0 {
140+
componentValue.PodTemplateSpec.Spec.InitContainers[0].VolumeMounts = append(componentValue.PodTemplateSpec.Spec.InitContainers[0].VolumeMounts, commonConfig.RuntimeConfigs.RuntimeConfigVolumeMount)
141+
}
136142
componentValue.PodTemplateSpec.Spec.Containers[0].VolumeMounts = append(componentValue.PodTemplateSpec.Spec.Containers[0].VolumeMounts, commonConfig.RuntimeConfigs.RuntimeConfigVolumeMount)
137143

138144
// other config maps defined in CacheRuntimeClass

pkg/ddc/cache/engine/ufs.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ func (e *CacheEngine) PrepareUFS(entries *datav1alpha1.ExecutionEntries, value *
3434
}
3535

3636
fileUtils := newCacheFileUtils(podName, containerName, e.namespace, e.Log)
37-
err = fileUtils.Mount(mountUfs.Command, time.Duration(mountUfs.Timeout)*time.Second)
37+
38+
// at least 20 seconds
39+
timeoutSeconds := max(mountUfs.TimeoutSeconds, 20)
40+
41+
err = fileUtils.Mount(mountUfs.Command, time.Duration(timeoutSeconds)*time.Second)
3842
if err != nil {
3943
return err
4044
}

0 commit comments

Comments
 (0)