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

[BugFix #1551] change mountTime to *v1.Time #1610

Merged
merged 4 commits into from
Apr 7, 2022
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
4 changes: 2 additions & 2 deletions api/v1alpha1/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ type RuntimeStatus struct {
APIGatewayStatus *APIGatewayStatus `json:"apiGateway,omitempty"`

// MountTime represents time last mount happened
// if Mounttime is early than master starting time, remount will be required
MountTime metav1.Time `json:"mountTime,omitempty"`
// if Mounttime is earlier than master starting time, remount will be required
MountTime *metav1.Time `json:"mountTime,omitempty"`
Nizifan marked this conversation as resolved.
Show resolved Hide resolved
}

type RuntimePhase string
Expand Down
5 changes: 5 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
53 changes: 53 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ spec:
apiGateway:
description: The component spec of GooseFS API Gateway
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -174,6 +182,14 @@ spec:
fuse:
description: The component spec of GooseFS Fuse
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
args:
description: Arguments that will be passed to GooseFS Fuse
items:
Expand Down Expand Up @@ -332,6 +348,14 @@ spec:
jobMaster:
description: The component spec of GooseFS job master
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -405,6 +429,14 @@ spec:
jobWorker:
description: The component spec of GooseFS job Worker
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -483,6 +515,14 @@ spec:
master:
description: The component spec of GooseFS master
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -649,6 +689,14 @@ spec:
worker:
description: The component spec of GooseFS worker
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -840,6 +888,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
5 changes: 5 additions & 0 deletions charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
2 changes: 1 addition & 1 deletion charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ spec:
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is early than master starting time, remount will be required
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/data.fluid.io_alluxioruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
53 changes: 53 additions & 0 deletions config/crd/bases/data.fluid.io_goosefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ spec:
apiGateway:
description: The component spec of GooseFS API Gateway
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -174,6 +182,14 @@ spec:
fuse:
description: The component spec of GooseFS Fuse
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
args:
description: Arguments that will be passed to GooseFS Fuse
items:
Expand Down Expand Up @@ -332,6 +348,14 @@ spec:
jobMaster:
description: The component spec of GooseFS job master
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -405,6 +429,14 @@ spec:
jobWorker:
description: The component spec of GooseFS job Worker
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -483,6 +515,14 @@ spec:
master:
description: The component spec of GooseFS master
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -649,6 +689,14 @@ spec:
worker:
description: The component spec of GooseFS worker
properties:
annotations:
additionalProperties:
type: string
description: 'Annotations is an unstructured key value map stored
with a resource that may be set by external tools to store and
retrieve arbitrary metadata. They are not queryable and should
be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations'
type: object
enabled:
description: Enabled or Disabled for the components. For now,
only API Gateway is enabled or disabled.
Expand Down Expand Up @@ -840,6 +888,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/data.fluid.io_jindoruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ spec:
masterReason:
description: Reason for Master's condition transition
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
description: Selector is used for auto-scaling
type: string
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/data.fluid.io_juicefsruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ spec:
type: string
mountTime:
description: MountTime represents time last mount happened if Mounttime
is early than master starting time, remount will be required
is earlier than master starting time, remount will be required
format: date-time
type: string
selector:
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddc/alluxio/ufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (e *AlluxioEngine) checkIfRemountRequired(ufsToUpdate *utils.UFSToUpdate) {
}

// If mounttime is earlier than master container starttime, remount is necessary
if startedAt != nil && runtime.Status.MountTime.Before(startedAt) {
if startedAt != nil && runtime.Status.MountTime != nil && runtime.Status.MountTime.Before(startedAt) {
e.Log.Info("remount on master restart", "alluxioruntime", e.name)

unmountedPaths, err := e.FindUnmountedUFS()
Expand Down
3 changes: 2 additions & 1 deletion pkg/ddc/alluxio/ufs_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/fluid-cloudnative/fluid/pkg/utils"
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"k8s.io/client-go/util/retry"
)
Expand Down Expand Up @@ -323,7 +324,7 @@ func (e *AlluxioEngine) updateMountTime() {
}

runtimeToUpdate := runtime.DeepCopy()
runtimeToUpdate.Status.MountTime.Time = time.Now()
runtimeToUpdate.Status.MountTime = &metav1.Time{Time: time.Now()}

if !reflect.DeepEqual(runtime.Status, runtimeToUpdate.Status) {
err = e.Client.Status().Update(context.TODO(), runtimeToUpdate)
Expand Down
6 changes: 3 additions & 3 deletions pkg/ddc/alluxio/ufs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func TestUpdateMountTime(t *testing.T) {
Namespace: "default",
},
Status: datav1alpha1.RuntimeStatus{
MountTime: v1.Time{
MountTime: &v1.Time{
Time: yesterday,
},
},
Expand Down Expand Up @@ -482,7 +482,7 @@ func TestCheckIfRemountRequired(t *testing.T) {
Namespace: "default",
},
Status: datav1alpha1.RuntimeStatus{
MountTime: v1.Time{
MountTime: &v1.Time{
Time: yesterday,
},
},
Expand Down Expand Up @@ -518,7 +518,7 @@ func TestCheckIfRemountRequired(t *testing.T) {
Namespace: "default",
},
Status: datav1alpha1.RuntimeStatus{
MountTime: v1.Time{
MountTime: &v1.Time{
Time: yesterday,
},
},
Expand Down