Add some fixes to allow for registering via consul connect envoy -gateway api (#16219)

* Add some fixes to allow for registering via consul connect envoy -gateway api

* Fix infinite recursion

---------

Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
This commit is contained in:
Andrew Stucki 2023-02-09 15:28:04 -05:00 committed by GitHub
parent ba862ab6ad
commit 99cf421e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 40 deletions

View File

@ -37,6 +37,11 @@ const (
// This service will ingress connections based of configuration defined in // This service will ingress connections based of configuration defined in
// the ingress-gateway config entry. // the ingress-gateway config entry.
ServiceKindIngressGateway ServiceKind = "ingress-gateway" ServiceKindIngressGateway ServiceKind = "ingress-gateway"
// ServiceKindAPIGateway is an API Gateway for the Connect feature.
// This service will ingress connections based of configuration defined in
// the api-gateway config entry.
ServiceKindAPIGateway ServiceKind = "api-gateway"
) )
// UpstreamDestType is the type of upstream discovery mechanism. // UpstreamDestType is the type of upstream discovery mechanism.

View File

@ -38,45 +38,13 @@ type TCPRouteConfigEntry struct {
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
} }
func (a *TCPRouteConfigEntry) GetKind() string { func (a *TCPRouteConfigEntry) GetKind() string { return TCPRoute }
return TCPRoute func (a *TCPRouteConfigEntry) GetName() string { return a.Name }
} func (a *TCPRouteConfigEntry) GetPartition() string { return a.Partition }
func (a *TCPRouteConfigEntry) GetNamespace() string { return a.Namespace }
func (a *TCPRouteConfigEntry) GetName() string { func (a *TCPRouteConfigEntry) GetMeta() map[string]string { return a.Meta }
if a != nil { func (a *TCPRouteConfigEntry) GetCreateIndex() uint64 { return a.CreateIndex }
return "" func (a *TCPRouteConfigEntry) GetModifyIndex() uint64 { return a.ModifyIndex }
}
return a.Name
}
func (a *TCPRouteConfigEntry) GetPartition() string {
if a != nil {
return ""
}
return a.Partition
}
func (a *TCPRouteConfigEntry) GetNamespace() string {
if a != nil {
return ""
}
return a.GetNamespace()
}
func (a *TCPRouteConfigEntry) GetMeta() map[string]string {
if a != nil {
return nil
}
return a.GetMeta()
}
func (a *TCPRouteConfigEntry) GetCreateIndex() uint64 {
return a.CreateIndex
}
func (a *TCPRouteConfigEntry) GetModifyIndex() uint64 {
return a.ModifyIndex
}
// TCPService is a service reference for a TCPRoute // TCPService is a service reference for a TCPRoute
type TCPService struct { type TCPService struct {

View File

@ -92,6 +92,7 @@ const meshGatewayVal = "mesh"
var defaultEnvoyVersion = xdscommon.EnvoyVersions[0] var defaultEnvoyVersion = xdscommon.EnvoyVersions[0]
var supportedGateways = map[string]api.ServiceKind{ var supportedGateways = map[string]api.ServiceKind{
"api": api.ServiceKindAPIGateway,
"mesh": api.ServiceKindMeshGateway, "mesh": api.ServiceKindMeshGateway,
"terminating": api.ServiceKindTerminatingGateway, "terminating": api.ServiceKindTerminatingGateway,
"ingress": api.ServiceKindIngressGateway, "ingress": api.ServiceKindIngressGateway,
@ -330,7 +331,7 @@ func (c *cmd) run(args []string) int {
if c.gateway != "" { if c.gateway != "" {
kind, ok := supportedGateways[c.gateway] kind, ok := supportedGateways[c.gateway]
if !ok { if !ok {
c.UI.Error("Gateway must be one of: terminating, mesh, or ingress") c.UI.Error("Gateway must be one of: api, terminating, mesh, or ingress")
return 1 return 1
} }
c.gatewayKind = kind c.gatewayKind = kind