edgefs

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to yu 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2019 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2019 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

* Copyright (c) 2015-2019 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.

Index

Constants

View Source
const (
	EdgefsServiceType_NFS   = "nfs"
	EdgefsServiceType_ISCSI = "iscsi"
)

Variables

This section is empty.

Functions

func DetectEdgefsK8sCluster

func DetectEdgefsK8sCluster(segment string, config *EdgefsClusterConfig) (clusterExists bool, err error)

Will check k8s edgefs cluster existance and will update EdgefsClusterConfig information

func PrepareClusterConfigDefaultValues

func PrepareClusterConfigDefaultValues(config *EdgefsClusterConfig, backendType string) error

Types

type CloneInfo

type CloneInfo struct {
	SourceSnapshotPath string
	SourceObjectPath   string
	CloneObjectPath    string
}

type ClusterData

type ClusterData struct {
	ServicesData []ServiceData
}

ClusterData represents all available(enabled, has networks e.t.c) services and its NFS and ISCSI volumes on cluster or among the listed in serviceFilter (if serviceFilter option specified)

func (*ClusterData) FindApropriateServiceData

func (clusterData *ClusterData) FindApropriateServiceData(serviceBalancingPolicy string) (*ServiceData, error)

FindApropriateService find service with balancing policy

func (*ClusterData) FindServiceDataByServiceName

func (clusterData *ClusterData) FindServiceDataByServiceName(serviceName string) (serviceData *ServiceData, err error)

func (*ClusterData) FindServiceDataByVolumeID

func (clusterData *ClusterData) FindServiceDataByVolumeID(volumeID IVolumeId) (*ServiceData, error)

type EdgeFS

type EdgeFS struct {
	// contains filtered or unexported fields
}

func (*EdgeFS) CreateIscsiVolume

func (edgefs *EdgeFS) CreateIscsiVolume(name, sourceSnapshot string, size int64, options map[string]string) (string, error)

CreateVolume creates bucket and serve it via edgefs service

func (*EdgeFS) CreateNfsVolume

func (edgefs *EdgeFS) CreateNfsVolume(csiVolumeID string, size int, options map[string]string) (string, error)

CreateVolume creates bucket and serve it via edgefs service

func (*EdgeFS) CreateObjectSnapshot

func (edgefs *EdgeFS) CreateObjectSnapshot(csiVolumeID, snapName string) (SnapshotInfo, error)

func (*EdgeFS) DeleteIscsiVolume

func (edgefs *EdgeFS) DeleteIscsiVolume(volumeID *IscsiVolumeId) (err error)

DeleteIscsiVolume remotely deletes object on edgefs service

func (*EdgeFS) DeleteNfsVolume

func (edgefs *EdgeFS) DeleteNfsVolume(volumeID *NfsVolumeId) (err error)

DeleteVolume remotely deletes bucket on edgefs service

func (*EdgeFS) DeleteObjectSnapshot

func (edgefs *EdgeFS) DeleteObjectSnapshot(csiSnapshotID string) error

func (*EdgeFS) GetClusterConfig

func (edgefs *EdgeFS) GetClusterConfig() (config *EdgefsClusterConfig)

func (*EdgeFS) GetClusterData

func (edgefs *EdgeFS) GetClusterData(serviceName ...string) (ClusterData, error)

GetClusterData if serviceName specified we will get data from the one service only

func (*EdgeFS) GetK8sEdgefsService

func (edgefs *EdgeFS) GetK8sEdgefsService(serviceName string) (resultService IK8SEdgefsService, err error)

func (*EdgeFS) GetSegment

func (edgefs *EdgeFS) GetSegment() string

func (*EdgeFS) IsBucketExists

func (edgefs *EdgeFS) IsBucketExists(clusterName, tenantName, bucketName string) bool

func (*EdgeFS) IsClusterExists

func (edgefs *EdgeFS) IsClusterExists(clusterName string) bool

func (*EdgeFS) IsTenantExists

func (edgefs *EdgeFS) IsTenantExists(clusterName, tenantName string) bool

func (*EdgeFS) ListObjectSnapshots

func (edgefs *EdgeFS) ListObjectSnapshots(csiVolumeID, pattern string) ([]SnapshotInfo, error)

func (*EdgeFS) ListServices

