storage-metadata config docs

This commit is contained in:
Willy Kloucek
2022-05-03 14:28:24 +02:00
parent c6af86c2a8
commit f501814bef
3 changed files with 8 additions and 177 deletions

View File

@@ -25,8 +25,8 @@ type Config struct {
Driver string `yaml:"driver" env:"STORAGE_METADATA_DRIVER" desc:"The driver which should be used by the service"`
Drivers Drivers `yaml:"drivers"`
DataServerURL string `yaml:"data_server_url"`
TempFolder string `yaml:"temp_folder"`
DataServerURL string `yaml:"data_server_url" env:"STORAGE_METADATA_DATA_SERVER_URL"`
TempFolder string `yaml:"temp_folder" env:"STORAGE_METADATA_TEMP_FOLDER"`
DataProviderInsecure bool `yaml:"data_provider_insecure" env:"OCIS_INSECURE;STORAGE_METADATA_DATAPROVIDER_INSECURE"`
Supervised bool `yaml:"-"`
@@ -70,85 +70,12 @@ type HTTPConfig struct {
}
type Drivers struct {
EOS EOSDriver
Local LocalDriver
OCIS OCISDriver
S3 S3Driver
S3NG S3NGDriver
}
type EOSDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
// ShadowNamespace for storing shadow data
ShadowNamespace string `yaml:"shadow_namespace"`
// UploadsNamespace for storing upload data
UploadsNamespace string `yaml:"uploads_namespace"`
// Location of the eos binary.
// Default is /usr/bin/eos.
EosBinary string `yaml:"eos_binary"`
// Location of the xrdcopy binary.
// Default is /usr/bin/xrdcopy.
XrdcopyBinary string `yaml:"xrd_copy_binary"`
// URL of the Master EOS MGM.
// Default is root://eos-example.org
MasterURL string `yaml:"master_url"`
// URL of the Slave EOS MGM.
// Default is root://eos-example.org
SlaveURL string `yaml:"slave_url"`
// Location on the local fs where to store reads.
// Defaults to os.TempDir()
CacheDirectory string `yaml:"cache_directory"`
// SecProtocol specifies the xrootd security protocol to use between the server and EOS.
SecProtocol string `yaml:"sec_protocol"`
// Keytab specifies the location of the keytab to use to authenticate to EOS.
Keytab string `yaml:"keytab"`
// SingleUsername is the username to use when SingleUserMode is enabled
SingleUsername string `yaml:"single_username"`
// Enables logging of the commands executed
// Defaults to false
EnableLogging bool `yaml:"enable_logging"`
// ShowHiddenSysFiles shows internal EOS files like
// .sys.v# and .sys.a# files.
ShowHiddenSysFiles bool `yaml:"shadow_hidden_files"`
// ForceSingleUserMode will force connections to EOS to use SingleUsername
ForceSingleUserMode bool `yaml:"force_single_user_mode"`
// UseKeyTabAuth changes will authenticate requests by using an EOS keytab.
UseKeytab bool `yaml:"user_keytab"`
// gateway service to use for uid lookups
GatewaySVC string `yaml:"gateway_svc"`
GRPCURI string
UserLayout string
}
type LocalDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
OCIS OCISDriver `yaml:"ocis"`
}
type OCISDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root" env:"STORAGE_METADATA_DRIVER_OCIS_ROOT"`
UserLayout string
PermissionsEndpoint string
}
type S3Driver struct {
Region string `yaml:"region"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
}
type S3NGDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
UserLayout string
PermissionsEndpoint string
Region string `yaml:"region"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
Root string `yaml:"root" env:"STORAGE_METADATA_OCIS_ROOT"`
UserLayout string `yaml:"-"`
PermissionsEndpoint string `yaml:"permissions_endpoint" env:"STORAGE_METADATA_OCIS_PERMISSIONS_ENDPOINT"`
}

View File

