Skip to content

Commit e2f5433

Browse files
wangyeleiapecloud-bot
authored andcommitted
fix: redis cluster ops is always running (#10133)
(cherry picked from commit 9c42f6f)
1 parent 79b9654 commit e2f5433

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

apis/apps/v1/cluster_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ type ClusterSpec struct {
172172
// +kubebuilder:validation:MinItems=1
173173
// +kubebuilder:validation:MaxItems=128
174174
// +optional
175-
Shardings []ClusterSharding `json:"shardings,omitempty"`
175+
Shardings []ClusterSharding `json:"shardings,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"`
176176

177177
// Specifies runtimeClassName for all Pods managed by this Cluster.
178178
//

controllers/apps/cluster/transformer_cluster_sharding_account.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ func (t *clusterShardingAccountTransformer) rewriteSystemAccount(transCtx *clust
211211
for j, account := range sharding.Template.SystemAccounts {
212212
if account.Name == accountName {
213213
newAccount.Disabled = account.Disabled
214+
if account.SecretRef != nil {
215+
newAccount.SecretRef.Password = account.SecretRef.Password
216+
}
214217
transCtx.shardings[i].Template.SystemAccounts[j] = newAccount
215218
exist = true
216219
break

0 commit comments

Comments
 (0)