Skip to content

Commit 9ab2c10

Browse files
authored
Replace KeyDb dependency with Valkey (#4138)
* Replace KeyDb dependency with Valkey Signed-off-by: poorndm <[email protected]> Update omnibus-s/w version to latest Signed-off-by: poorndm <[email protected]> version correction Signed-off-by: poorndm <[email protected]> Version correction Signed-off-by: poorndm <[email protected]> Version correction Signed-off-by: poorndm <[email protected]> matching valkey error types. Signed-off-by: talktovikas <[email protected]> putting protected-mode off. Signed-off-by: talktovikas <[email protected]> password inforcement of cache. Signed-off-by: talktovikas <[email protected]> fixing reconfigure bug Signed-off-by: talktovikas <[email protected]> removing protected mode and enforced-password. Signed-off-by: talktovikas <[email protected]> * Adding information of valkey in command output. Signed-off-by: talktovikas <[email protected]> --------- Signed-off-by: talktovikas <[email protected]>
1 parent d4a8d59 commit 9ab2c10

File tree

8 files changed

+32
-13
lines changed

8 files changed

+32
-13
lines changed

omnibus/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ GIT
1010

1111
GIT
1212
remote: https://github.com/chef/omnibus-software.git
13-
revision: 0cb128b237c26b5796370b761adbd499f71e5413
13+
revision: d6fce7b6c5e6a9ba1f3a21eef2b2be8ee778391f
1414
branch: main
1515
specs:
16-
omnibus-software (25.10.350)
16+
omnibus-software (25.12.358)
1717
omnibus (>= 9.0.0)
1818

1919
GIT

omnibus/config/software/server-complete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# the backend
3232
dependency "postgresql96-bin" # for upgrading 9.6 -> 13
3333
dependency "postgresql13"
34-
dependency "keydb" # dynamic routing controls
34+
dependency "valkey" # dynamic routing controls
3535
dependency "haproxy"
3636
dependency "opensearch" # used by search
3737

omnibus/files/server-ctl-cookbooks/infra-server/recipes/redis_lb.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,23 @@
7373
owner 'root'
7474
group 'root'
7575
mode '0644'
76-
variables(redis_data.to_hash)
76+
variables(redis_data.to_hash.merge(
77+
'password' => PrivateChef.credentials.get('redis_lb', 'password')
78+
))
7779
end
7880

7981
# Define the redis_lb runit service.
8082
component_runit_service 'redis_lb'
8183

82-
# Restart the redis_lb runit service.
84+
# Force restart the redis_lb service to apply config changes.
85+
# We need to stop then start to ensure the new config is loaded.
86+
runit_service 'redis_lb' do
87+
action :stop
88+
only_if { is_data_master? }
89+
end
90+
8391
runit_service 'redis_lb' do
84-
action :restart
92+
action :start
8593
retries 10
8694
retry_delay 1
8795
only_if { is_data_master? }

omnibus/files/server-ctl-cookbooks/infra-server/templates/default/nginx/scripts/config.lua.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ local function auth_not_required(err)
4242
-- conservatively try to determine if auth is not required.
4343
-- if auth isn't required, we can safely ignore an error from
4444
-- the AUTH command
45-
return err == "ERR Client sent AUTH, but no password is set"
45+
return err == "ERR Client sent AUTH, but no password is set" or
46+
(err and string.find(err, "Redis is running in protected mode") ~= nil)
4647
end
4748

4849
local function connect_redis()

omnibus/files/server-ctl-cookbooks/infra-server/templates/default/redis_lb.conf.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ bind <%= @listen%> 0.0.0.0
1010
bind <%= @listen%>
1111
<% end %>
1212

13+
14+
<% if @password && [email protected]_s.empty? %>
15+
# Legacy password authentication
16+
requirepass <%= @password %>
17+
18+
# ACL-based authentication (KeyDB/Valkey 7+)
19+
# Set password for the default user
20+
user default on ><%= @password %> ~* &* +@all
21+
<% end %>
22+
1323
tcp-keepalive <%= @keepalive %>
1424
timeout <%= @timeout %>
1525
loglevel <%= @loglevel %>
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/sh
22
exec 2>&1
3-
exec /opt/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/embedded/bin/veil-env-helper -f /etc/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/private-<%= ChefUtils::Dist::Infra::SHORT %>-secrets.json -s REDIS_PASSWORD=redis_lb.password -- chpst -P -o 131071 -u <%= node["private_chef"]["user"]["username"] %> -U <%= node["private_chef"]["user"]["username"] %> -o 100000 env HOME="<%= node["private_chef"]["redis_lb"]["dir"] %>" /opt/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/embedded/bin/keydb-server <%= File.join(node["private_chef"]["redis_lb"]["dir"], "etc", "redis.conf") %> --requirepass "${REDIS_PASSWORD}"
4-
3+
exec /opt/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/embedded/bin/veil-env-helper -f /etc/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/private-<%= ChefUtils::Dist::Infra::SHORT %>-secrets.json -s REDIS_PASSWORD=redis_lb.password -- chpst -P -o 131071 -u <%= node["private_chef"]["user"]["username"] %> -U <%= node["private_chef"]["user"]["username"] %> -o 100000 env HOME="<%= node["private_chef"]["redis_lb"]["dir"] %>" /opt/<%= ChefUtils::Dist::Org::LEGACY_CONF_DIR %>/embedded/bin/valkey-server <%= File.join(node["private_chef"]["redis_lb"]["dir"], "etc", "redis.conf") %> --requirepass "${REDIS_PASSWORD}"

src/chef-server-ctl/bin/chef-server-ctl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ Cleansing data in a remote Opensearch instance is not currently supported.
296296
# opscode-solr4 status is seen as elasticsearch status"
297297
end
298298

299-
# Overriding the service_list command to add the keyDB message.
299+
# Overriding the service_list command to add the Valkey message.
300300
def service_list(*args)
301301
super(*args)
302-
log "We are using keydb instead of redis underneath. All the functions are supposed to work the same because keydb is a fork of redis."
302+
log "We are using Valkey instead of redis underneath. All the functions are supposed to work the same because Valkey is a fork of redis."
303303
end
304304

305305
# Overriding reconfigure to skip license checking
@@ -322,7 +322,7 @@ Cleansing data in a remote Opensearch instance is not currently supported.
322322
mtls_enabled ? run_command(command) : :ok
323323

324324
if status.success?
325-
log "We are using keydb instead of redis underneath. All the functions are supposed to work the same because keydb is a fork of redis."
325+
log "We are using Valkey instead of redis underneath. All the functions are supposed to work the same because Valkey is a fork of redis."
326326
log "#{display_name} Reconfigured!"
327327
exit! 0
328328
else

src/nginx/habitat/config/config.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ local function auth_not_required(err)
5454
-- conservatively try to determine if auth is not required.
5555
-- if auth isn't required, we can safely ignore an error from
5656
-- the AUTH command
57-
return err == "ERR Client sent AUTH, but no password is set"
57+
return err == "ERR Client sent AUTH, but no password is set" or
58+
(err and string.find(err, "Redis is running in protected mode") ~= nil)
5859
end
5960

6061
local function connect_redis()

0 commit comments

Comments
 (0)