diff --git a/pkg/ddc/jindofsx/shutdown.go b/pkg/ddc/jindofsx/shutdown.go index 6828db9c6b2..b8291f6231a 100644 --- a/pkg/ddc/jindofsx/shutdown.go +++ b/pkg/ddc/jindofsx/shutdown.go @@ -1,5 +1,5 @@ /* -Copyright 2022 The Fluid Authors. +Copyright 2022 The Fluid Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ddc/vineyard/runtime_info.go b/pkg/ddc/vineyard/runtime_info.go index 76a1084d6da..cda4028c12d 100644 --- a/pkg/ddc/vineyard/runtime_info.go +++ b/pkg/ddc/vineyard/runtime_info.go @@ -25,7 +25,11 @@ func (e *VineyardEngine) getRuntimeInfo() (base.RuntimeInfoInterface, error) { if err != nil { return e.runtimeInfo, err } - + // Add the symlink method to the vineyard runtime metadata + if runtime.ObjectMeta.Annotations == nil { + runtime.ObjectMeta.Annotations = make(map[string]string) + } + runtime.ObjectMeta.Annotations["data.fluid.io/metadataList"] = `[{"Labels": {"fluid.io/node-puhlish-method": "symlink"}, "selector": { "kind": "PersistentVolume"}}]` tieredStore := runtime.Spec.TieredStore e.runtimeInfo, err = base.BuildRuntimeInfo(e.name, e.namespace, e.runtimeType, tieredStore, base.WithMetadataList(base.GetMetadataListFromAnnotation(runtime))) if err != nil { diff --git a/pkg/ddc/vineyard/runtime_info_test.go b/pkg/ddc/vineyard/runtime_info_test.go index 4575254f097..9b035986a5b 100644 --- a/pkg/ddc/vineyard/runtime_info_test.go +++ b/pkg/ddc/vineyard/runtime_info_test.go @@ -14,6 +14,7 @@ limitations under the License. package vineyard import ( + "reflect" "testing" "github.com/fluid-cloudnative/fluid/api/v1alpha1" @@ -44,17 +45,31 @@ func newVineyardEngineRT(client client.Client, name string, namespace string, wi } func TestGetRuntimeInfo(t *testing.T) { + anno := map[string]string{ + "the-key-should-not-be-changed": "the-value-should-not-be-changed", + } + addedMeta := []v1alpha1.Metadata{ + { + PodMetadata: v1alpha1.PodMetadata{ + Labels: map[string]string{"fluid.io/node-puhlish-method": "symlink"}, + }, + Selector: metav1.GroupKind{Kind: "PersistentVolume"}, + }, + } + runtimeInputs := []*v1alpha1.VineyardRuntime{ { ObjectMeta: metav1.ObjectMeta{ - Name: "hbase", - Namespace: "fluid", + Name: "hbase", + Namespace: "fluid", + Annotations: anno, }, }, { ObjectMeta: metav1.ObjectMeta{ - Name: "hadoop", - Namespace: "fluid", + Name: "hadoop", + Namespace: "fluid", + Annotations: anno, }, }, } @@ -150,6 +165,13 @@ func TestGetRuntimeInfo(t *testing.T) { runtimeInfo, err := engine.getRuntimeInfo() isNil := runtimeInfo == nil isErr := err != nil + runtime, _ := engine.getRuntime() + if !reflect.DeepEqual(runtime.Annotations, anno) { + t.Errorf(" want %v, got %v", anno, runtime.Annotations) + } + if !testCase.withRuntimeInfo && !reflect.DeepEqual(runtimeInfo.GetMetadataList(), addedMeta) { + t.Errorf(" want %v, got %v", addedMeta, runtimeInfo.GetMetadataList()) + } if isNil != testCase.isNil { t.Errorf(" want %t, got %t", testCase.isNil, isNil) }