8000 [Bugfix] Fix TLS Hash generation (#1519) · arangodb/kube-arangodb@bc4cfbc · GitHub
[go: up one dir, main page]

Skip to content

Commit bc4cfbc

Browse files
authored
[Bugfix] Fix TLS Hash generation (#1519)
1 parent 2a25820 commit bc4cfbc

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

pkg/deployment/reconcile/action_tls_status_update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (a *actionTLSKeyStatusUpdate) Start(ctx context.Context) (bool, error) {
5959
return true, nil
6060
}
6161

62-
keyHashes := secretKeysToListWithPrefix(f)
62+
keyHashes := tlsSecretKeysToListWithPrefix(f)
6363

6464
if err = a.actionCtx.WithStatusUpdate(ctx, func(s *api.DeploymentStatus) bool {
6565
r := false

pkg/deployment/reconcile/plan_builder_tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (r *Reconciler) createTLSStatusUpdateRequired(apiObject k8sutil.APIObject,
144144
return false
145145
}
146146

147-
keyHashes := secretKeysToListWithPrefix(trusted)
147+
keyHashes := tlsSecretKeysToListWithPrefix(trusted)
148148

149149
if len(keyHashes) == 0 {
150150
return false

pkg/deployment/reconcile/utils.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,27 @@ import (
2727
"k8s.io/apimachinery/pkg/types"
2828

2929
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
30+
"github.com/arangodb/kube-arangodb/pkg/deployment/resources"
31+
"github.com/arangodb/kube-arangodb/pkg/handlers/utils"
3032
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod"
3133
"github.com/arangodb/kube-arangodb/pkg/util/strings"
3234
)
3335

34-
func secretKeysToListWithPrefix(s *core.Secret) []string {
35-
return strings.PrefixStringArray(secretKeysToList(s), "sha256:")
36+
func tlsSecretKeysToListWithPrefix(s *core.Secret) []string {
37+
return secretKeysToListWithPrefix(s, resources.CACertName)
3638
}
3739

38-
func secretKeysToList(s *core.Secret) []string {
40+
func secretKeysToListWithPrefix(s *core.Secret, skip ...string) []string {
41+
return strings.PrefixStringArray(secretKeysToList(s, skip...), "sha256:")
42+
}
43+
44+
func secretKeysToList(s *core.Secret, skip ...string) []string {
3945
keys := make([]string, 0, len(s.Data))
4046

4147
for key := range s.Data {
48+
if utils.StringList(skip).Has(key) {
49+
continue
50+
}
4251
keys = append(keys, key)
4352
}
4453

0 commit comments

Comments
 (0)
0