Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/valkey-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ maintainers:
email: support@keiailab.com
url: https://keiailab.com

icon: https://raw.githubusercontent.com/KeiaiLab/valkey-operator/main/docs/branding/symbol.png
icon: https://valkey.io/img/valkey-horizontal.svg

annotations:
artifacthub.io/license: MIT
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/cluster_reintegrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func detectReintegration(shards, replicasPerShard int, observed map[int]observed
total := shards * (1 + replicasPerShard)
var primaries, replicas []reintegrationAction

for ord := 0; ord < total; ord++ {
for ord := range total {
m, seen := observed[ord]
isReplica := ord >= shards
if !isReplica {
Expand Down Expand Up @@ -130,7 +130,7 @@ func buildObservedMembers(
}
// nodeID → ordinal (master 매핑 역참조용).
idToOrdinal := make(map[string]int, total)
for ord := 0; ord < total; ord++ {
for ord := range total {
if addr := addrByOrdinal[ord]; addr != "" {
if nv := byAddr[addr]; nv != nil {
idToOrdinal[nv.ID] = ord
Expand All @@ -140,7 +140,7 @@ func buildObservedMembers(

observed := make(map[int]observedMember, total)
nodeIDByOrdinal := make(map[int]string, total)
for ord := 0; ord < total; ord++ {
for ord := range total {
addr := addrByOrdinal[ord]
nv := byAddr[addr]
if addr == "" || nv == nil {
Expand Down Expand Up @@ -397,7 +397,7 @@ func (r *ValkeyClusterReconciler) forgetStaleNodes(
func (r *ValkeyClusterReconciler) firstMemberAddr(
addrByOrdinal, nodeIDByOrdinal map[int]string, shards int,
) string {
for ord := 0; ord < shards; ord++ {
for ord := range shards {
if nodeIDByOrdinal[ord] != "" {
return addrByOrdinal[ord]
}
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/valkeyrestore_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand Down Expand Up @@ -625,7 +624,7 @@ func standaloneCluster(name, ns string, shards, repsPerShard int32) *cachev1alph
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
Spec: cachev1alpha1.ValkeyClusterSpec{
Shards: shards,
ReplicasPerShard: ptr.To(repsPerShard),
ReplicasPerShard: new(repsPerShard),
},
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/resources/servicemonitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Licensed under the MIT License. See the LICENSE file for details.
package resources

import (
"k8s.io/utils/ptr"
"strings"
"testing"

"k8s.io/utils/ptr"

cachev1alpha1 "github.com/keiailab/valkey-operator/api/v1alpha1"
)

Expand Down
11 changes: 6 additions & 5 deletions internal/resources/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func BuildStatefulSet(p STSParams) *appsv1.StatefulSet {
// announce-bus-port=tls-cluster 시 tls-port+10000(16380) / 아니면 port+10000(16379)
// — 실제 bus listen 포트와 일치해야 gossip 성립 (clusterAnnounceCommand 참조).
if p.ClusterMode {
containers[0].Command, containers[0].Args = clusterAnnounceCommand(containers[0].Args, p.TLSSecretName != "")
containers[0].Command = clusterAnnounceCommand(containers[0].Args, p.TLSSecretName != "")
containers[0].Args = nil
}

podSpec := corev1.PodSpec{
Expand Down Expand Up @@ -359,15 +360,15 @@ func buildRestrictedContainerSecurityContext() *corev1.SecurityContext {

// clusterAnnounceCommand — cluster mode 컨테이너 command 를 셸 래핑하여
// cluster-announce-ip 를 $POD_IP(downward API)로 확장한다. 입력은 기존
// valkey-server args (config path + --loadmodule 등). 반환은 (command, args)
// 쌍: command 는 `sh -c '...'`, args 는 nil (셸 명령에 모두 인라인).
// valkey-server args (config path + --loadmodule 등). 반환은 command (`sh -c '...'`)
// — 셸 명령에 모두 인라인되므로 호출 측은 컨테이너 Args 를 nil 로 설정한다.
//
// cluster-announce-ip 는 valkey-server 시작 시점에 literal 이어야 하므로
// ConfigMap directive 로 표현할 수 없다 (pod IP 는 ConfigMap 렌더 시점 미확정).
// CLI flag 가 valkey.conf 보다 우선하므로 ConfigMap 의 cluster-* directive 는
// 유효하게 유지된다. `exec` 로 PID 1 을 valkey-server 로 교체해 signal/graceful
// shutdown 의미를 보존한다.
func clusterAnnounceCommand(serverArgs []string, tlsEnabled bool) ([]string, []string) {
func clusterAnnounceCommand(serverArgs []string, tlsEnabled bool) []string {
// cluster-bus 는 tls-cluster 시 tls-port(6380)+10000, 아니면 port(6379)+10000 에
// listen 한다. announce-bus-port 가 실제 listen 포트와 어긋나면 peer 가 닫힌 포트로
// gossip 을 시도해 모든 노드가 fail?/disconnected → cluster_state:fail, slots_ok:0.
Expand All @@ -382,7 +383,7 @@ func clusterAnnounceCommand(serverArgs []string, tlsEnabled bool) ([]string, []s
"--cluster-announce-port", fmt.Sprintf("%d", PortClient),
"--cluster-announce-bus-port", fmt.Sprintf("%d", busPort),
)
return []string{"sh", "-c", strings.Join(parts, " ")}, nil
return []string{"sh", "-c", strings.Join(parts, " ")}
}

// PortIntOrString — helper for Probe/Service ports.
Expand Down
Loading