@@ -11,7 +11,7 @@ import (
1111 corev1 "k8s.io/api/core/v1"
1212 "k8s.io/apimachinery/pkg/types"
1313
14- pomerium "github.com/pomerium/pomerium/pkg/grpc/config"
14+ configpb "github.com/pomerium/pomerium/pkg/grpc/config"
1515
1616 "github.com/pomerium/ingress-controller/internal/policy"
1717 "github.com/pomerium/ingress-controller/model"
@@ -170,7 +170,7 @@ func removeKeyPrefix(src map[string]string, prefix string) (*keys, error) {
170170
171171// applyAnnotations applies ingress annotations to a route
172172func applyAnnotations (
173- r * pomerium .Route ,
173+ r * configpb .Route ,
174174 ic * model.IngressConfig ,
175175) error {
176176 kv , err := removeKeyPrefix (ic .Ingress .Annotations , ic .AnnotationPrefix )
@@ -193,15 +193,15 @@ func applyAnnotations(
193193 if err = applyUpstreamAnnotations (r , kv .UpstreamTunnel ); err != nil {
194194 return err
195195 }
196- p := new (pomerium .Policy )
197- r .Policies = []* pomerium .Policy {p }
196+ p := new (configpb .Policy )
197+ r .Policies = []* configpb .Policy {p }
198198 if err := unmarshalPolicyAnnotations (p , kv .Policy ); err != nil {
199199 return fmt .Errorf ("applying policy annotations: %w" , err )
200200 }
201201 return nil
202202}
203203
204- func unmarshalPolicyAnnotations (p * pomerium .Policy , kvs map [string ]string ) error {
204+ func unmarshalPolicyAnnotations (p * configpb .Policy , kvs map [string ]string ) error {
205205 ppl , hasPPL := kvs ["policy" ]
206206 if hasPPL {
207207 delete (kvs , "policy" )
@@ -225,7 +225,7 @@ func unmarshalPolicyAnnotations(p *pomerium.Policy, kvs map[string]string) error
225225}
226226
227227func applyTLSAnnotations (
228- r * pomerium .Route ,
228+ r * configpb .Route ,
229229 kvs map [string ]string ,
230230 secrets map [types.NamespacedName ]* corev1.Secret ,
231231 namespace string ,
@@ -260,7 +260,7 @@ func applyTLSAnnotations(
260260}
261261
262262func applySecretAnnotations (
263- r * pomerium .Route ,
263+ r * configpb .Route ,
264264 annotations map [string ]string ,
265265 secrets map [types.NamespacedName ]* corev1.Secret ,
266266 namespace string ,
@@ -314,23 +314,23 @@ func applySecretAnnotations(
314314 }
315315
316316 if r .Mcp == nil {
317- r .Mcp = & pomerium .MCP {
318- Mode : & pomerium .MCP_Server {
319- Server : & pomerium .MCPServer {},
317+ r .Mcp = & configpb .MCP {
318+ Mode : & configpb .MCP_Server {
319+ Server : & configpb .MCPServer {},
320320 },
321321 }
322322 } else if r .Mcp .GetServer () == nil {
323323 if r .Mcp .GetClient () != nil {
324324 return fmt .Errorf ("route is already configured as MCP client, cannot add OAuth2 secret" )
325325 }
326- r .Mcp .Mode = & pomerium .MCP_Server {
327- Server : & pomerium .MCPServer {},
326+ r .Mcp .Mode = & configpb .MCP_Server {
327+ Server : & configpb .MCPServer {},
328328 }
329329 }
330330
331331 server := r .Mcp .GetServer ()
332332 if server .UpstreamOauth2 == nil {
333- server .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
333+ server .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
334334 }
335335
336336 if hasClientID {
@@ -387,7 +387,7 @@ func applySecretAnnotations(
387387 return nil
388388}
389389
390- func applyMCPAnnotations (r * pomerium .Route , serverKVs , clientKVs map [string ]string ) error {
390+ func applyMCPAnnotations (r * configpb .Route , serverKVs , clientKVs map [string ]string ) error {
391391 hasServer := len (serverKVs ) > 0
392392 hasClient := len (clientKVs ) > 0
393393
@@ -407,13 +407,13 @@ func applyMCPAnnotations(r *pomerium.Route, serverKVs, clientKVs map[string]stri
407407 return nil
408408}
409409
410- func applyMCPServerAnnotations (r * pomerium .Route , kvs map [string ]string ) error {
410+ func applyMCPServerAnnotations (r * configpb .Route , kvs map [string ]string ) error {
411411 // Initialize or get existing server config
412- var serverConfig * pomerium .MCPServer
412+ var serverConfig * configpb .MCPServer
413413 if r .Mcp != nil && r .Mcp .GetServer () != nil {
414414 serverConfig = r .Mcp .GetServer ()
415415 } else {
416- serverConfig = & pomerium .MCPServer {}
416+ serverConfig = & configpb .MCPServer {}
417417 }
418418
419419 for k , v := range kvs {
@@ -435,31 +435,31 @@ func applyMCPServerAnnotations(r *pomerium.Route, kvs map[string]string) error {
435435 serverConfig .MaxRequestBytes = & maxBytes
436436 case model .MCPServerUpstreamOAuth2AuthorizationURLParams :
437437 if serverConfig .UpstreamOauth2 == nil {
438- serverConfig .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
438+ serverConfig .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
439439 }
440440 err := yaml .Unmarshal ([]byte (v ), & serverConfig .UpstreamOauth2 .AuthorizationUrlParams )
441441 if err != nil {
442442 return fmt .Errorf ("invalid mcp_server_upstream_oauth2_authorization_url_params: %w" , err )
443443 }
444444 case model .MCPServerUpstreamOAuth2AuthURL :
445445 if serverConfig .UpstreamOauth2 == nil {
446- serverConfig .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
446+ serverConfig .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
447447 }
448448 if serverConfig .UpstreamOauth2 .Oauth2Endpoint == nil {
449- serverConfig .UpstreamOauth2 .Oauth2Endpoint = & pomerium .OAuth2Endpoint {}
449+ serverConfig .UpstreamOauth2 .Oauth2Endpoint = & configpb .OAuth2Endpoint {}
450450 }
451451 serverConfig .UpstreamOauth2 .Oauth2Endpoint .AuthUrl = v
452452 case model .MCPServerUpstreamOAuth2TokenURL :
453453 if serverConfig .UpstreamOauth2 == nil {
454- serverConfig .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
454+ serverConfig .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
455455 }
456456 if serverConfig .UpstreamOauth2 .Oauth2Endpoint == nil {
457- serverConfig .UpstreamOauth2 .Oauth2Endpoint = & pomerium .OAuth2Endpoint {}
457+ serverConfig .UpstreamOauth2 .Oauth2Endpoint = & configpb .OAuth2Endpoint {}
458458 }
459459 serverConfig .UpstreamOauth2 .Oauth2Endpoint .TokenUrl = v
460460 case model .MCPServerUpstreamOAuth2Scopes :
461461 if serverConfig .UpstreamOauth2 == nil {
462- serverConfig .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
462+ serverConfig .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
463463 }
464464 serverConfig .UpstreamOauth2 .Scopes = strings .Split (v , "," )
465465 for i , scope := range serverConfig .UpstreamOauth2 .Scopes {
@@ -471,16 +471,16 @@ func applyMCPServerAnnotations(r *pomerium.Route, kvs map[string]string) error {
471471 serverConfig .AuthorizationServerUrl = & v
472472 case model .MCPServerUpstreamOAuth2AuthStyle :
473473 if serverConfig .UpstreamOauth2 == nil {
474- serverConfig .UpstreamOauth2 = & pomerium .UpstreamOAuth2 {}
474+ serverConfig .UpstreamOauth2 = & configpb .UpstreamOAuth2 {}
475475 }
476476 if serverConfig .UpstreamOauth2 .Oauth2Endpoint == nil {
477- serverConfig .UpstreamOauth2 .Oauth2Endpoint = & pomerium .OAuth2Endpoint {}
477+ serverConfig .UpstreamOauth2 .Oauth2Endpoint = & configpb .OAuth2Endpoint {}
478478 }
479479 switch v {
480480 case "in_params" :
481- serverConfig .UpstreamOauth2 .Oauth2Endpoint .AuthStyle = pomerium .OAuth2AuthStyle_OAUTH2_AUTH_STYLE_IN_PARAMS .Enum ()
481+ serverConfig .UpstreamOauth2 .Oauth2Endpoint .AuthStyle = configpb .OAuth2AuthStyle_OAUTH2_AUTH_STYLE_IN_PARAMS .Enum ()
482482 case "in_header" :
483- serverConfig .UpstreamOauth2 .Oauth2Endpoint .AuthStyle = pomerium .OAuth2AuthStyle_OAUTH2_AUTH_STYLE_IN_HEADER .Enum ()
483+ serverConfig .UpstreamOauth2 .Oauth2Endpoint .AuthStyle = configpb .OAuth2AuthStyle_OAUTH2_AUTH_STYLE_IN_HEADER .Enum ()
484484 default :
485485 return fmt .Errorf ("invalid mcp_server_upstream_oauth2_auth_style %q: must be 'in_params' or 'in_header'" , v )
486486 }
@@ -491,23 +491,23 @@ func applyMCPServerAnnotations(r *pomerium.Route, kvs map[string]string) error {
491491
492492 // Only create new MCP structure if it doesn't exist
493493 if r .Mcp == nil {
494- r .Mcp = & pomerium .MCP {
495- Mode : & pomerium .MCP_Server {
494+ r .Mcp = & configpb .MCP {
495+ Mode : & configpb .MCP_Server {
496496 Server : serverConfig ,
497497 },
498498 }
499499 } else if r .Mcp .GetServer () == nil {
500500 if r .Mcp .GetClient () != nil {
501501 return fmt .Errorf ("route is already configured as MCP client, cannot add server configuration" )
502502 }
503- r .Mcp .Mode = & pomerium .MCP_Server {
503+ r .Mcp .Mode = & configpb .MCP_Server {
504504 Server : serverConfig ,
505505 }
506506 }
507507 return nil
508508}
509509
510- func applyMCPClientAnnotations (r * pomerium .Route , kvs map [string ]string ) error {
510+ func applyMCPClientAnnotations (r * configpb .Route , kvs map [string ]string ) error {
511511 for k , v := range kvs {
512512 switch k {
513513 case model .MCPClient :
@@ -520,27 +520,27 @@ func applyMCPClientAnnotations(r *pomerium.Route, kvs map[string]string) error {
520520 }
521521 }
522522
523- clientConfig := & pomerium .MCPClient {}
524- r .Mcp = & pomerium .MCP {
525- Mode : & pomerium .MCP_Client {
523+ clientConfig := & configpb .MCPClient {}
524+ r .Mcp = & configpb .MCP {
525+ Mode : & configpb .MCP_Client {
526526 Client : clientConfig ,
527527 },
528528 }
529529 return nil
530530}
531531
532- func applyUpstreamAnnotations (r * pomerium .Route , kvs map [string ]string ) error {
532+ func applyUpstreamAnnotations (r * configpb .Route , kvs map [string ]string ) error {
533533 for k , v := range kvs {
534534 switch k {
535535 case model .UpstreamTunnel :
536536 if r .UpstreamTunnel == nil {
537- r .UpstreamTunnel = & pomerium .UpstreamTunnel {}
537+ r .UpstreamTunnel = & configpb .UpstreamTunnel {}
538538 }
539539 case model .UpstreamTunnelSSHPolicy :
540540 if r .UpstreamTunnel == nil {
541- r .UpstreamTunnel = & pomerium .UpstreamTunnel {}
541+ r .UpstreamTunnel = & configpb .UpstreamTunnel {}
542542 }
543- r .UpstreamTunnel .SshPolicy = & pomerium .PPLPolicy {
543+ r .UpstreamTunnel .SshPolicy = & configpb .PPLPolicy {
544544 Raw : []byte (v ),
545545 }
546546 default :
0 commit comments