Skip to content

Commit

Permalink
remove consul
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaliMatharaarachchi committed Feb 29, 2024
1 parent 5d259f1 commit 8e475cd
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 1,356 deletions.
11 changes: 0 additions & 11 deletions adapter/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ package config
// Configuration object which is populated with default values.
var defaultConfig = &Config{
Adapter: adapter{
Consul: consul{
Enabled: false,
URL: "https://169.254.1.1:8501",
PollInterval: 5,
ACLToken: "d3a2a719-4221-8c65-5212-58d4727427ac",
ApkServiceName: "wso2",
ServiceMeshEnabled: false,
CaCertFile: "/home/wso2/security/truststore/consul/consul-agent-ca.pem",
CertFile: "/home/wso2/security/truststore/consul/local-dc-client-consul-0.pem",
KeyFile: "/home/wso2/security/truststore/consul/local-dc-client-consul-0-key.pem",
},
Keystore: keystore{
KeyPath: "/home/wso2/security/keystore/adapter.key",
CertPath: "/home/wso2/security/keystore/adapter.crt",
Expand Down
23 changes: 0 additions & 23 deletions adapter/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ type Config struct {

// Adapter related Configurations
type adapter struct {
// Consul represents the configuration required to connect to consul service discovery
Consul consul
// Keystore contains the keyFile and Cert File of the adapter
Keystore keystore
// Trusted Certificates
Expand Down Expand Up @@ -164,27 +162,6 @@ type enforcer struct {
Client httpClient
}

type consul struct {
// Enabled whether consul service discovery should be enabled
Enabled bool
// URL url of the consul client in format: http(s)://host:port
URL string
// PollInterval how frequently consul API should be polled to get updates (in seconds)
PollInterval int
// ACLToken Access Control Token required to invoke HTTP API
ACLToken string
// ApkServiceName service name that Microgateway registered in Consul Service Mesh
ApkServiceName string
// ServiceMeshEnabled whether Consul service mesh is enabled
ServiceMeshEnabled bool
// CaCertFile path to the CA cert file(PEM encoded) required for tls connection between adapter and a consul client
CaCertFile string
// CertFile path to the cert file(PEM encoded) required for tls connection between adapter and a consul client
CertFile string
// KeyFile path to the key file(PEM encoded) required for tls connection between adapter and a consul client
KeyFile string
}

// Router to enforcer request body passing configurations
type payloadPassingToEnforcer struct {
MaxRequestBytes uint32
Expand Down
202 changes: 0 additions & 202 deletions adapter/internal/discovery/xds/consul.go

This file was deleted.

5 changes: 0 additions & 5 deletions adapter/internal/logging/logging_constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const (
const (
Error1400 = 1400
Error1401 = 1401
Error1402 = 1402
Error1403 = 1403
Error1410 = 1410
Error1411 = 1411
Expand Down Expand Up @@ -169,10 +168,6 @@ var Mapper = map[int]logging.ErrorDetails{
ErrorCode: Error1401,
Message: "Error in Stream request type.",
},
Error1402: {
ErrorCode: Error1402,
Message: "Consul syntax parse error.",
},
Error1403: {
ErrorCode: Error1403,
Message: "Internal Error while marshalling the upstream TLS Context.",
Expand Down
11 changes: 0 additions & 11 deletions adapter/internal/oasparser/envoyconf/routes_with_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import (
logging "github.com/wso2/apk/adapter/internal/logging"
"github.com/wso2/apk/adapter/internal/oasparser/constants"
"github.com/wso2/apk/adapter/internal/oasparser/model"
"github.com/wso2/apk/adapter/internal/svcdiscovery"
dpv1alpha2 "github.com/wso2/apk/common-go-libs/apis/dp/v1alpha2"
"google.golang.org/protobuf/proto"
gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
Expand Down Expand Up @@ -563,16 +562,6 @@ func processEndpoints(clusterName string, clusterDetails *model.EndpointCluster,
}
}

// service discovery itself will be handling loadbancing etc.
// Therefore mutiple endpoint support is not needed, hence consider only.
serviceDiscoveryString := clusterDetails.Endpoints[0].ServiceDiscoveryString
if serviceDiscoveryString != "" {
//add the api level cluster name to the ClusterConsulKeyMap
svcdiscovery.ClusterConsulKeyMap[clusterName] = serviceDiscoveryString
logger.LoggerOasparser.Debugln("Consul cluster added for x-wso2-endpoints: ", clusterName, " ",
serviceDiscoveryString)
}

return &cluster, addresses, nil
}

Expand Down
9 changes: 2 additions & 7 deletions adapter/internal/oasparser/model/adapter_internal_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ type Endpoint struct {
// Port of the endpoint.
// If the port is not specified, 80 is assigned if URLType is http
// 443 is assigned if URLType is https
Port uint32
//ServiceDiscoveryQuery consul query for service discovery
ServiceDiscoveryString string
RawURL string
Port uint32
RawURL string
// Trusted CA Cerificate for the endpoint
Certificate []byte
// Subject Alternative Names to verify in the public certificate
Expand Down Expand Up @@ -953,9 +951,6 @@ func (adapterInternalAPI *AdapterInternalAPI) SetInfoGQLRouteCR(gqlRoute *dpv1al
}

func (endpoint *Endpoint) validateEndpoint() error {
if len(endpoint.ServiceDiscoveryString) > 0 {
return nil
}
if endpoint.Port == 0 || endpoint.Port > 65535 {
return errors.New("endpoint port value should be between 0 and 65535")
}
Expand Down
Loading

0 comments on commit 8e475cd

Please sign in to comment.