@@ -1,7 +1,6 @@
package defaults
import (
"os"
"path/filepath"
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/config"
@@ -43,42 +42,9 @@ func DefaultConfig() *config.Config {
DataServerURL: "http://localhost:9216/data",
Driver: "ocis",
Drivers: config.Drivers{
EOS: config.EOSDriver{
Root: "/eos/dockertest/reva",
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
ShadowNamespace: "",
UploadsNamespace: "",
EosBinary: "/usr/bin/eos",
XrdcopyBinary: "/usr/bin/xrdcopy",
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
GRPCURI: "",
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
CacheDirectory: os.TempDir(),
EnableLogging: false,
ShowHiddenSysFiles: false,
ForceSingleUserMode: false,
UseKeytab: false,
SecProtocol: "",
Keytab: "",
SingleUsername: "",
GatewaySVC: "127.0.0.1:9215",
},
Local: config.LocalDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "local", "metadata"),
},
S3: config.S3Driver{
Region: "default",
},
S3NG: config.S3NGDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "metadata"),
UserLayout: "{{.Id.OpaqueId}}",
Region: "default",
PermissionsEndpoint: "127.0.0.1:9215",
},
OCIS: config.OCISDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "metadata"),
UserLayout: "{{.Id.OpaqueId}}",
PermissionsEndpoint: "127.0.0.1:9215",
Root: filepath.Join(defaults.BaseDataPath(), "storage", "metadata"),
UserLayout: "{{.Id.OpaqueId}}",
},
},
}

View File

@@ -2,48 +2,6 @@ package config
func MetadataDrivers(cfg *Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Drivers.EOS.Root,
"shadow_namespace": cfg.Drivers.EOS.ShadowNamespace,
"uploads_namespace": cfg.Drivers.EOS.UploadsNamespace,
"eos_binary": cfg.Drivers.EOS.EosBinary,
"xrdcopy_binary": cfg.Drivers.EOS.XrdcopyBinary,
"master_url": cfg.Drivers.EOS.MasterURL,
"slave_url": cfg.Drivers.EOS.SlaveURL,
"cache_directory": cfg.Drivers.EOS.CacheDirectory,
"sec_protocol": cfg.Drivers.EOS.SecProtocol,
"keytab": cfg.Drivers.EOS.Keytab,
"single_username": cfg.Drivers.EOS.SingleUsername,
"enable_logging": cfg.Drivers.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Drivers.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Drivers.EOS.ForceSingleUserMode,
"use_keytab": cfg.Drivers.EOS.UseKeytab,
"gatewaysvc": cfg.Drivers.EOS.GatewaySVC,
"enable_home": false,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Drivers.EOS.Root,
"shadow_namespace": cfg.Drivers.EOS.ShadowNamespace,
"eos_binary": cfg.Drivers.EOS.EosBinary,
"xrdcopy_binary": cfg.Drivers.EOS.XrdcopyBinary,
"master_url": cfg.Drivers.EOS.MasterURL,
"master_grpc_uri": cfg.Drivers.EOS.GRPCURI,
"slave_url": cfg.Drivers.EOS.SlaveURL,
"cache_directory": cfg.Drivers.EOS.CacheDirectory,
"sec_protocol": cfg.Drivers.EOS.SecProtocol,
"keytab": cfg.Drivers.EOS.Keytab,
"single_username": cfg.Drivers.EOS.SingleUsername,
"user_layout": cfg.Drivers.EOS.UserLayout,
"enable_logging": cfg.Drivers.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Drivers.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Drivers.EOS.ForceSingleUserMode,
"use_keytab": cfg.Drivers.EOS.UseKeytab,
"enable_home": false,
"gatewaysvc": cfg.Drivers.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Drivers.Local.Root,
},
"ocis": map[string]interface{}{
"root": cfg.Drivers.OCIS.Root,
"user_layout": cfg.Drivers.OCIS.UserLayout,
@@ -51,25 +9,5 @@ func MetadataDrivers(cfg *Config) map[string]interface{} {
"treesize_accounting": false,
"permissionssvc": cfg.Drivers.OCIS.PermissionsEndpoint,
},
"s3": map[string]interface{}{
"region": cfg.Drivers.S3.Region,
"access_key": cfg.Drivers.S3.AccessKey,
"secret_key": cfg.Drivers.S3.SecretKey,
"endpoint": cfg.Drivers.S3.Endpoint,
"bucket": cfg.Drivers.S3.Bucket,
},
"s3ng": map[string]interface{}{
"root": cfg.Drivers.S3NG.Root,
"enable_home": false,
"user_layout": cfg.Drivers.S3NG.UserLayout,
"treetime_accounting": false,
"treesize_accounting": false,
"permissionssvc": cfg.Drivers.S3NG.PermissionsEndpoint,
"s3.region": cfg.Drivers.S3NG.Region,
"s3.access_key": cfg.Drivers.S3NG.AccessKey,
"s3.secret_key": cfg.Drivers.S3NG.SecretKey,
"s3.endpoint": cfg.Drivers.S3NG.Endpoint,
"s3.bucket": cfg.Drivers.S3NG.Bucket,
},
}
}