Commit 18c5d58
[release-1.21] Add network/tls package for TLS configuration (#3337)
* feat: add shared tls package for reading TLS config from environment (#3324)
* feat: add shared tls package for reading TLS config from environment
Extract TLS configuration parsing into a reusable knative.dev/pkg/tls
package so that any Knative component (not just webhooks) can read
TLS_MIN_VERSION, TLS_MAX_VERSION, TLS_CIPHER_SUITES, and
TLS_CURVE_PREFERENCES from environment variables with an optional prefix.
The webhook package is updated to use the new tls package, extending env
var support from just WEBHOOK_TLS_MIN_VERSION to all four WEBHOOK_TLS_*
variables. Programmatic Options values continue to take precedence over
environment variables.
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
* fix: address review feedback on tls package
Reduce the public API surface of the tls package by unexporting
ParseVersion, ParseCipherSuites, and ParseCurvePreferences since they
are implementation details of NewConfigFromEnv.
Also validate that TLS max version is not smaller than min version in
webhook.New(), document the Options TLS field precedence
(programmatic > env vars > defaults), and broaden TestConfig_TLSConfig
to exercise the full NewConfigFromEnv → TLSConfig path.
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
---------
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
* Replace NewConfigFromEnv with DefaultConfigFromEnv (#3328)
DefaultConfigFromEnv replaces NewConfigFromEnv by returning a full
default tls.Config with overrides from env vars. This avoids specifying
e.g. the TLS MinVersion explicitely.
* Move tls package to network/tls, keep aliases for backward compatibility (#3331)
The TLS configuration package is moved from tls/ to network/tls/ to
co-locate it with the rest of the networking code. The old tls/ package
now re-exports all public symbols as deprecated aliases so that existing
consumers continue to compile without changes. The webhook package is
updated to import from the new location directly.
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
* remove deprecated TLS package (#3333)
---------
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
Co-authored-by: Vincent Link <linkvt@users.noreply.github.com>
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>1 parent 4a022ed commit 18c5d58
6 files changed
Lines changed: 760 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
0 commit comments