From 65503489d75aac53e74e089babc7a5258887d93c Mon Sep 17 00:00:00 2001 From: RealAnna <89971034+RealAnna@users.noreply.github.com> Date: Wed, 6 Jul 2022 12:56:48 +0200 Subject: [PATCH] chore(go-utils): Changed configuration-service to resource-service (#491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkg/api/utils/internal.go | 2 +- pkg/api/utils/internal_test.go | 2 +- pkg/api/utils/projectUtils.go | 6 +++--- pkg/api/utils/resourceUtils.go | 8 ++++---- pkg/api/utils/serviceUtils.go | 6 +++--- pkg/api/utils/shipyardControllerUtils.go | 6 +++--- pkg/api/utils/stageUtils.go | 6 +++--- pkg/api/utils/v2/internal.go | 2 +- pkg/api/utils/v2/internal_test.go | 2 +- pkg/api/utils/v2/projectUtils.go | 6 +++--- pkg/api/utils/v2/resourceUtils.go | 8 ++++---- pkg/api/utils/v2/serviceUtils.go | 6 +++--- pkg/api/utils/v2/shipyardControllerUtils.go | 6 +++--- pkg/api/utils/v2/stageUtils.go | 6 +++--- pkg/lib/keptn/keptn_base.go | 4 ++-- pkg/lib/keptn/keptn_base_test.go | 12 ++++++------ pkg/sdk/internal/config/config.go | 2 +- 17 files changed, 45 insertions(+), 45 deletions(-) diff --git a/pkg/api/utils/internal.go b/pkg/api/utils/internal.go index c4a28f01..4abf9eb4 100644 --- a/pkg/api/utils/internal.go +++ b/pkg/api/utils/internal.go @@ -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", diff --git a/pkg/api/utils/internal_test.go b/pkg/api/utils/internal_test.go index eeaa8ab0..1db7a592 100644 --- a/pkg/api/utils/internal_test.go +++ b/pkg/api/utils/internal_test.go @@ -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", diff --git a/pkg/api/utils/projectUtils.go b/pkg/api/utils/projectUtils.go index 72426aad..b391a6ef 100644 --- a/pkg/api/utils/projectUtils.go +++ b/pkg/api/utils/projectUtils.go @@ -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), @@ -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 { diff --git a/pkg/api/utils/resourceUtils.go b/pkg/api/utils/resourceUtils.go index 308f2605..c219d260 100644 --- a/pkg/api/utils/resourceUtils.go +++ b/pkg/api/utils/resourceUtils.go @@ -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 @@ -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), @@ -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 { diff --git a/pkg/api/utils/serviceUtils.go b/pkg/api/utils/serviceUtils.go index b22be79f..f5bb0cee 100644 --- a/pkg/api/utils/serviceUtils.go +++ b/pkg/api/utils/serviceUtils.go @@ -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), @@ -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 { diff --git a/pkg/api/utils/shipyardControllerUtils.go b/pkg/api/utils/shipyardControllerUtils.go index 001a15ca..691bf0ff 100644 --- a/pkg/api/utils/shipyardControllerUtils.go +++ b/pkg/api/utils/shipyardControllerUtils.go @@ -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), @@ -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 { diff --git a/pkg/api/utils/stageUtils.go b/pkg/api/utils/stageUtils.go index 404196b3..473aa18a 100644 --- a/pkg/api/utils/stageUtils.go +++ b/pkg/api/utils/stageUtils.go @@ -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), @@ -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 { diff --git a/pkg/api/utils/v2/internal.go b/pkg/api/utils/v2/internal.go index f0a23396..6f4464aa 100644 --- a/pkg/api/utils/v2/internal.go +++ b/pkg/api/utils/v2/internal.go @@ -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", diff --git a/pkg/api/utils/v2/internal_test.go b/pkg/api/utils/v2/internal_test.go index d192bbca..8782489d 100644 --- a/pkg/api/utils/v2/internal_test.go +++ b/pkg/api/utils/v2/internal_test.go @@ -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", diff --git a/pkg/api/utils/v2/projectUtils.go b/pkg/api/utils/v2/projectUtils.go index b8a79bb8..a92ab16c 100644 --- a/pkg/api/utils/v2/projectUtils.go +++ b/pkg/api/utils/v2/projectUtils.go @@ -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) { diff --git a/pkg/api/utils/v2/resourceUtils.go b/pkg/api/utils/v2/resourceUtils.go index 9c5e70d2..10f203d6 100644 --- a/pkg/api/utils/v2/resourceUtils.go +++ b/pkg/api/utils/v2/resourceUtils.go @@ -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") @@ -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) { diff --git a/pkg/api/utils/v2/serviceUtils.go b/pkg/api/utils/v2/serviceUtils.go index 9b982e64..0e63145c 100644 --- a/pkg/api/utils/v2/serviceUtils.go +++ b/pkg/api/utils/v2/serviceUtils.go @@ -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) { diff --git a/pkg/api/utils/v2/shipyardControllerUtils.go b/pkg/api/utils/v2/shipyardControllerUtils.go index 71660877..16c4fac1 100644 --- a/pkg/api/utils/v2/shipyardControllerUtils.go +++ b/pkg/api/utils/v2/shipyardControllerUtils.go @@ -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) { diff --git a/pkg/api/utils/v2/stageUtils.go b/pkg/api/utils/v2/stageUtils.go index 66add1f1..eb2fc37f 100644 --- a/pkg/api/utils/v2/stageUtils.go +++ b/pkg/api/utils/v2/stageUtils.go @@ -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) { diff --git a/pkg/lib/keptn/keptn_base.go b/pkg/lib/keptn/keptn_base.go index 4a9da2e4..6c0ce020 100644 --- a/pkg/lib/keptn/keptn_base.go +++ b/pkg/lib/keptn/keptn_base.go @@ -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" @@ -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 = "" diff --git a/pkg/lib/keptn/keptn_base_test.go b/pkg/lib/keptn/keptn_base_test.go index e0ffef19..ddef7362 100644 --- a/pkg/lib/keptn/keptn_base_test.go +++ b/pkg/lib/keptn/keptn_base_test.go @@ -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, }, @@ -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, }, @@ -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, }, diff --git a/pkg/sdk/internal/config/config.go b/pkg/sdk/internal/config/config.go index c6ec6f0e..fa5e4ef6 100644 --- a/pkg/sdk/internal/config/config.go +++ b/pkg/sdk/internal/config/config.go @@ -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"`