diff --git a/api/v1alpha1/status.go b/api/v1alpha1/status.go index 08421e61d32..1e66106c1a5 100644 --- a/api/v1alpha1/status.go +++ b/api/v1alpha1/status.go @@ -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"` } type RuntimePhase string diff --git a/charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml b/charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml index dbb5999605b..d36776efd0e 100644 --- a/charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml +++ b/charts/fluid/fluid/crds/data.fluid.io_alluxioruntimes.yaml @@ -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 diff --git a/charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml b/charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml index 54a430ff5c7..4bd907f636b 100644 --- a/charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml +++ b/charts/fluid/fluid/crds/data.fluid.io_goosefsruntimes.yaml @@ -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. @@ -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: @@ -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. @@ -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. @@ -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. @@ -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. @@ -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 diff --git a/charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml b/charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml index dcf2ef2c7e7..6e40518a1e5 100644 --- a/charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml +++ b/charts/fluid/fluid/crds/data.fluid.io_jindoruntimes.yaml @@ -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 diff --git a/charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml b/charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml index 15a0199994f..6e0c99c86f3 100644 --- a/charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml +++ b/charts/fluid/fluid/crds/data.fluid.io_juicefsruntimes.yaml @@ -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: diff --git a/config/crd/bases/data.fluid.io_alluxioruntimes.yaml b/config/crd/bases/data.fluid.io_alluxioruntimes.yaml index dbb5999605b..d36776efd0e 100644 --- a/config/crd/bases/data.fluid.io_alluxioruntimes.yaml +++ b/config/crd/bases/data.fluid.io_alluxioruntimes.yaml @@ -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 diff --git a/config/crd/bases/data.fluid.io_goosefsruntimes.yaml b/config/crd/bases/data.fluid.io_goosefsruntimes.yaml index 54a430ff5c7..4bd907f636b 100644 --- a/config/crd/bases/data.fluid.io_goosefsruntimes.yaml +++ b/config/crd/bases/data.fluid.io_goosefsruntimes.yaml @@ -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. @@ -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: @@ -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. @@ -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. @@ -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. @@ -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. @@ -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 diff --git a/config/crd/bases/data.fluid.io_jindoruntimes.yaml b/config/crd/bases/data.fluid.io_jindoruntimes.yaml index dcf2ef2c7e7..6e40518a1e5 100644 --- a/config/crd/bases/data.fluid.io_jindoruntimes.yaml +++ b/config/crd/bases/data.fluid.io_jindoruntimes.yaml @@ -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 diff --git a/config/crd/bases/data.fluid.io_juicefsruntimes.yaml b/config/crd/bases/data.fluid.io_juicefsruntimes.yaml index 15a0199994f..6e0c99c86f3 100644 --- a/config/crd/bases/data.fluid.io_juicefsruntimes.yaml +++ b/config/crd/bases/data.fluid.io_juicefsruntimes.yaml @@ -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: diff --git a/pkg/ddc/alluxio/ufs.go b/pkg/ddc/alluxio/ufs.go index 22a63d9f6d5..716352f11bf 100644 --- a/pkg/ddc/alluxio/ufs.go +++ b/pkg/ddc/alluxio/ufs.go @@ -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() diff --git a/pkg/ddc/alluxio/ufs_internal.go b/pkg/ddc/alluxio/ufs_internal.go index 517a35edd5f..3f1b1ec8552 100644 --- a/pkg/ddc/alluxio/ufs_internal.go +++ b/pkg/ddc/alluxio/ufs_internal.go @@ -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" ) @@ -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) diff --git a/pkg/ddc/alluxio/ufs_test.go b/pkg/ddc/alluxio/ufs_test.go index e06fa711c51..4318f1c55d5 100644 --- a/pkg/ddc/alluxio/ufs_test.go +++ b/pkg/ddc/alluxio/ufs_test.go @@ -431,7 +431,7 @@ func TestUpdateMountTime(t *testing.T) { Namespace: "default", }, Status: datav1alpha1.RuntimeStatus{ - MountTime: v1.Time{ + MountTime: &v1.Time{ Time: yesterday, }, }, @@ -482,7 +482,7 @@ func TestCheckIfRemountRequired(t *testing.T) { Namespace: "default", }, Status: datav1alpha1.RuntimeStatus{ - MountTime: v1.Time{ + MountTime: &v1.Time{ Time: yesterday, }, }, @@ -518,7 +518,7 @@ func TestCheckIfRemountRequired(t *testing.T) { Namespace: "default", }, Status: datav1alpha1.RuntimeStatus{ - MountTime: v1.Time{ + MountTime: &v1.Time{ Time: yesterday, }, },