Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
chore(go-utils): Changed configuration-service to resource-service (#491
Browse files Browse the repository at this point in the history
)

BREAKING CHANGE: Since the configuration-service is deprecated, all references to “configuration-service” are now replaced by “resource-service”. This will make the go-utils library from version 0.18.0 INCOMPATIBLE with installations using configuration-service.
  • Loading branch information
RealAnna authored Jul 6, 2022
1 parent 3ef0a10 commit 6550348
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion pkg/api/utils/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type InClusterAPIMappings map[InternalService]string

// DefaultInClusterAPIMappings gives you the default InClusterAPIMappings
var DefaultInClusterAPIMappings = InClusterAPIMappings{
ConfigurationService: "configuration-service:8080",
ConfigurationService: "resource-service:8080",
ShipyardController: "shipyard-controller:8080",
ApiService: "api-service:8080",
SecretService: "secret-service:8080",
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/utils/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestApiSetInternalMappings(t *testing.T) {

t.Run("TestInternalAPISet - Override Mappings", func(t *testing.T) {
overrideMappings := InClusterAPIMappings{
ConfigurationService: "special-configuration-service:8080",
ConfigurationService: "special-resource-service:8080",
ShipyardController: "special-shipyard-controller:8080",
ApiService: "speclial-api-service:8080",
SecretService: "special-secret-service:8080",
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/projectUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type ProjectHandler struct {
Scheme string
}

// NewProjectHandler returns a new ProjectHandler which sends all requests directly to the configuration-service
// NewProjectHandler returns a new ProjectHandler which sends all requests directly to the resource-service
func NewProjectHandler(baseURL string) *ProjectHandler {
return NewProjectHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewProjectHandlerWithHTTPClient returns a new ProjectHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewProjectHandlerWithHTTPClient returns a new ProjectHandler which sends all requests directly to the resource-service using the specified http.Client
func NewProjectHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ProjectHandler {
return &ProjectHandler{
BaseURL: httputils.TrimHTTPScheme(baseURL),
Expand All @@ -55,7 +55,7 @@ func NewProjectHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *P
}

// NewAuthenticatedProjectHandler returns a new ProjectHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
// Deprecated: use APISet instead
func NewAuthenticatedProjectHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ProjectHandler {
if httpClient == nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/utils/resourceUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
const pathToResource = "/resource"
const pathToService = "/service"
const pathToStage = "/stage"
const configurationServiceBaseURL = "configuration-service"
const configurationServiceBaseURL = "resource-service"

var ResourceNotFoundError = v2.ResourceNotFoundError

Expand Down Expand Up @@ -205,12 +205,12 @@ func (r *resourceRequest) FromJSON(b []byte) error {
return nil
}

// NewResourceHandler returns a new ResourceHandler which sends all requests directly to the configuration-service
// NewResourceHandler returns a new ResourceHandler which sends all requests directly to the resource-service
func NewResourceHandler(baseURL string) *ResourceHandler {
return NewResourceHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewResourceHandlerWithHTTPClient returns a new ResourceHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewResourceHandlerWithHTTPClient returns a new ResourceHandler which sends all requests directly to the resource-service using the specified http.Client
func NewResourceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ResourceHandler {
return &ResourceHandler{
BaseURL: httputils.TrimHTTPScheme(baseURL),
Expand All @@ -221,7 +221,7 @@ func NewResourceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *
}

// NewAuthenticatedResourceHandler returns a new ResourceHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
// Deprecated: use APISet instead
func NewAuthenticatedResourceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ResourceHandler {
if httpClient == nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/serviceUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ type ServiceHandler struct {
Scheme string
}

// NewServiceHandler returns a new ServiceHandler which sends all requests directly to the configuration-service
// NewServiceHandler returns a new ServiceHandler which sends all requests directly to the resource-service
func NewServiceHandler(baseURL string) *ServiceHandler {
return NewServiceHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewServiceHandlerWithHTTPClient returns a new ServiceHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewServiceHandlerWithHTTPClient returns a new ServiceHandler which sends all requests directly to the resource-service using the specified http.Client
func NewServiceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ServiceHandler {
return &ServiceHandler{
BaseURL: httputils.TrimHTTPScheme(baseURL),
Expand All @@ -50,7 +50,7 @@ func NewServiceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *S
}

// NewAuthenticatedServiceHandler returns a new ServiceHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
// Deprecated: use APISet instead
func NewAuthenticatedServiceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ServiceHandler {
if httpClient == nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/shipyardControllerUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ type ShipyardControllerHandler struct {
Scheme string
}

// NewShipyardControllerHandler returns a new ShipyardControllerHandler which sends all requests directly to the configuration-service
// NewShipyardControllerHandler returns a new ShipyardControllerHandler which sends all requests directly to the resource-service
func NewShipyardControllerHandler(baseURL string) *ShipyardControllerHandler {
return NewShipyardControllerHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewShipyardControllerHandlerWithHTTPClient returns a new ShipyardControllerHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewShipyardControllerHandlerWithHTTPClient returns a new ShipyardControllerHandler which sends all requests directly to the resource-service using the specified http.Client
func NewShipyardControllerHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ShipyardControllerHandler {
return &ShipyardControllerHandler{
BaseURL: httputils.TrimHTTPScheme(baseURL),
Expand All @@ -43,7 +43,7 @@ func NewShipyardControllerHandlerWithHTTPClient(baseURL string, httpClient *http
}

// NewAuthenticatedShipyardControllerHandler returns a new ShipyardControllerHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
// Deprecated: use APISet instead
func NewAuthenticatedShipyardControllerHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ShipyardControllerHandler {
if httpClient == nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/stageUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ type StageHandler struct {
Scheme string
}

// NewStageHandler returns a new StageHandler which sends all requests directly to the configuration-service
// NewStageHandler returns a new StageHandler which sends all requests directly to the resource-service
func NewStageHandler(baseURL string) *StageHandler {
return NewStageHandlerWithHTTPClient(baseURL, &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)})
}

// NewStageHandlerWithHTTPClient returns a new StageHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewStageHandlerWithHTTPClient returns a new StageHandler which sends all requests directly to the resource-service using the specified http.Client
func NewStageHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *StageHandler {
return &StageHandler{
BaseURL: httputils.TrimHTTPScheme(baseURL),
Expand All @@ -45,7 +45,7 @@ func NewStageHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *Sta
}

// NewAuthenticatedStageHandler returns a new StageHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
// Deprecated: use APISet instead
func NewAuthenticatedStageHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *StageHandler {
if httpClient == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/utils/v2/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type InClusterAPIMappings map[InternalService]string

// DefaultInClusterAPIMappings gives you the default InClusterAPIMappings
var DefaultInClusterAPIMappings = InClusterAPIMappings{
ConfigurationService: "configuration-service:8080",
ConfigurationService: "resource-service:8080",
ShipyardController: "shipyard-controller:8080",
ApiService: "api-service:8080",
SecretService: "secret-service:8080",
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/utils/v2/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestApiSetInternalMappings(t *testing.T) {

t.Run("TestInternalAPISet - Override Mappings", func(t *testing.T) {
overrideMappings := InClusterAPIMappings{
ConfigurationService: "special-configuration-service:8080",
ConfigurationService: "special-resource-service:8080",
ShipyardController: "special-shipyard-controller:8080",
ApiService: "speclial-api-service:8080",
SecretService: "special-secret-service:8080",
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/v2/projectUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ type ProjectHandler struct {
scheme string
}

// NewProjectHandler returns a new ProjectHandler which sends all requests directly to the configuration-service
// NewProjectHandler returns a new ProjectHandler which sends all requests directly to the resource-service
func NewProjectHandler(baseURL string) *ProjectHandler {
return NewProjectHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewProjectHandlerWithHTTPClient returns a new ProjectHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewProjectHandlerWithHTTPClient returns a new ProjectHandler which sends all requests directly to the resource-service using the specified http.Client
func NewProjectHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ProjectHandler {
return createProjectHandler(baseURL, "", "", httpClient, "http")
}

// NewAuthenticatedProjectHandler returns a new ProjectHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
func NewAuthenticatedProjectHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ProjectHandler {
baseURL = strings.TrimRight(baseURL, "/")
if !strings.HasSuffix(baseURL, shipyardControllerBaseURL) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/utils/v2/resourceUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
const pathToResource = "/resource"
const pathToService = "/service"
const pathToStage = "/stage"
const configurationServiceBaseURL = "configuration-service"
const configurationServiceBaseURL = "resource-service"

var ResourceNotFoundError = errors.New("Resource not found")

Expand Down Expand Up @@ -215,18 +215,18 @@ func (r *resourceRequest) FromJSON(b []byte) error {
return nil
}

// NewResourceHandler returns a new ResourceHandler which sends all requests directly to the configuration-service
// NewResourceHandler returns a new ResourceHandler which sends all requests directly to the resource-service
func NewResourceHandler(baseURL string) *ResourceHandler {
return NewResourceHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewResourceHandlerWithHTTPClient returns a new ResourceHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewResourceHandlerWithHTTPClient returns a new ResourceHandler which sends all requests directly to the resource-service using the specified http.Client
func NewResourceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ResourceHandler {
return createResourceHandler(baseURL, "", "", httpClient, "http")
}

// NewAuthenticatedResourceHandler returns a new ResourceHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
func NewAuthenticatedResourceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ResourceHandler {
baseURL = strings.TrimRight(baseURL, "/")
if !strings.HasSuffix(baseURL, configurationServiceBaseURL) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/v2/serviceUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ type ServiceHandler struct {
scheme string
}

// NewServiceHandler returns a new ServiceHandler which sends all requests directly to the configuration-service
// NewServiceHandler returns a new ServiceHandler which sends all requests directly to the resource-service
func NewServiceHandler(baseURL string) *ServiceHandler {
return NewServiceHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewServiceHandlerWithHTTPClient returns a new ServiceHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewServiceHandlerWithHTTPClient returns a new ServiceHandler which sends all requests directly to the resource-service using the specified http.Client
func NewServiceHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ServiceHandler {
return createServiceHandler(baseURL, "", "", httpClient, "http")
}

// NewAuthenticatedServiceHandler returns a new ServiceHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
func NewAuthenticatedServiceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ServiceHandler {
baseURL = strings.TrimRight(baseURL, "/")
if !strings.HasSuffix(baseURL, shipyardControllerBaseURL) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/v2/shipyardControllerUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ type ShipyardControllerHandler struct {
scheme string
}

// NewShipyardControllerHandler returns a new ShipyardControllerHandler which sends all requests directly to the configuration-service
// NewShipyardControllerHandler returns a new ShipyardControllerHandler which sends all requests directly to the resource-service
func NewShipyardControllerHandler(baseURL string) *ShipyardControllerHandler {
return NewShipyardControllerHandlerWithHTTPClient(baseURL, &http.Client{Transport: wrapOtelTransport(getClientTransport(nil))})
}

// NewShipyardControllerHandlerWithHTTPClient returns a new ShipyardControllerHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewShipyardControllerHandlerWithHTTPClient returns a new ShipyardControllerHandler which sends all requests directly to the resource-service using the specified http.Client
func NewShipyardControllerHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *ShipyardControllerHandler {
return createShipyardControllerHandler(baseURL, "", "", httpClient, "http")
}

// NewAuthenticatedShipyardControllerHandler returns a new ShipyardControllerHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
func NewAuthenticatedShipyardControllerHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ShipyardControllerHandler {
baseURL = strings.TrimRight(baseURL, "/")
if !strings.HasSuffix(baseURL, shipyardControllerBaseURL) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/utils/v2/stageUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ type StageHandler struct {
scheme string
}

// NewStageHandler returns a new StageHandler which sends all requests directly to the configuration-service
// NewStageHandler returns a new StageHandler which sends all requests directly to the resource-service
func NewStageHandler(baseURL string) *StageHandler {
return NewStageHandlerWithHTTPClient(baseURL, &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)})
}

// NewStageHandlerWithHTTPClient returns a new StageHandler which sends all requests directly to the configuration-service using the specified http.Client
// NewStageHandlerWithHTTPClient returns a new StageHandler which sends all requests directly to the resource-service using the specified http.Client
func NewStageHandlerWithHTTPClient(baseURL string, httpClient *http.Client) *StageHandler {
return createStageHandler(baseURL, "", "", httpClient, "http")
}

// NewAuthenticatedStageHandler returns a new StageHandler that authenticates at the api via the provided token
// and sends all requests directly to the configuration-service
// and sends all requests directly to the resource-service
func NewAuthenticatedStageHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *StageHandler {
baseURL = strings.TrimRight(baseURL, "/")
if !strings.HasSuffix(baseURL, shipyardControllerBaseURL) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/keptn/keptn_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type SLIConfig struct {
Indicators map[string]string `json:"indicators" yaml:"indicators"`
}

const ConfigurationServiceURL = "configuration-service:8080"
const ConfigurationServiceURL = "resource-service:8080"
const DatastoreURL = "mongodb-datastore:8080"
const DefaultLoggingServiceName = "keptn"

Expand Down Expand Up @@ -229,7 +229,7 @@ func GetServiceEndpoint(service string) (url.URL, error) {
url.Scheme = "http"
}

// check if only a service name has been provided, e.g. 'configuration-service'
// check if only a service name has been provided, e.g. 'resource-service'
if url.Host == "" && url.Path != "" {
url.Host = url.Path
url.Path = ""
Expand Down
12 changes: 6 additions & 6 deletions pkg/lib/keptn/keptn_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ func TestGetServiceEndpoint(t *testing.T) {
args: args{
service: "CONFIGURATION_SERVICE",
},
envVarValue: "http://configuration-service",
envVarValue: "http://resource-service",
want: url.URL{
Scheme: "http",
Host: "configuration-service",
Host: "resource-service",
},
wantErr: false,
},
Expand All @@ -160,10 +160,10 @@ func TestGetServiceEndpoint(t *testing.T) {
args: args{
service: "CONFIGURATION_SERVICE",
},
envVarValue: "https://configuration-service",
envVarValue: "https://resource-service",
want: url.URL{
Scheme: "https",
Host: "configuration-service",
Host: "resource-service",
},
wantErr: false,
},
Expand All @@ -172,10 +172,10 @@ func TestGetServiceEndpoint(t *testing.T) {
args: args{
service: "CONFIGURATION_SERVICE",
},
envVarValue: "configuration-service",
envVarValue: "resource-service",
want: url.URL{
Scheme: "http",
Host: "configuration-service",
Host: "resource-service",
},
wantErr: false,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type EnvConfig struct {
APIProxyHTTPTimeout string `envconfig:"API_PROXY_HTTP_TIMEOUT" default:"30"`
ConfigurationServiceURL string `envconfig:"CONFIGURATION_SERVICE" default:"configuration-service:8080"`
ConfigurationServiceURL string `envconfig:"CONFIGURATION_SERVICE" default:"resource-service:8080"`
EventBrokerURL string `envconfig:"EVENTBROKER" default:"nats://keptn-nats"`
PubSubTopic string `envconfig:"PUBSUB_TOPIC" default:""`
HealthEndpointPort string `envconfig:"HEALTH_ENDPOINT_PORT" default:"8080"`
Expand Down

0 comments on commit 6550348

Please sign in to comment.