@@ -54,11 +54,12 @@ func TestObservedConfig(t *testing.T) {
5454 expectedChange : true ,
5555 },
5656 {
57- name : "issuer set, no previous issuer" ,
58- existingIssuer : "" ,
59- issuer : "https://example.com" ,
60- expectedIssuer : "https://example.com" ,
61- expectedChange : true ,
57+ name : "issuer set, no previous issuer" ,
58+ existingIssuer : "" ,
59+ issuer : "https://example.com" ,
60+ expectedIssuer : "https://example.com" ,
61+ expectInternalJWKI : true ,
62+ expectedChange : true ,
6263 },
6364 {
6465 name : "previous issuer was default, new is custom value" ,
@@ -67,14 +68,15 @@ func TestObservedConfig(t *testing.T) {
6768 expectedIssuer : "https://example.com" ,
6869 trustedIssuers : []string {defaultServiceAccountIssuerValue },
6970 expectedTrustedIssuers : []string {defaultServiceAccountIssuerValue },
70- expectInternalJWKI : false , // this proves we remove the internal api LB when custom value is set
71+ expectInternalJWKI : true , // now jwks-uri should always point to LB URL
7172 expectedChange : true ,
7273 },
7374 {
74- name : "issuer set, previous issuer same" ,
75- existingIssuer : "https://example.com" ,
76- issuer : "https://example.com" ,
77- expectedIssuer : "https://example.com" ,
75+ name : "issuer set, previous issuer same" ,
76+ existingIssuer : "https://example.com" ,
77+ issuer : "https://example.com" ,
78+ expectedIssuer : "https://example.com" ,
79+ expectInternalJWKI : true ,
7880 },
7981 {
8082 name : "issuer set, previous issuer and trusted issuers same" ,
@@ -83,20 +85,23 @@ func TestObservedConfig(t *testing.T) {
8385 trustedIssuers : []string {"https://trusted.example.com" },
8486 expectedIssuer : "https://example.com" ,
8587 expectedTrustedIssuers : []string {"https://trusted.example.com" },
88+ expectInternalJWKI : true ,
8689 },
8790 {
88- name : "issuer set, previous issuer different" ,
89- existingIssuer : "https://example.com" ,
90- issuer : "https://example2.com" ,
91- expectedIssuer : "https://example2.com" ,
92- expectedChange : true ,
91+ name : "issuer set, previous issuer different" ,
92+ existingIssuer : "https://example.com" ,
93+ issuer : "https://example2.com" ,
94+ expectedIssuer : "https://example2.com" ,
95+ expectInternalJWKI : true ,
96+ expectedChange : true ,
9397 },
9498 {
95- name : "auth getter error" ,
96- existingIssuer : "https://example2.com" ,
97- issuer : "https://example.com" ,
98- authError : expectedErrAuth ,
99- expectedIssuer : "https://example2.com" ,
99+ name : "auth getter error" ,
100+ existingIssuer : "https://example2.com" ,
101+ issuer : "https://example.com" ,
102+ authError : expectedErrAuth ,
103+ expectedIssuer : "https://example2.com" ,
104+ expectInternalJWKI : true ,
100105 },
101106 {
102107 name : "infra getter error" ,
@@ -106,6 +111,14 @@ func TestObservedConfig(t *testing.T) {
106111 expectedIssuer : defaultServiceAccountIssuerValue ,
107112 expectInternalJWKI : true ,
108113 },
114+ {
115+ name : "custom issuer, no previous issuer" ,
116+ existingIssuer : "" ,
117+ issuer : "https://custom.com" ,
118+ expectedIssuer : "https://custom.com" ,
119+ expectInternalJWKI : true , // should always set jwks-uri
120+ expectedChange : true ,
121+ },
109122 } {
110123 t .Run (tc .name , func (t * testing.T ) {
111124 testRecorder := events .NewInMemoryRecorder ("SAIssuerTest" , clock.RealClock {})
@@ -199,11 +212,9 @@ func apiConfigForIssuer(issuer string, trustedIssuers []string) *kubecontrolplan
199212 "service-account-issuer" : append ([]string {issuer }, trustedIssuers ... ),
200213 "api-audiences" : append ([]string {issuer }, trustedIssuers ... ),
201214 }
202- if issuer == defaultServiceAccountIssuerValue {
203- //delete(args, "service-account-issuer")
204- //delete(args, "api-audiences")
205- args ["service-account-jwks-uri" ] = kubecontrolplanev1.Arguments {testLBURI }
206- }
215+ //delete(args, "service-account-issuer")
216+ //delete(args, "api-audiences")
217+ args ["service-account-jwks-uri" ] = kubecontrolplanev1.Arguments {testLBURI }
207218
208219 return & kubecontrolplanev1.KubeAPIServerConfig {
209220 TypeMeta : metav1.TypeMeta {
0 commit comments