From 10628f399d6229215f9f2ad206d75291280fdd66 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Wed, 17 Jan 2024 16:48:40 +0100 Subject: [PATCH 1/5] fix events authentication Signed-off-by: jkoberg --- changelog/unreleased/fix-nats-authentication.md | 5 +++++ services/sharing/pkg/config/config.go | 2 ++ services/sharing/pkg/revaconfig/config.go | 4 ++++ services/storage-users/pkg/revaconfig/config.go | 4 ++++ services/storage-users/pkg/revaconfig/drivers.go | 12 ++---------- 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 changelog/unreleased/fix-nats-authentication.md diff --git a/changelog/unreleased/fix-nats-authentication.md b/changelog/unreleased/fix-nats-authentication.md new file mode 100644 index 00000000000..2ab13db9d8e --- /dev/null +++ b/changelog/unreleased/fix-nats-authentication.md @@ -0,0 +1,5 @@ +Bugfix: Fix nats authentication + +Fixes nats authentication for registry/events/stores + +https://github.com/owncloud/ocis/pull/8236 diff --git a/services/sharing/pkg/config/config.go b/services/sharing/pkg/config/config.go index 24c8834d2ee..7d51d0b830c 100644 --- a/services/sharing/pkg/config/config.go +++ b/services/sharing/pkg/config/config.go @@ -153,6 +153,8 @@ type Events struct { TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_INSECURE;SHARING_EVENTS_TLS_INSECURE" desc:"Whether to verify the server TLS certificates."` TLSRootCaCertPath string `yaml:"tls_root_ca_cert_path" env:"OCIS_EVENTS_TLS_ROOT_CA_CERTIFICATE;SHARING_EVENTS_TLS_ROOT_CA_CERTIFICATE" desc:"The root CA certificate used to validate the server's TLS certificate. If provided SHARING_EVENTS_TLS_INSECURE will be seen as false."` EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;SHARING_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services.."` + AuthUsername string `yaml:"auth_username" env:"OCIS_EVENTS_AUTH_USERNAME;SHARING_EVENTS_AUTH_USERNAME" desc:"Username for the events broker."` + AuthPassword string `yaml:"auth_password" env:"OCIS_EVENTS_AUTH_PASSWORD;SHARING_EVENTS_AUTH_PASSWORD" desc:"Password for the events broker."` } // PasswordPolicy configures reva password policy diff --git a/services/sharing/pkg/revaconfig/config.go b/services/sharing/pkg/revaconfig/config.go index b1f7e0d46a8..8f02b796de4 100644 --- a/services/sharing/pkg/revaconfig/config.go +++ b/services/sharing/pkg/revaconfig/config.go @@ -81,6 +81,8 @@ func SharingConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string] "natsclusterid": cfg.Events.ClusterID, "tlsinsecure": cfg.Events.TLSInsecure, "tlsrootcacertificate": cfg.Events.TLSRootCaCertPath, + "authusername": cfg.Events.AuthUsername, + "authpassword": cfg.Events.AuthPassword, }, }, }, @@ -134,6 +136,8 @@ func SharingConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string] "tls-root-ca-cert": cfg.Events.TLSRootCaCertPath, "enable-tls": cfg.Events.EnableTLS, "name": "sharing-eventsmiddleware", + "username": cfg.Events.AuthUsername, + "password": cfg.Events.AuthPassword, }, "prometheus": map[string]interface{}{ "namespace": "ocis", diff --git a/services/storage-users/pkg/revaconfig/config.go b/services/storage-users/pkg/revaconfig/config.go index 3966d86c56f..8997130924e 100644 --- a/services/storage-users/pkg/revaconfig/config.go +++ b/services/storage-users/pkg/revaconfig/config.go @@ -46,6 +46,8 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "tls-root-ca-cert": cfg.Events.TLSRootCaCertPath, "enable-tls": cfg.Events.EnableTLS, "name": "storage-users-eventsmiddleware", + "username": cfg.Events.AuthUsername, + "password": cfg.Events.AuthPassword, }, "prometheus": map[string]interface{}{ "namespace": "ocis", @@ -70,6 +72,8 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "nats_tls_insecure": cfg.Events.TLSInsecure, "nats_root_ca_cert_path": cfg.Events.TLSRootCaCertPath, "nats_enable_tls": cfg.Events.EnableTLS, + "nats_username": cfg.Events.AuthUsername, + "nats_password": cfg.Events.AuthPassword, "data_txs": map[string]interface{}{ "simple": map[string]interface{}{ "cache_store": cfg.StatCache.Store, diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index a26bf8de476..db98a352d80 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -157,11 +157,7 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_disable_persistence": cfg.IDCache.DisablePersistence, }, "events": map[string]interface{}{ - "natsaddress": cfg.Events.Addr, - "natsclusterid": cfg.Events.ClusterID, - "tlsinsecure": cfg.Events.TLSInsecure, - "tlsrootcacertificate": cfg.Events.TLSRootCaCertPath, - "numconsumers": cfg.Events.NumConsumers, + "numconsumers": cfg.Events.NumConsumers, }, "tokens": map[string]interface{}{ "transfer_shared_secret": cfg.Commons.TransferSecret, @@ -284,11 +280,7 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_disable_persistence": cfg.IDCache.DisablePersistence, }, "events": map[string]interface{}{ - "natsaddress": cfg.Events.Addr, - "natsclusterid": cfg.Events.ClusterID, - "tlsinsecure": cfg.Events.TLSInsecure, - "tlsrootcacertificate": cfg.Events.TLSRootCaCertPath, - "numconsumers": cfg.Events.NumConsumers, + "numconsumers": cfg.Events.NumConsumers, }, "tokens": map[string]interface{}{ "transfer_shared_secret": cfg.Commons.TransferSecret, From 13bb2785d4e19e52973a7218c1d81ac1f836e767 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Fri, 19 Jan 2024 15:12:04 +0100 Subject: [PATCH 2/5] fix cache authentication Signed-off-by: jkoberg --- ocis-pkg/shared/shared_types.go | 2 ++ services/frontend/pkg/config/config.go | 2 ++ services/frontend/pkg/revaconfig/config.go | 2 ++ services/gateway/pkg/config/config.go | 6 +++++ services/gateway/pkg/revaconfig/config.go | 6 +++++ services/storage-system/pkg/config/config.go | 2 ++ .../storage-system/pkg/revaconfig/config.go | 2 ++ services/storage-users/pkg/config/config.go | 6 +++++ .../storage-users/pkg/revaconfig/config.go | 6 +++++ .../storage-users/pkg/revaconfig/drivers.go | 24 +++++++++++++++++++ 10 files changed, 58 insertions(+) diff --git a/ocis-pkg/shared/shared_types.go b/ocis-pkg/shared/shared_types.go index 9775daec31b..a5c5aa336a3 100644 --- a/ocis-pkg/shared/shared_types.go +++ b/ocis-pkg/shared/shared_types.go @@ -63,6 +63,8 @@ type Cache struct { TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL" desc:"Time to live for events in the store. The duration can be set as number followed by a unit identifier like s, m or h."` Size int `yaml:"size" env:"OCIS_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured."` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` + AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` } // Commons holds configuration that are common to all extensions. Each extension can then decide whether diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 897627ad84a..fa8c7b2fc1f 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -137,6 +137,8 @@ type OCS struct { StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;FRONTEND_OCS_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;FRONTEND_OCS_STAT_CACHE_SIZE" desc:"Max number of entries to hold in the cache."` StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;FRONTEND_OCS_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disable persistence of the cache. Only applies when using the 'nats-js-kv' store type. Defaults to false."` + StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;FRONTEND_OCS_STAT_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when using the 'nats-js-kv' store type."` + StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;FRONTEND_OCS_STAT_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when using the 'nats-js-kv' store type."` CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 51c41385600..1ee8a26864c 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -163,6 +163,8 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string "cache_ttl": cfg.OCS.StatCacheTTL / time.Second, "cache_size": cfg.OCS.StatCacheSize, "cache_disable_persistence": cfg.OCS.StatCacheDisablePersistence, + "cache_auth_username": cfg.OCS.StatCacheAuthUsername, + "cache_auth_password": cfg.OCS.StatCacheAuthPassword, }, "prefix": cfg.OCS.Prefix, "additional_info_attribute": cfg.OCS.AdditionalInfoAttribute, diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index e676f59ec4b..4e0717bf32a 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -91,16 +91,22 @@ type Cache struct { StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the stat cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_STAT_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` + StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_STAT_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` + ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` CreateHomeCacheStore string `yaml:"create_home_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_CREATE_HOME_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` + CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` } diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go index d1affa7a92a..ecd2333806c 100644 --- a/services/gateway/pkg/revaconfig/config.go +++ b/services/gateway/pkg/revaconfig/config.go @@ -69,6 +69,8 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "cache_ttl": cfg.Cache.StatCacheTTL, "cache_size": cfg.Cache.StatCacheSize, "cache_disable_persistenc": cfg.Cache.StatCacheDisablePersistence, + "cache_auth_username": cfg.Cache.StatCacheAuthUsername, + "cache_auth_password": cfg.Cache.StatCacheAuthPassword, }, "provider_cache_config": map[string]interface{}{ "cache_store": cfg.Cache.ProviderCacheStore, @@ -78,6 +80,8 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "cache_ttl": cfg.Cache.ProviderCacheTTL, "cache_size": cfg.Cache.ProviderCacheSize, "disable_persistence": cfg.Cache.ProviderCacheDisablePersistence, + "cache_auth_username": cfg.Cache.ProviderCacheAuthUsername, + "cache_auth_password": cfg.Cache.ProviderCacheAuthPassword, }, "create_home_cache_config": map[string]interface{}{ "cache_store": cfg.Cache.CreateHomeCacheStore, @@ -87,6 +91,8 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "cache_ttl": cfg.Cache.CreateHomeCacheTTL, "cache_size": cfg.Cache.CreateHomeCacheSize, "cache_disable_persistence": cfg.Cache.CreateHomeCacheDisablePersistence, + "cache_auth_username": cfg.Cache.CreateHomeCacheAuthUsername, + "cache_auth_password": cfg.Cache.CreateHomeCacheAuthPassword, }, }, "authregistry": map[string]interface{}{ diff --git a/services/storage-system/pkg/config/config.go b/services/storage-system/pkg/config/config.go index e05a5245193..6ebe5b7187b 100644 --- a/services/storage-system/pkg/config/config.go +++ b/services/storage-system/pkg/config/config.go @@ -93,4 +93,6 @@ type Cache struct { TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_SYSTEM_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_SYSTEM_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_SYSTEM_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured."` + AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured."` } diff --git a/services/storage-system/pkg/revaconfig/config.go b/services/storage-system/pkg/revaconfig/config.go index 16c1c3a09d9..2a433371260 100644 --- a/services/storage-system/pkg/revaconfig/config.go +++ b/services/storage-system/pkg/revaconfig/config.go @@ -168,6 +168,8 @@ func metadataDrivers(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.FileMetadataCache.TTL / time.Second, "cache_size": cfg.FileMetadataCache.Size, "cache_disable_persistence": cfg.FileMetadataCache.DisablePersistence, + "cache_auth_username": cfg.FileMetadataCache.AuthUsername, + "cache_auth_password": cfg.FileMetadataCache.AuthPassword, }, }, } diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 77616b35d37..3d75b52ab7a 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -190,6 +190,8 @@ type StatCache struct { TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_STAT_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_STAT_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_STAT_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` } // FilemetadataCache holds cache config @@ -200,6 +202,8 @@ type FilemetadataCache struct { TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_FILEMETADATA_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_FILEMETADATA_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_FILEMETADATA_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` } // IDCache holds cache config @@ -210,6 +214,8 @@ type IDCache struct { TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens have no expiration. Defaults to 300s which is derived from the underlaying package though not explicitly set as default. See the Environment Variable Types description for more details."` Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_ID_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` } // S3Driver is the storage driver configuration when using 's3' storage driver diff --git a/services/storage-users/pkg/revaconfig/config.go b/services/storage-users/pkg/revaconfig/config.go index 8997130924e..4169106d07c 100644 --- a/services/storage-users/pkg/revaconfig/config.go +++ b/services/storage-users/pkg/revaconfig/config.go @@ -83,6 +83,8 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "cache_size": cfg.StatCache.Size, "cache_table": "stat", "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "spaces": map[string]interface{}{ "cache_store": cfg.StatCache.Store, @@ -92,6 +94,8 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "cache_size": cfg.StatCache.Size, "cache_table": "stat", "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "tus": map[string]interface{}{ "cache_store": cfg.StatCache.Store, @@ -101,6 +105,8 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "cache_size": cfg.StatCache.Size, "cache_table": "stat", "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, }, }, diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index db98a352d80..fc5b1e59512 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -139,6 +139,8 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.StatCache.TTL, "cache_size": cfg.StatCache.Size, "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -147,6 +149,8 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.FilemetadataCache.TTL, "cache_size": cfg.FilemetadataCache.Size, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -155,6 +159,8 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.IDCache.TTL, "cache_size": cfg.IDCache.Size, "cache_disable_persistence": cfg.IDCache.DisablePersistence, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, }, "events": map[string]interface{}{ "numconsumers": cfg.Events.NumConsumers, @@ -196,6 +202,8 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.StatCache.TTL, "cache_size": cfg.StatCache.Size, "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -204,6 +212,8 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.FilemetadataCache.TTL, "cache_size": cfg.FilemetadataCache.Size, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -212,6 +222,8 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.IDCache.TTL, "cache_size": cfg.IDCache.Size, "cache_disable_persistence": cfg.IDCache.DisablePersistence, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, }, } } @@ -262,6 +274,8 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.StatCache.TTL, "cache_size": cfg.StatCache.Size, "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -270,6 +284,8 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.FilemetadataCache.TTL, "cache_size": cfg.FilemetadataCache.Size, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -278,6 +294,8 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.IDCache.TTL, "cache_size": cfg.IDCache.Size, "cache_disable_persistence": cfg.IDCache.DisablePersistence, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, }, "events": map[string]interface{}{ "numconsumers": cfg.Events.NumConsumers, @@ -323,6 +341,8 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.StatCache.TTL, "cache_size": cfg.StatCache.Size, "cache_disable_persistence": cfg.StatCache.DisablePersistence, + "cache_auth_username": cfg.StatCache.AuthUsername, + "cache_auth_password": cfg.StatCache.AuthPassword, }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -331,6 +351,8 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.FilemetadataCache.TTL, "cache_size": cfg.FilemetadataCache.Size, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -339,6 +361,8 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "cache_ttl": cfg.IDCache.TTL, "cache_size": cfg.IDCache.Size, "cache_disable_persistence": cfg.IDCache.DisablePersistence, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, }, } } From 8e613bbe7a2d5fe652d6dc5a88364d65b3be44b3 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 23 Jan 2024 12:39:34 +0100 Subject: [PATCH 3/5] fix store ttl Signed-off-by: jkoberg --- services/frontend/pkg/revaconfig/config.go | 3 +-- services/storage-system/pkg/revaconfig/config.go | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 1ee8a26864c..93ab7833aed 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -8,7 +8,6 @@ import ( "path" "path/filepath" "strconv" - "time" "github.com/owncloud/ocis/v2/ocis-pkg/config/defaults" "github.com/owncloud/ocis/v2/ocis-pkg/log" @@ -160,7 +159,7 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string "cache_nodes": cfg.OCS.StatCacheNodes, "cache_database": cfg.OCS.StatCacheDatabase, "cache_table": cfg.OCS.StatCacheTable, - "cache_ttl": cfg.OCS.StatCacheTTL / time.Second, + "cache_ttl": cfg.OCS.StatCacheTTL, "cache_size": cfg.OCS.StatCacheSize, "cache_disable_persistence": cfg.OCS.StatCacheDisablePersistence, "cache_auth_username": cfg.OCS.StatCacheAuthUsername, diff --git a/services/storage-system/pkg/revaconfig/config.go b/services/storage-system/pkg/revaconfig/config.go index 2a433371260..5557552097e 100644 --- a/services/storage-system/pkg/revaconfig/config.go +++ b/services/storage-system/pkg/revaconfig/config.go @@ -1,8 +1,6 @@ package revaconfig import ( - "time" - userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" "github.com/owncloud/ocis/v2/services/storage-system/pkg/config" ) @@ -165,7 +163,7 @@ func metadataDrivers(cfg *config.Config) map[string]interface{} { "cache_store": cfg.FileMetadataCache.Store, "cache_nodes": cfg.FileMetadataCache.Nodes, "cache_database": cfg.FileMetadataCache.Database, - "cache_ttl": cfg.FileMetadataCache.TTL / time.Second, + "cache_ttl": cfg.FileMetadataCache.TTL, "cache_size": cfg.FileMetadataCache.Size, "cache_disable_persistence": cfg.FileMetadataCache.DisablePersistence, "cache_auth_username": cfg.FileMetadataCache.AuthUsername, From cec6ea50eb086b9d3f09823cc2abc4490e2f447e Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 23 Jan 2024 12:48:44 +0100 Subject: [PATCH 4/5] remove unused stat cache Signed-off-by: jkoberg --- services/gateway/pkg/config/config.go | 8 ---- .../pkg/config/defaults/defaultconfig.go | 4 -- services/gateway/pkg/revaconfig/config.go | 11 ----- services/storage-users/pkg/config/config.go | 13 ------ .../pkg/config/defaults/defaultconfig.go | 6 --- .../storage-users/pkg/revaconfig/config.go | 35 ---------------- .../storage-users/pkg/revaconfig/drivers.go | 40 ------------------- 7 files changed, 117 deletions(-) diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 4e0717bf32a..a3242706b8e 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -85,14 +85,6 @@ type StorageRegistry struct { // Cache holds cache config type Cache struct { - StatCacheStore string // NOTE: The stat cache is not working atm. Hence we block configuring it - StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` - StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` - StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` - StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` - StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the stat cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` - StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_STAT_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured."` - StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_STAT_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured."` ProviderCacheStore string `yaml:"provider_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_PROVIDER_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` diff --git a/services/gateway/pkg/config/defaults/defaultconfig.go b/services/gateway/pkg/config/defaults/defaultconfig.go index f1ae8500422..b8bea1a4bcc 100644 --- a/services/gateway/pkg/config/defaults/defaultconfig.go +++ b/services/gateway/pkg/config/defaults/defaultconfig.go @@ -39,10 +39,6 @@ func DefaultConfig() *config.Config { DisableHomeCreationOnLogin: true, TransferExpires: 24 * 60 * 60, Cache: config.Cache{ - StatCacheStore: "noop", // NOTE: stat cache not working - StatCacheDatabase: "ocis", - StatCacheNodes: []string{"127.0.0.1:9233"}, - StatCacheTTL: 300 * time.Second, ProviderCacheStore: "noop", ProviderCacheNodes: []string{"127.0.0.1:9233"}, ProviderCacheDatabase: "cache-providers", diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go index ecd2333806c..c13688aee9c 100644 --- a/services/gateway/pkg/revaconfig/config.go +++ b/services/gateway/pkg/revaconfig/config.go @@ -61,17 +61,6 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "transfer_shared_secret": cfg.TransferSecret, "transfer_expires": cfg.TransferExpires, // cache and TTLs - "stat_cache_config": map[string]interface{}{ - "cache_store": cfg.Cache.StatCacheStore, - "cache_nodes": cfg.Cache.StatCacheNodes, - "cache_database": cfg.Cache.StatCacheDatabase, - "cache_table": "stat", - "cache_ttl": cfg.Cache.StatCacheTTL, - "cache_size": cfg.Cache.StatCacheSize, - "cache_disable_persistenc": cfg.Cache.StatCacheDisablePersistence, - "cache_auth_username": cfg.Cache.StatCacheAuthUsername, - "cache_auth_password": cfg.Cache.StatCacheAuthPassword, - }, "provider_cache_config": map[string]interface{}{ "cache_store": cfg.Cache.ProviderCacheStore, "cache_nodes": cfg.Cache.ProviderCacheNodes, diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index 3d75b52ab7a..8fd16c74b87 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -31,7 +31,6 @@ type Config struct { TransferExpires int64 `yaml:"transfer_expires" env:"STORAGE_USERS_TRANSFER_EXPIRES" desc:"the time after which the token for upload postprocessing expires"` Events Events `yaml:"events"` - StatCache StatCache `yaml:"stat_cache"` FilemetadataCache FilemetadataCache `yaml:"filemetadata_cache"` IDCache IDCache `yaml:"id_cache"` MountID string `yaml:"mount_id" env:"STORAGE_USERS_MOUNT_ID" desc:"Mount ID of this storage."` @@ -182,18 +181,6 @@ type Events struct { AuthPassword string `yaml:"password" env:"OCIS_EVENTS_AUTH_PASSWORD;STORAGE_USERS_EVENTS_AUTH_PASSWORD" desc:"The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.."` } -// StatCache holds cache config -type StatCache struct { - Store string `yaml:"store" env:"OCIS_CACHE_STORE;STORAGE_USERS_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` - Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."` - Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."` - TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_STAT_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."` - Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_STAT_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default."` - DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_STAT_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false."` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_STAT_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_STAT_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured."` -} - // FilemetadataCache holds cache config type FilemetadataCache struct { Store string `yaml:"store" env:"OCIS_CACHE_STORE;STORAGE_USERS_FILEMETADATA_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'redis-sentinel', 'nats-js-kv', 'noop'. See the text description for details."` diff --git a/services/storage-users/pkg/config/defaults/defaultconfig.go b/services/storage-users/pkg/config/defaults/defaultconfig.go index 8bc070c6afc..82a65ff7901 100644 --- a/services/storage-users/pkg/config/defaults/defaultconfig.go +++ b/services/storage-users/pkg/config/defaults/defaultconfig.go @@ -94,12 +94,6 @@ func DefaultConfig() *config.Config { ClusterID: "ocis-cluster", EnableTLS: false, }, - StatCache: config.StatCache{ - Store: "memory", - Nodes: []string{"127.0.0.1:9233"}, - Database: "ocis", - TTL: 300 * time.Second, - }, FilemetadataCache: config.FilemetadataCache{ Store: "memory", Nodes: []string{"127.0.0.1:9233"}, diff --git a/services/storage-users/pkg/revaconfig/config.go b/services/storage-users/pkg/revaconfig/config.go index 4169106d07c..f8ecffd9b73 100644 --- a/services/storage-users/pkg/revaconfig/config.go +++ b/services/storage-users/pkg/revaconfig/config.go @@ -74,41 +74,6 @@ func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} { "nats_enable_tls": cfg.Events.EnableTLS, "nats_username": cfg.Events.AuthUsername, "nats_password": cfg.Events.AuthPassword, - "data_txs": map[string]interface{}{ - "simple": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - "spaces": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - "tus": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_table": "stat", - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, - }, }, }, }, diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index fc5b1e59512..0a44caf74c8 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -132,16 +132,6 @@ func Ocis(cfg *config.Config) map[string]interface{} { "max_concurrency": cfg.Drivers.OCIS.MaxConcurrency, "asyncfileuploads": cfg.Drivers.OCIS.AsyncUploads, "max_quota": cfg.Drivers.OCIS.MaxQuota, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -195,16 +185,6 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "lock_cycle_duration_factor": cfg.Drivers.OCIS.LockCycleDurationFactor, "max_concurrency": cfg.Drivers.OCIS.MaxConcurrency, "max_quota": cfg.Drivers.OCIS.MaxQuota, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -267,16 +247,6 @@ func S3NG(cfg *config.Config) map[string]interface{} { "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, "asyncfileuploads": cfg.Drivers.OCIS.AsyncUploads, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, @@ -334,16 +304,6 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "max_acquire_lock_cycles": cfg.Drivers.S3NG.MaxAcquireLockCycles, "max_concurrency": cfg.Drivers.S3NG.MaxConcurrency, "lock_cycle_duration_factor": cfg.Drivers.S3NG.LockCycleDurationFactor, - "statcache": map[string]interface{}{ - "cache_store": cfg.StatCache.Store, - "cache_nodes": cfg.StatCache.Nodes, - "cache_database": cfg.StatCache.Database, - "cache_ttl": cfg.StatCache.TTL, - "cache_size": cfg.StatCache.Size, - "cache_disable_persistence": cfg.StatCache.DisablePersistence, - "cache_auth_username": cfg.StatCache.AuthUsername, - "cache_auth_password": cfg.StatCache.AuthPassword, - }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, "cache_nodes": cfg.FilemetadataCache.Nodes, From 82ee1a6305a1e26f44d524ea2c4e4264deeaa886 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Tue, 23 Jan 2024 13:48:23 +0100 Subject: [PATCH 5/5] use inmemory natsjskv registry Signed-off-by: jkoberg --- ocis-pkg/natsjsregistry/registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocis-pkg/natsjsregistry/registry.go b/ocis-pkg/natsjsregistry/registry.go index 8be5d02d823..857b4e5198b 100644 --- a/ocis-pkg/natsjsregistry/registry.go +++ b/ocis-pkg/natsjsregistry/registry.go @@ -31,7 +31,7 @@ func NewRegistry(opts ...registry.Option) registry.Registry { exp, _ := options.Context.Value(expiryKey{}).(time.Duration) return &storeregistry{ opts: options, - store: natsjskv.NewStore(storeOptions(options)...), + store: natsjskv.NewStore(append(storeOptions(options), natsjskv.DefaultMemory())...), typ: _registryName, expiry: exp, }