forked from fluid-cloudnative/fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support HCFS (fluid-cloudnative#256)
* Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Update spec, to #29833753 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Update spec, to #29833753 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Support HCFS, Fix #30651485 * Support HCFS, To #30960673 * Support HCFS, To #30960673 * Support HCFS, To #30960673
- Loading branch information
Showing
14 changed files
with
249 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
|
||
### Features | ||
|
||
- Show the HCFS Access Endpoint | ||
|
||
|
||
### Bugs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ | |
|
||
* Add debug info for csi | ||
* Make mount root configurable | ||
* Update HCFS URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package alluxio | ||
|
||
import ( | ||
"fmt" | ||
|
||
datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1" | ||
"github.com/fluid-cloudnative/fluid/pkg/ddc/alluxio/operations" | ||
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient" | ||
) | ||
|
||
// Query the hcfs status | ||
func (e *AlluxioEngine) GetHCFSStatus() (status *datav1alpha1.HCFSStatus, err error) { | ||
endpoint, err := e.queryHCFSEndpoint() | ||
if err != nil { | ||
e.Log.Error(err, "Failed to get HCFS Endpoint") | ||
return status, err | ||
} | ||
|
||
version, err := e.queryCompatibleUFSVersion() | ||
if err != nil { | ||
e.Log.Error(err, "Failed to get Compatiable Endpoint") | ||
return status, err | ||
} | ||
|
||
status = &datav1alpha1.HCFSStatus{ | ||
Endpoint: endpoint, | ||
UnderlayerFileSystemVersion: version, | ||
} | ||
return | ||
} | ||
|
||
// query the hcfs endpoint | ||
func (e *AlluxioEngine) queryHCFSEndpoint() (endpoint string, err error) { | ||
|
||
var ( | ||
serviceName = fmt.Sprintf("%s-master-0", e.name) | ||
host = fmt.Sprintf("%s.%s", serviceName, e.namespace) | ||
) | ||
|
||
svc, err := kubeclient.GetServiceByName(e.Client, serviceName, e.namespace) | ||
if err != nil { | ||
e.Log.Error(err, "Failed to get Endpoint") | ||
return endpoint, err | ||
} | ||
|
||
if svc == nil { | ||
e.Log.Error(fmt.Errorf("Failed to find the svc %s in %s", e.name, e.namespace), "Failed to find the svc, it's nil") | ||
return | ||
} | ||
|
||
for _, port := range svc.Spec.Ports { | ||
if port.Name == "rpc" { | ||
endpoint = fmt.Sprintf("alluxio://%s:%d", host, port.Port) | ||
return | ||
} | ||
} | ||
|
||
return | ||
} | ||
|
||
// query the compatible version of UFS | ||
func (e *AlluxioEngine) queryCompatibleUFSVersion() (version string, err error) { | ||
podName, containerName := e.getMasterPodInfo() | ||
fileUtils := operations.NewAlluxioFileUtils(podName, containerName, e.namespace, e.Log) | ||
|
||
version, err = fileUtils.GetConf("alluxio.underfs.version") | ||
if err != nil { | ||
e.Log.Error(err, "Failed to getConf") | ||
return | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package operations | ||
|
||
import "fmt" | ||
|
||
// Get Conf info of the Alluxio Engine | ||
func (a AlluxioFileUtils) GetConf(key string) (value string, err error) { | ||
var ( | ||
command = []string{"alluxio", "getConf", key} | ||
stdout string | ||
stderr string | ||
) | ||
|
||
stdout, stderr, err = a.exec(command, false) | ||
if err != nil { | ||
err = fmt.Errorf("execute command %v with expectedErr: %v stdout %s and stderr %s", command, err, stdout, stderr) | ||
return stdout, err | ||
} | ||
return stdout, err | ||
} |
Oops, something went wrong.