func (edgefs *EdgeFS) ListServices(serviceName ...string) (resultServices []IEdgefsService, err error)

func (*EdgeFS) ListVolumes

func (edgefs *EdgeFS) ListVolumes() ([]IEdgefsVolume, error)

ListVolumes list all available volumes

type EdgeFSProvider

type EdgeFSProvider struct {
	// contains filtered or unexported fields
}

func (*EdgeFSProvider) CheckHealth

func (provider *EdgeFSProvider) CheckHealth() (err error)

func (*EdgeFSProvider) CloneVolumeFromSnapshot

func (provider *EdgeFSProvider) CloneVolumeFromSnapshot(cloneVolume IscsiVolumeId, ss IscsiSnapshotId) (CloneInfo, error)

CloneVolumeFromSnapshot(sourceSnapshot SnapshotID, cloneVolume EdgefsIscsiVolume

func (*EdgeFSProvider) CreateBucket

func (provider *EdgeFSProvider) CreateBucket(clusterName string, tenantName string, bucketName string, size int, options map[string]string) (err error)

func (*EdgeFSProvider) CreateSnapshot

func (provider *EdgeFSProvider) CreateSnapshot(ss IscsiSnapshotId) (SnapshotInfo, error)

func (*EdgeFSProvider) DeleteBucket

func (provider *EdgeFSProvider) DeleteBucket(clusterName string, tenantName string, bucketName string, force bool) (err error)

func (*EdgeFSProvider) DeleteSnapshot

func (provider *EdgeFSProvider) DeleteSnapshot(ss IscsiSnapshotId) (err error)

func (*EdgeFSProvider) GetService

func (provider *EdgeFSProvider) GetService(serviceType string, serviceName string) (serviceOut IEdgefsService, err error)

func (*EdgeFSProvider) IsBucketExist

func (provider *EdgeFSProvider) IsBucketExist(clusterName string, tenantName string, bucketName string) bool

func (*EdgeFSProvider) IsSnapshotExists

func (provider *EdgeFSProvider) IsSnapshotExists(ss IscsiSnapshotId) (bool, error)

func (*EdgeFSProvider) ListBuckets

func (provider *EdgeFSProvider) ListBuckets(clusterName string, tenantName string) (buckets []string, err error)

func (*EdgeFSProvider) ListClusters

func (provider *EdgeFSProvider) ListClusters() (clusters []string, err error)

func (*EdgeFSProvider) ListSnapshots

func (provider *EdgeFSProvider) ListSnapshots(volume IscsiVolumeId, pattern string) ([]SnapshotInfo, error)

func (*EdgeFSProvider) ListTenants

func (provider *EdgeFSProvider) ListTenants(clusterName string) (tenants []string, err error)

func (*EdgeFSProvider) ListVolumes

func (provider *EdgeFSProvider) ListVolumes(serviceType, serviceName string) ([]IEdgefsVolume, error)
func (edgefs *EdgeFSProvider) ListServices(backendType string) (services []IEdgefsService, err error) {
	c := service.NewServiceClient(edgefs.conn)
	ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
	defer cancel()

	protocolType, err := edgefs.getProtocolType(backendType)
	if err != nil {
	        return nil, err
        }

	r, err := c.ServiceList(ctx, &service.ServiceListRequest{
		Type: protocolType,
	})

	if err != nil {
		err = fmt.Errorf("ServiceList: %v", err)
		log.Error(err.Error)
		return nil, err
	}

	for _,info := range r.Info {
		var service IEdgefsService
		service, err = edgefs.NewEdgefsService(backendType, info)
                if err != nil {
                        return nil, err
                }
		services = append(services, service)
	}
	return services, nil
}

func (*EdgeFSProvider) ServeBucket

func (provider *EdgeFSProvider) ServeBucket(serviceName, k8sServiceName, k8sNamespace string,
	volume EdgefsNfsVolume, settings VolumeSettings) (objectPath string, rr error)

func (*EdgeFSProvider) ServeObject

func (provider *EdgeFSProvider) ServeObject(serviceName, k8sServiceName, k8sNamespace string, volume EdgefsIscsiVolume, settings VolumeSettings) (objectPath string, err error)

ServeBucket serve object to ISCSI service, returns ISCSI object path lunNumber@cluster/tenant/bucket/lun

func (*EdgeFSProvider) SetBucketQuota

func (provider *EdgeFSProvider) SetBucketQuota(cluster string, tenant string, bucket string, quota string) (err error)

func (*EdgeFSProvider) SetServiceAclConfiguration

func (provider *EdgeFSProvider) SetServiceAclConfiguration(service string, tenant string, bucket string, value string) error

func (*EdgeFSProvider) UnserveBucket

func (provider *EdgeFSProvider) UnserveBucket(serviceName, k8sServiceName, k8sNamespace string,
	volume EdgefsNfsVolume) (err error)

func (*EdgeFSProvider) UnserveObject

func (provider *EdgeFSProvider) UnserveObject(serviceName, k8sService, k8sNamespace string, volume EdgefsIscsiVolume) (err error)

func (*EdgeFSProvider) UnsetServiceAclConfiguration

func (provider *EdgeFSProvider) UnsetServiceAclConfiguration(service string, tenant string, bucket string) error

type EdgefsClusterConfig

type EdgefsClusterConfig struct {
	Name                  string
	K8sClientInCluster    bool
	EdgefsProxyAddr       string
	EdgefsProxyPort       string
	K8sEdgefsNamespaces   []string `yaml:"k8sEdgefsNamespaces"`
	K8sEdgefsMgmtPrefix   string   `yaml:"k8sEdgefsMgmtPrefix"`
	Username              string   `yaml:"username"`
	Password              string   `yaml:"password"`
	Service               string   `yaml:"service"`
	Cluster               string   `yaml:"cluster"`
	Tenant                string   `yaml:"tenant"`
	Bucket                string   `yaml:"bucket"` // optional bucket name for ISCSI volume creation
	ForceVolumeDeletion   bool     `yaml:"forceVolumeDeletion"`
	ServiceFilter         string   `yaml:"serviceFilter"`
	ServiceBalancerPolicy string   `yaml:"serviceBalancerPolicy"`
	MountOptions          string   `yaml:"mountOptions"`

	//ISCSI specific options
	FsType    string `yaml:"fsType"`
	ChunkSize int32  `yaml:"chunksize"`
	BlockSize int32  `yaml:"blocksize"`
}

func LoadEdgefsClusterConfig

func LoadEdgefsClusterConfig(backendType string) (config EdgefsClusterConfig, err error)

func (*EdgefsClusterConfig) GetMountOptions

func (config *EdgefsClusterConfig) GetMountOptions() (options []string)

GetMountOptions

func (*EdgefsClusterConfig) GetSegment

func (config *EdgefsClusterConfig) GetSegment(segment string) (string, error)

func (*EdgefsClusterConfig) GetServiceFilterMap

func (config *EdgefsClusterConfig) GetServiceFilterMap() (filterMap map[string]bool)

type EdgefsIscsiService

type EdgefsIscsiService struct {
	EdgefsService
	/* additional Edgefs ISCSI service props */
	TargetIqn string
}

type EdgefsIscsiVolume

type EdgefsIscsiVolume struct {
	Cluster   string
	Tenant    string
	Bucket    string
	Object    string
	LunNumber uint32
}

func NewEdgefsIscsiVolume

func NewEdgefsIscsiVolume(cluster, tenant, bucket, object string, lunNumber uint32) *EdgefsIscsiVolume

func ParseEdgefsIscsiVolumeStr

func ParseEdgefsIscsiVolumeStr(volume string) (*EdgefsIscsiVolume, error)

ParseEdgefsIscsiVolumeStr parses volume string : 1@cltest/test/bk1/lun1

func (*EdgefsIscsiVolume) GetObjectPath

func (vol *EdgefsIscsiVolume) GetObjectPath() string

func (*EdgefsIscsiVolume) String

func (vol *EdgefsIscsiVolume) String() string

type EdgefsNfsService

type EdgefsNfsService struct {
	EdgefsService
}

type EdgefsNfsVolume

type EdgefsNfsVolume struct {
	Cluster   string
	Tenant    string
	Bucket    string
	MountPath string
}

func NewEdgefsNfsVolume

func NewEdgefsNfsVolume(cluster, tenant, bucket, mountPath string) *EdgefsNfsVolume

func ParseEdgefsNfsVolumeStr

func ParseEdgefsNfsVolumeStr(volume string) (*EdgefsNfsVolume, error)

ParseEdgefsNfsVolumeStr parses volume string 2,test/nfs-test@cltest/test/nfs-test

func (*EdgefsNfsVolume) GetObjectPath

func (vol *EdgefsNfsVolume) GetObjectPath() string

func (*EdgefsNfsVolume) String

func (vol *EdgefsNfsVolume) String() string

type EdgefsService

type EdgefsService struct {
	// Edgefs service name
	Name string
	// Edgefs service type [nfs|iscsi]
	Type string
	// Nfs mount point for NFS or portal for ISCSI with port
	Entrypoint string
	// current Kubernetes Edgefs service namespace
	K8SNamespace string
	// Kubernetes Edgefs service name
	K8SSvcName string
	// service status [enabled|disabled]
	Status string
}

func (*EdgefsService) GetEntrypoint

func (es *EdgefsService) GetEntrypoint() string

func (*EdgefsService) GetK8SNamespace

func (es *EdgefsService) GetK8SNamespace() string

func (*EdgefsService) GetK8SSvcName

func (es *EdgefsService) GetK8SSvcName() string

func (*EdgefsService) GetName

func (es *EdgefsService) GetName() string

Getters

func (*EdgefsService) GetStatus

func (es *EdgefsService) GetStatus() string

func (*EdgefsService) GetType

func (es *EdgefsService) GetType() string

func (*EdgefsService) SetEntrypoint

func (es *EdgefsService) SetEntrypoint(value string)

func (*EdgefsService) SetK8SNamespace

func (es *EdgefsService) SetK8SNamespace(value string)

func (*EdgefsService) SetK8SSvcName

func (es *EdgefsService) SetK8SSvcName(value string)

func (*EdgefsService) SetName

func (es *EdgefsService) SetName(value string)

Setters

func (*EdgefsService) SetStatus

func (es *EdgefsService) SetStatus(value string)

func (*EdgefsService) SetType

func (es *EdgefsService) SetType(value string)

func (*EdgefsService) String

func (es *EdgefsService) String() string

String implements Stringer iface for EdgefsService

type IEdgeFS

type IEdgeFS interface {
	/* CSI NFS client methods */
	CreateNfsVolume(csiVolumeID string, size int, options map[string]string) (string, error)
	DeleteNfsVolume(volumeID *NfsVolumeId) error

	/* CSI ISCSI client methods */
	CreateIscsiVolume(name, sourceSnapshot string, size int64, options map[string]string) (string, error)
	DeleteIscsiVolume(volumeID *IscsiVolumeId) error

	/* Snapshots */
	CreateObjectSnapshot(csiVolumeID, snapName string) (SnapshotInfo, error)
	DeleteObjectSnapshot(csiSnapshotID string) error
	ListObjectSnapshots(csiVolumeID, pattern string) ([]SnapshotInfo, error)

	/* returns all available cluster volumes for current driver type */
	ListVolumes() ([]IEdgefsVolume, error)
	ListServices(serviceName ...string) ([]IEdgefsService, error)

	IsClusterExists(clusterName string) bool
	IsTenantExists(clusterName, tenantName string) bool
	IsBucketExists(clusterName, tenantName, bucketName string) bool
	GetClusterData(serviceName ...string) (ClusterData, error)

	GetClusterConfig() (config *EdgefsClusterConfig)
	GetSegment() string
}

IEdgeFS interface to provide base methods for CSI driver client methods

func InitEdgeFS

func InitEdgeFS(config *EdgefsClusterConfig, backendType string, segment string, logger *logrus.Entry) (edgefs IEdgeFS, err error)

InitEdgeFS reads config and discovers Edgefs clusters

type IEdgeFSProvider

type IEdgeFSProvider interface {
	// common provider methods
	ListClusters() (clusters []string, err error)
	ListTenants(cluster string) (tenants []string, err error)
	ListBuckets(cluster string, tenant string) (buckets []string, err error)
	//ListObjects(cluster, tenant, bucket string) ([]string, error)
	IsBucketExist(cluster string, tenant string, bucket string) bool

	CreateBucket(cluster string, tenant string, bucket string, size int, options map[string]string) error
	DeleteBucket(cluster string, tenant string, bucket string, force bool) error

	//ServeObject serve object to NFS/ISCSI service, returns ISCSI object path lunNumber@cluster/tenant/bucket/object
	ServeObject(serviceName, k8sservice, k8snamespace string, volume EdgefsIscsiVolume, settings VolumeSettings) (objectPath string, err error)
	UnserveObject(serviceName, k8sservice, k8snamespace string, volume EdgefsIscsiVolume) (err error)

	//ServeBucket serve bucket to NFS service
	ServeBucket(service, k8sservice, k8snamespace string, volume EdgefsNfsVolume, settings VolumeSettings) (objectPath string, err error)
	UnserveBucket(service, k8sservice, k8snamespace string, volume EdgefsNfsVolume) (err error)

	SetBucketQuota(cluster string, tenant string, bucket string, quota string) (err error)
	SetServiceAclConfiguration(service string, tenant string, bucket string, value string) error
	UnsetServiceAclConfiguration(service string, tenant string, bucket string) error

	/* multi service methods */
	GetService(serviceType, serviceName string) (service IEdgefsService, err error)
	//ListServices(serviceType string) ([]IEdgefsService, error)
	ListVolumes(serviceType, serviceName string) (volumes []IEdgefsVolume, err error)

	//CloneIscsiVolume
	CloneVolumeFromSnapshot(cloneVolume IscsiVolumeId, ss IscsiSnapshotId) (CloneInfo, error)

	//Snapshot methods
	IsSnapshotExists(ss IscsiSnapshotId) (bool, error)
	CreateSnapshot(ss IscsiSnapshotId) (SnapshotInfo, error)
	DeleteSnapshot(ss IscsiSnapshotId) error
	ListSnapshots(volume IscsiVolumeId, pattern string) ([]SnapshotInfo, error)

	CheckHealth() (err error)
}

IEdgeFS interface to provide base methods

func InitEdgeFSProvider

func InitEdgeFSProvider(proxyip string, port int16, username string, password string, logger *logrus.Entry) IEdgeFSProvider

type IEdgefsService

type IEdgefsService interface {
	GetName() string
	GetType() string
	GetK8SSvcName() string
	GetK8SNamespace() string
	GetEntrypoint() string
	GetStatus() string

	SetName(value string)
	SetType(value string)
	SetK8SSvcName(value string)
	SetK8SNamespace(value string)
	SetEntrypoint(value string)
	SetStatus(value string)
}

represents Edgefs internal service objects

type IEdgefsVolume

type IEdgefsVolume interface {
	GetObjectPath() string
}

type IK8SEdgefsService

type IK8SEdgefsService interface {
	GetName() string
	GetK8SSvcName() string
	GetK8SNamespace() string
	GetClusterIP() string
	GetPort() string
	GetType() string
}

represents Kubernetes Edgefs service information [nfs|iscsi]

func GetEdgefsK8sClusterServices

func GetEdgefsK8sClusterServices(serviceType, k8sEdgefsNamespace string, k8sClientInCluster bool) (services []IK8SEdgefsService, err error)

func NewK8SEdgefsIscsiService

func NewK8SEdgefsIscsiService(name, k8sSvcName, k8sNamespace, clusterIP, port string) IK8SEdgefsService

func NewK8SEdgefsNfsService

func NewK8SEdgefsNfsService(name, k8sSvcName, k8sNamespace, clusterIP, port string) IK8SEdgefsService

type IServiceData

type IServiceData interface {
	GetType() string
	GetService() IEdgefsService
	GetEdgefsVolume(volumeId IVolumeId) IEdgefsVolume
	GetVolumesCount() int
}

IServiceData interface to operate different service types

type ISnapshotId

type ISnapshotId interface {
	GetObjectPath() string
	GetName() string
	Validate() error
}

type IVolumeId

type IVolumeId interface {
	GetServiceName() string
	SetServiceName(name string)
	// Object to comapare volumes inside service cluster/tenant/bucket
	GetObjectPath() string
	// return csi volume id for for edgefs object segment:service@cluster/tenant/bucket
	GetCSIVolumeID() string
	Validate() error
}

type IscsiSnapshotId

type IscsiSnapshotId struct {
	Cluster string
	Tenant  string
	Bucket  string
	Object  string
	Name    string
}

func ParseIscsiSnapshotID

func ParseIscsiSnapshotID(snapshotIDStr string, clusterConfig *EdgefsClusterConfig) (IscsiSnapshotId, error)

func (*IscsiSnapshotId) GetObjectPath

func (snap *IscsiSnapshotId) GetObjectPath() string

func (*IscsiSnapshotId) Validate

func (snap *IscsiSnapshotId) Validate() error

type IscsiVolumeId

type IscsiVolumeId struct {
	Segment string
	Service string
	Cluster string
	Tenant  string
	Bucket  string
	Object  string
}

func ParseIscsiVolumeID

func ParseIscsiVolumeID(volumeID string, clusterConfig *EdgefsClusterConfig) (vol *IscsiVolumeId, err error)

func (*IscsiVolumeId) GetCSIVolumeID

func (iscsiVolumeId *IscsiVolumeId) GetCSIVolumeID() string

func (*IscsiVolumeId) GetObjectPath

func (iscsiVolumeId *IscsiVolumeId) GetObjectPath() string

func (*IscsiVolumeId) GetServiceName

func (iscsiVolumeId *IscsiVolumeId) GetServiceName() string

func (*IscsiVolumeId) SetServiceName

func (iscsiVolumeId *IscsiVolumeId) SetServiceName(name string)

func (*IscsiVolumeId) Validate

func (iscsiVolumeId *IscsiVolumeId) Validate() error

type K8SEdgefsService

type K8SEdgefsService struct {
	Name         string
	K8SSvcName   string
	K8SNamespace string
	ServiceType  string
	ClusterIP    string
	Port         string
}

func (*K8SEdgefsService) GetClusterIP

func (svc *K8SEdgefsService) GetClusterIP() string

func (*K8SEdgefsService) GetK8SNamespace

func (svc *K8SEdgefsService) GetK8SNamespace() string

func (*K8SEdgefsService) GetK8SSvcName

func (svc *K8SEdgefsService) GetK8SSvcName() string

func (*K8SEdgefsService) GetName

func (svc *K8SEdgefsService) GetName() string

func (*K8SEdgefsService) GetPort

func (svc *K8SEdgefsService) GetPort() string

func (*K8SEdgefsService) GetType

func (svc *K8SEdgefsService) GetType() string

func (*K8SEdgefsService) String

func (svc *K8SEdgefsService) String() string

type NfsVolumeId

type NfsVolumeId struct {
	Segment string
	Service string
	Cluster string
	Tenant  string
	Bucket  string
}

func ParseNfsVolumeID

func ParseNfsVolumeID(volumeID string, clusterConfig *EdgefsClusterConfig) (vol *NfsVolumeId, err error)

Canonical NfsVolumeID is segment:service@cluster/tenant/bucket

func (*NfsVolumeId) GetCSIVolumeID

func (nfsVolumeId *NfsVolumeId) GetCSIVolumeID() string

func (*NfsVolumeId) GetObjectPath

func (nfsVolumeId *NfsVolumeId) GetObjectPath() string

func (*NfsVolumeId) GetServiceName

func (nfsVolumeId *NfsVolumeId) GetServiceName() string

func (*NfsVolumeId) SetServiceName

func (nfsVolumeId *NfsVolumeId) SetServiceName(name string)

func (*NfsVolumeId) Validate

func (nfsVolumeId *NfsVolumeId) Validate() error

type ServiceData

type ServiceData struct {
	Service IEdgefsService
	Volumes []IEdgefsVolume
}

represents base Edgefs internal service data with related volumes

func (*ServiceData) GetEdgefsVolume

func (sd *ServiceData) GetEdgefsVolume(volumeId IVolumeId) (IEdgefsVolume, error)

func (*ServiceData) GetEdgefsVolumeParams

func (sd *ServiceData) GetEdgefsVolumeParams(volumeId IVolumeId) (map[string]string, error)

func (*ServiceData) GetService

func (sd *ServiceData) GetService() IEdgefsService

func (*ServiceData) GetType

func (sd *ServiceData) GetType() string

func (*ServiceData) GetVolumesCount

func (sd *ServiceData) GetVolumesCount() int

type SnapshotInfo

type SnapshotInfo struct {
	SnapshotPath string
	SourceVolume string
	CreationTime int64
}

type VolumeSettings

type VolumeSettings struct {
	IsClonedObject bool
	VolumeSize     int64
	ChunkSize      int32
	BlockSize      int32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL