Skip to content

Commit f8e2063

Browse files
resourcebuilder/core: Keep ciphersuites order when injecting TLS
Although Go TLS ignores ciphersuites order, and has some complicated rules about ciphersuites content, other implementations (and perhaps future Go implementations) have different bahaviors, so we shouldn't optimize for the current implementation too closely. Also, ciphersuites opinions should be have a single source of truth, and be implemented at the APIServer level. Applying changes at the CluserVersionOperator level makes the config flow harer to follow. * Don't sort ciphersuites, and document the rationale * Add testscases and remove redundant ones * Clarify test labels and testdata name/comments * Reorder testcases and data to be more thematic * Simplify test helpers
1 parent 1edb16d commit f8e2063

3 files changed

Lines changed: 176 additions & 202 deletions

File tree

lib/resourcebuilder/core.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"sort"
87

98
"sigs.k8s.io/kustomize/kyaml/yaml"
109

@@ -145,11 +144,11 @@ func (b *builder) observeTLSConfiguration(ctx context.Context, cm *corev1.Config
145144
}
146145

147146
// Extract cipherSuites from the observed config
147+
// We pass the list as-is, even though TLS implementations may ignore the order and/or content (Go currently does).
148+
// This future-proofs for other implementations, and avoids inconsistencies between the CVO-injected list and the original.
148149
if cipherSuites, ciphersFound, err := unstructured.NestedStringSlice(observedConfig, "servingInfo", "cipherSuites"); err != nil {
149150
return nil, err
150151
} else if ciphersFound {
151-
// Sort cipher suites for consistent ordering
152-
sort.Strings(cipherSuites)
153152
config.cipherSuites = optional[[]string]{value: cipherSuites, found: true}
154153
}
155154

0 commit comments

Comments
 (0)