From 45f182638103dabda8aa89301f7ffed295849647 Mon Sep 17 00:00:00 2001 From: leoporoli Date: Mon, 16 Sep 2024 14:59:57 -0300 Subject: [PATCH] feat: dynamic baseline flow (#24) * adding IsBaline field in flow premitive * infering the baseline flow ID from base cluster topology namespace value * gomod2nix updated * echo services and deployments in Validate cluster resources endpoint in test * edited the expected deployments name in the test * renaming baseline flow ID and refactor traffic logic to adapt it to this flow ID change * adding baseline_prefix argument in the trace-route GET /route calls * adding baseline value in the gateway lua script * replace prod concept with baseline in comments --- .github/workflows/ci-e2e-tests.yml | 11 +++--- kontrol-service/api/server.go | 43 +++++++++++---------- kontrol-service/engine/docker.go | 5 ++- kontrol-service/engine/flow/constants.go | 14 +++---- kontrol-service/engine/flow/dev_flow.go | 13 ++++--- kontrol-service/engine/flow/render.go | 26 ++++++++----- kontrol-service/engine/template/dev-flow.go | 9 +++-- kontrol-service/go.mod | 4 +- kontrol-service/go.sum | 8 ++-- kontrol-service/gomod2nix.toml | 4 +- 10 files changed, 73 insertions(+), 64 deletions(-) diff --git a/.github/workflows/ci-e2e-tests.yml b/.github/workflows/ci-e2e-tests.yml index 0ef962b..5f43eb3 100644 --- a/.github/workflows/ci-e2e-tests.yml +++ b/.github/workflows/ci-e2e-tests.yml @@ -71,8 +71,7 @@ jobs: if [ "${services}" != "cartservice frontend postgres productcatalogservice" ]; then exit 1; fi deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs) echo "Deployments: $deployments" - if [ "${deployments}" != "cartservice-prod frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi - + if [ "${deployments}" != "cartservice-baseline frontend-baseline postgres-baseline productcatalogservice-baseline" ]; then exit 1; fi - name: Validate topology endpoint run: | tenant_id=${{ steps.tenant.outputs.id }} @@ -87,7 +86,7 @@ jobs: tenant_id=${{ steps.tenant.outputs.id }} deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs) echo "Deployments: $deployments" - if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi + if [ "${deployments}" != "cartservice-baseline frontend-baseline frontend-${flow_id} postgres-baseline productcatalogservice-baseline" ]; then exit 1; fi KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id} KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id} @@ -99,7 +98,7 @@ jobs: tenant_id=${{ steps.tenant.outputs.id }} deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs) echo "Deployments: $deployments" - if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-${flow_id} productcatalogservice-prod" ]; then exit 1; fi + if [ "${deployments}" != "cartservice-baseline frontend-baseline frontend-${flow_id} postgres-baseline productcatalogservice-baseline productcatalogservice-${flow_id}" ]; then exit 1; fi KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id} KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id} @@ -121,8 +120,8 @@ jobs: - name: Delete base topology and dev flows run: | - KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete prod - if KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep prod; then echo "Topologies not deleted"; exit 1; fi + KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete baseline + if KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep baseline; then echo "Topologies not deleted"; exit 1; fi tenant_id=${{ steps.tenant.outputs.id }} deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs) if [ "${deployments}" != "" ]; then echo "Deployments list not empty"; exit 1; fi diff --git a/kontrol-service/api/server.go b/kontrol-service/api/server.go index c89ed9b..92772cd 100644 --- a/kontrol-service/api/server.go +++ b/kontrol-service/api/server.go @@ -26,7 +26,7 @@ import ( ) const ( - prodFlowId = "prod" + defaultBaselineFlowId = "baseline" ) // optional code omitted @@ -67,27 +67,27 @@ func (sv *Server) GetTenantUuidFlows(_ context.Context, request api.GetTenantUui finalTopology := flow.MergeClusterTopologies(*clusterTopology, lo.Values(allFlows)) flowHostMapping := finalTopology.GetFlowHostMapping() - resp := lo.MapToSlice(flowHostMapping, func(flowId string, flowUrls []string) apitypes.Flow { - isBaselineFlow := flowId == prodFlowId + // the baseline flow ID uses the base cluster topology namespace name + isBaselineFlow := flowId == clusterTopology.Namespace return apitypes.Flow{FlowId: flowId, FlowUrls: flowUrls, IsBaseline: &isBaselineFlow} }) return api.GetTenantUuidFlows200JSONResponse(resp), nil } func (sv *Server) PostTenantUuidDeploy(_ context.Context, request api.PostTenantUuidDeployRequestObject) (api.PostTenantUuidDeployResponseObject, error) { - logrus.Infof("deploying prod cluster for tenant '%s'", request.Uuid) + logrus.Infof("deploying baseline cluster for tenant '%s'", request.Uuid) sv.analyticsWrapper.TrackEvent(EVENT_DEPLOY, request.Uuid) serviceConfigs := *request.Body.ServiceConfigs ingressConfigs := *request.Body.IngressConfigs namespace := *request.Body.Namespace if namespace == "" { - namespace = prodFlowId + namespace = defaultBaselineFlowId } - flowId := prodFlowId - err, urls := applyProdOnlyFlow(sv, request.Uuid, serviceConfigs, ingressConfigs, namespace, flowId) + flowId := namespace + urls, err := applyProdOnlyFlow(sv, request.Uuid, serviceConfigs, ingressConfigs, namespace, flowId) if err != nil { errMsg := fmt.Sprintf("An error occurred deploying flow '%v'", flowId) errResp := api.ErrorJSONResponse{ @@ -105,14 +105,15 @@ func (sv *Server) DeleteTenantUuidFlowFlowId(_ context.Context, request api.Dele logrus.Infof("deleting dev flow for tenant '%s'", request.Uuid) sv.analyticsWrapper.TrackEvent(EVENT_FLOW_DELETE, request.Uuid) - _, allFlows, _, _, _, err := getTenantTopologies(sv, request.Uuid) + baseClusterTopology, allFlows, _, _, _, err := getTenantTopologies(sv, request.Uuid) if err != nil { resourceType := "tenant" missing := api.NotFoundJSONResponse{ResourceType: resourceType, Id: request.Uuid} return api.DeleteTenantUuidFlowFlowId404JSONResponse{NotFoundJSONResponse: missing}, nil } - if request.FlowId == prodFlowId { + // the baseline flow ID uses the base cluster topology namespace name + if request.FlowId == baseClusterTopology.Namespace { // We received a request to delete the base topology, so we do that + the flows err = deleteTenantTopologies(sv, request.Uuid) if err != nil { @@ -393,48 +394,49 @@ func (sv *Server) PostTenantUuidTemplatesCreate(_ context.Context, request api.P } // ============================================================================================================ -func applyProdOnlyFlow(sv *Server, tenantUuidStr string, serviceConfigs []apitypes.ServiceConfig, ingressConfigs []apitypes.IngressConfig, namespace string, flowID string) (error, []string) { +// apply the baseline flow which can be also called prod flow which was the first name used +func applyProdOnlyFlow(sv *Server, tenantUuidStr string, serviceConfigs []apitypes.ServiceConfig, ingressConfigs []apitypes.IngressConfig, namespace string, flowID string) ([]string, error) { clusterTopology, err := engine.GenerateProdOnlyCluster(flowID, serviceConfigs, ingressConfigs, namespace) if err != nil { - return err, []string{} + return []string{}, err } tenant, err := sv.db.GetOrCreateTenant(tenantUuidStr) if err != nil { logrus.Errorf("an error occured while getting the tenant %s\n: '%v'", tenantUuidStr, err.Error()) - return err, nil + return nil, err } clusterTopologyJson, err := json.Marshal(clusterTopology) if err != nil { logrus.Errorf("an error occured while encoding the cluster topology for tenant %s, error was \n: '%v'", tenantUuidStr, err.Error()) - return err, nil + return nil, err } tenant.BaseClusterTopology = clusterTopologyJson serviceConfigsJson, err := json.Marshal(serviceConfigs) if err != nil { logrus.Errorf("an error occured while encoding the service configs for tenant %s, error was \n: '%v'", tenantUuidStr, err.Error()) - return err, nil + return nil, err } tenant.ServiceConfigs = serviceConfigsJson ingressConfigsJson, err := json.Marshal(ingressConfigs) if err != nil { logrus.Errorf("an error occured while encoding the ingress configs for tenant %s, error was \n: '%v'", tenantUuidStr, err.Error()) - return err, nil + return nil, err } tenant.IngressConfigs = ingressConfigsJson err = sv.db.SaveTenant(tenant) if err != nil { logrus.Errorf("an error occured while saving tenant %s. erro was \n: '%v'", tenant.TenantId, err.Error()) - return err, nil + return nil, err } flowHostMapping := clusterTopology.GetFlowHostMapping() - return nil, flowHostMapping[flowID] + return flowHostMapping[flowID], nil } // ============================================================================================================ @@ -459,7 +461,8 @@ func applyProdDevFlow(sv *Server, tenantUuidStr string, patches []flow_spec.Serv } serviceConfigs = template.ApplyTemplateOverrides(serviceConfigs, templateSpec) - baselineFlowID := prodFlowId + // the baseline flow ID uses the base cluster topology namespace name + baselineFlowID := baseClusterTopologyMaybeWithTemplateOverrides.Namespace baseClusterTopologyWithTemplateOverridesPtr, err := engine.GenerateProdOnlyCluster(baselineFlowID, serviceConfigs, ingressConfigs, baseTopology.Namespace) if err != nil { @@ -546,8 +549,8 @@ func getTenantTopologies(sv *Server, tenantUuidStr string) (*resolved.ClusterTop return nil, nil, nil, nil, nil, err } } else { - baseClusterTopology.FlowID = prodFlowId - baseClusterTopology.Namespace = prodFlowId + baseClusterTopology.FlowID = defaultBaselineFlowId + baseClusterTopology.Namespace = defaultBaselineFlowId } var serviceConfigs []apitypes.ServiceConfig diff --git a/kontrol-service/engine/docker.go b/kontrol-service/engine/docker.go index 65b8abd..8e1e07b 100644 --- a/kontrol-service/engine/docker.go +++ b/kontrol-service/engine/docker.go @@ -19,10 +19,11 @@ import ( "kardinal.kontrol-service/types/flow_spec" ) +// GenerateProdOnlyCluster create the baseline cluster which can be also called prod cluster which was the first name used func GenerateProdOnlyCluster(flowID string, serviceConfigs []apitypes.ServiceConfig, ingressConfigs []apitypes.IngressConfig, namespace string) (*resolved.ClusterTopology, error) { clusterTopology, err := generateClusterTopology(serviceConfigs, ingressConfigs, namespace, flowID) if err != nil { - return nil, stacktrace.Propagate(err, "An error occured generating the cluster topology from the service configs") + return nil, stacktrace.Propagate(err, "An error occurred generating the cluster topology from the service configs") } return clusterTopology, nil @@ -58,7 +59,7 @@ func GenerateProdDevCluster(baseClusterTopologyMaybeWithTemplateOverrides *resol clusterTopology, err := flow.CreateDevFlow(pluginRunner, *baseClusterTopologyMaybeWithTemplateOverrides, *baseTopology, flowPatch) if err != nil { - return nil, stacktrace.Propagate(err, "An error occured generating the cluster topology from the service configs") + return nil, stacktrace.Propagate(err, "An error occurred generating the cluster topology from the service configs") } return clusterTopology, nil diff --git a/kontrol-service/engine/flow/constants.go b/kontrol-service/engine/flow/constants.go index b0aa885..00e9530 100644 --- a/kontrol-service/engine/flow/constants.go +++ b/kontrol-service/engine/flow/constants.go @@ -74,7 +74,7 @@ function determine_destination(request_handle, trace_id, hostname) "outbound|8080||trace-router.default.svc.cluster.local", { [":method"] = "GET", - [":path"] = "/route?trace_id=" .. trace_id .. "&hostname=" .. hostname, + [":path"] = "/route?trace_id=" .. trace_id .. "&hostname=" .. hostname .. "&baseline_prefix=%s", [":authority"] = "trace-router.default.svc.cluster.local" }, "", @@ -82,8 +82,8 @@ function determine_destination(request_handle, trace_id, hostname) ) if not headers or headers[":status"] ~= "200" then - request_handle:logWarn("Failed to determine destination, falling back to prod") - return hostname .. "-prod" -- Fallback to prod + request_handle:logWarn("Failed to determine destination, falling back to baseline") + return hostname .. "-%s" -- Fallback to baseline end return body @@ -91,10 +91,6 @@ end ` luaFilterType = "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua" - - // this is related to the prod flowID and prod default namespace - // TODO find a way to centralize this value for all of these concepts (Service.version, flowID and default namespace) - prodVersion = "prod" ) func generateLuaTraceHeaderPriorities() string { @@ -109,6 +105,6 @@ func generateLuaTraceHeaderPriorities() string { sb.WriteString("}") return sb.String() } -func getOutgoingRequestTraceIDFilter() string { - return fmt.Sprintf(outgoingRequestTraceIDFilterTemplate, generateLuaTraceHeaderPriorities()) +func getOutgoingRequestTraceIDFilter(baselineHostName string) string { + return fmt.Sprintf(outgoingRequestTraceIDFilterTemplate, generateLuaTraceHeaderPriorities(), baselineHostName, baselineHostName) } diff --git a/kontrol-service/engine/flow/dev_flow.go b/kontrol-service/engine/flow/dev_flow.go index 2d3bb41..f883bbb 100644 --- a/kontrol-service/engine/flow/dev_flow.go +++ b/kontrol-service/engine/flow/dev_flow.go @@ -56,9 +56,12 @@ func CreateDevFlow(pluginRunner *plugins.PluginRunner, baseClusterTopologyMaybeW } } - // Replace "prod" version services with baseTopology versions + // the baseline topology flow ID and flow version are equal to the namespace these three should use same value + baselineFlowVersion := baseTopology.Namespace + // Replace "baseline" version services with baseTopology versions for i, service := range topologyRef.Services { - if service.Version == prodVersion { + + if service.Version == baselineFlowVersion { prodService, err := baseTopology.GetService(service.ServiceID) if err != nil { return nil, fmt.Errorf("failed to get prod service %s: %v", service.ServiceID, err) @@ -73,7 +76,7 @@ func CreateDevFlow(pluginRunner *plugins.PluginRunner, baseClusterTopologyMaybeW // postgres is marked as shared, we mark its parent "cartservice" as shared // cartservice then happens in the loop and we try again (currently we don't as we check if version isn't shared) for _, service := range topology.Services { - if service.IsShared && service.Version != prodVersion && service.Version != constants.SharedVersionVersionString { + if service.IsShared && service.Version != baselineFlowVersion && service.Version != constants.SharedVersionVersionString { logrus.Infof("Marking service '%v' as shared, current version '%v'", service.ServiceID, service.Version) originalVersion := service.Version service.Version = constants.SharedVersionVersionString @@ -91,14 +94,14 @@ func CreateDevFlow(pluginRunner *plugins.PluginRunner, baseClusterTopologyMaybeW // Update service dependencies for i, dependency := range topologyRef.ServiceDependencies { - if dependency.Service.Version == prodVersion { + if dependency.Service.Version == baselineFlowVersion { prodService, err := baseTopology.GetService(dependency.Service.ServiceID) if err != nil { return nil, fmt.Errorf("failed to get prod service %s for dependency: %v", dependency.Service.ServiceID, err) } topologyRef.ServiceDependencies[i].Service = prodService } - if dependency.DependsOnService.Version == prodVersion { + if dependency.DependsOnService.Version == baselineFlowVersion { prodDependsOnService, err := baseTopology.GetService(dependency.DependsOnService.ServiceID) if err != nil { return nil, fmt.Errorf("failed to get prod service %s for dependsOn: %v", dependency.DependsOnService.ServiceID, err) diff --git a/kontrol-service/engine/flow/render.go b/kontrol-service/engine/flow/render.go index c275a0d..5411977 100644 --- a/kontrol-service/engine/flow/render.go +++ b/kontrol-service/engine/flow/render.go @@ -89,7 +89,9 @@ func RenderClusterResources(clusterTopology *resolved.ClusterTopology, namespace } } // TODO: make it to use a list of Ingresses - gatewayFilter := getEnvoyFilterForGateway(servicesAgainstVersions, versionsAgainstExtHost, sharedServiceBackupVersions) + // the baseline topology (or prod topology) flow ID and flow version and host are equal to the namespace these four should use same value + baselineHostName := namespace + gatewayFilter := getEnvoyFilterForGateway(servicesAgainstVersions, versionsAgainstExtHost, sharedServiceBackupVersions, baselineHostName) envoyFilters = append(envoyFilters, *gatewayFilter) return types.ClusterResources{ @@ -228,6 +230,8 @@ func getVirtualService(serviceID string, services []*resolved.Service, namespace } func getDestinationRule(serviceID string, services []*resolved.Service, namespace string) *istioclient.DestinationRule { + // the baseline topology (or prod topology) flow ID and flow version are equal to the namespace these three should use same value + baselineFlowVersion := namespace // TODO(shared-annotation) - we could store "shared" versions somewhere so that the pointers are the same // if we do that then the render work around isn't necessary subsets := lo.UniqBy( @@ -242,7 +246,7 @@ func getDestinationRule(serviceID string, services []*resolved.Service, namespac // TODO Narrow down this configuration to only subsets created for telepresence intercepts or find a way to enable TLS for telepresence intercepts https://github.com/kurtosis-tech/kardinal-kontrol/issues/14 // This config is necessary for Kardinal/Telepresence (https://www.telepresence.io/) integration - if service.Version != prodVersion { + if service.Version != baselineFlowVersion { newTrafficPolicy := &v1alpha3.TrafficPolicy{ Tls: &v1alpha3.ClientTLSSettings{ Mode: v1alpha3.ClientTLSSettings_DISABLE, @@ -447,6 +451,8 @@ func getEnvoyFilters(service *resolved.Service, namespace string) []istioclient. }, } + // the baseline topology (or prod topology) flow ID and flow version and host are equal to the namespace these four should use same value + baselineHostName := namespace outboundFilter := &istioclient.EnvoyFilter{ TypeMeta: metav1.TypeMeta{ APIVersion: "networking.istio.io/v1alpha3", @@ -487,7 +493,7 @@ func getEnvoyFilters(service *resolved.Service, namespace string) []istioclient. StructValue: &structpb.Struct{ Fields: map[string]*structpb.Value{ "@type": {Kind: &structpb.Value_StringValue{StringValue: luaFilterType}}, - "inlineCode": {Kind: &structpb.Value_StringValue{StringValue: getOutgoingRequestTraceIDFilter()}}, + "inlineCode": {Kind: &structpb.Value_StringValue{StringValue: getOutgoingRequestTraceIDFilter(baselineHostName)}}, }, }, }, @@ -535,8 +541,8 @@ func getAuthorizationPolicy(service *resolved.Service, namespace string) *securi } } -func getEnvoyFilterForGateway(servicesAgainstVersions map[string][]string, serviceAndVersionAgainstExtHost map[string]string, serviceAgainstBackupVersions map[string][]string) *istioclient.EnvoyFilter { - luaScript := generateDynamicLuaScript(servicesAgainstVersions, serviceAndVersionAgainstExtHost, serviceAgainstBackupVersions) +func getEnvoyFilterForGateway(servicesAgainstVersions map[string][]string, serviceAndVersionAgainstExtHost map[string]string, serviceAgainstBackupVersions map[string][]string, baselineHostName string) *istioclient.EnvoyFilter { + luaScript := generateDynamicLuaScript(servicesAgainstVersions, serviceAndVersionAgainstExtHost, serviceAgainstBackupVersions, baselineHostName) return &istioclient.EnvoyFilter{ TypeMeta: metav1.TypeMeta{ @@ -592,7 +598,7 @@ func getEnvoyFilterForGateway(servicesAgainstVersions map[string][]string, servi } } -func generateDynamicLuaScript(servicesAgainstVersions map[string][]string, versionAgainstExtHost map[string]string, serviceAgainstBackupVersions map[string][]string) string { +func generateDynamicLuaScript(servicesAgainstVersions map[string][]string, versionAgainstExtHost map[string]string, serviceAgainstBackupVersions map[string][]string, baselineHostName string) string { var setRouteCalls strings.Builder // Helper function to add a setRoute call @@ -665,7 +671,7 @@ function envoy_on_request(request_handle) local trace_id = headers:get("x-kardinal-trace-id") local hostname = headers:get(":authority") - request_handle:logInfo("Processing request - Initial trace ID: " .. (trace_id or "none") .. ", Hostname: " .. (hostname or "none")) + request_handle:logInfo("Processing request - Initial trace ID: " .. (trace_id or "none") .. ", Hostname: " .. (hostname or "none") .. ", Baseline: %s") if not trace_id then local found_trace_id, source_header = get_trace_id(headers) @@ -702,7 +708,7 @@ function envoy_on_request(request_handle) "outbound|8080||trace-router.default.svc.cluster.local", { [":method"] = "GET", - [":path"] = "/route?trace_id=" .. trace_id .. "&hostname=" .. hostname, + [":path"] = "/route?trace_id=" .. trace_id .. "&hostname=" .. hostname .. "&baseline_prefix=%s", [":authority"] = "trace-router.default.svc.cluster.local" }, "", @@ -714,12 +720,12 @@ function envoy_on_request(request_handle) destination = determine_body request_handle:logInfo("Determined destination: " .. destination) else - destination = hostname .. "-prod" + destination = hostname .. "-%s" request_handle:logWarn("Failed to determine destination, using fallback: " .. destination) end request_handle:headers():add("x-kardinal-destination", destination) request_handle:logInfo("Final headers - Trace ID: " .. trace_id .. ", Destination: " .. destination) end -`, generateLuaTraceHeaderPriorities(), setRouteCalls.String()) +`, generateLuaTraceHeaderPriorities(), baselineHostName, setRouteCalls.String(), baselineHostName, baselineHostName) } diff --git a/kontrol-service/engine/template/dev-flow.go b/kontrol-service/engine/template/dev-flow.go index f34ee17..f870379 100644 --- a/kontrol-service/engine/template/dev-flow.go +++ b/kontrol-service/engine/template/dev-flow.go @@ -178,6 +178,9 @@ func Gateway(namespaceSpec types.NamespaceSpec, traffic types.Traffic) istioclie // Define the VirtualService func FrontendVirtualService(serviceSpec *types.ServiceSpec, namespaceSpec types.NamespaceSpec, traffic types.Traffic) istioclient.VirtualService { + // the baseline topology (or prod topology) flow ID and flow version are equal to the namespace these three should use same value + baselineFlowVersion := namespaceSpec.Name + mainRoute := v1alpha3.HTTPRoute{ Route: []*v1alpha3.HTTPRouteDestination{ { @@ -190,14 +193,12 @@ func FrontendVirtualService(serviceSpec *types.ServiceSpec, namespaceSpec types. }, } - // TODO: Remove hardcoded prod, too fragile :( extHost := traffic.ExternalHostname - if serviceSpec.Version != "prod" { + if serviceSpec.Version != baselineFlowVersion { extHost = traffic.MirrorExternalHostname } - // TODO: Remove hardcoded prod, too fragile :( - if traffic.HasMirroring && serviceSpec.Version == "prod" { + if traffic.HasMirroring && serviceSpec.Version == baselineFlowVersion { mainRoute.Mirror = &v1alpha3.Destination{ Host: serviceSpec.Name, Subset: traffic.MirrorToVersion, diff --git a/kontrol-service/go.mod b/kontrol-service/go.mod index 256e143..044f8dd 100644 --- a/kontrol-service/go.mod +++ b/kontrol-service/go.mod @@ -7,8 +7,8 @@ toolchain go1.22.3 require ( github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/dominikbraun/graph v0.23.0 - github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913122732-d5a75f64bec6 - github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913122732-d5a75f64bec6 + github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913221752-e831db545217 + github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913221752-e831db545217 github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 github.com/labstack/echo/v4 v4.12.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 diff --git a/kontrol-service/go.sum b/kontrol-service/go.sum index 1da2942..5b2bd19 100644 --- a/kontrol-service/go.sum +++ b/kontrol-service/go.sum @@ -77,10 +77,10 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913122732-d5a75f64bec6 h1:GRc+gtucOX6yPGf1soNVRM1Wiqf0Clyn8gmCenV1Hm4= -github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913122732-d5a75f64bec6/go.mod h1:yvON5b9BHp3yJ99+i+JUMGb985g3h6Eco+w9swS5rds= -github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913122732-d5a75f64bec6 h1:Nq/aD04cx4fj1pzhzINyQSUTOB4g5oZb1XMBCZ7EiCA= -github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913122732-d5a75f64bec6/go.mod h1:lj6oLhpXgnc9ZaulV7jysgRaeZUDPK6XiM2TxpcGRqM= +github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913221752-e831db545217 h1:OLG5CtNffardgtFirHxOcM0LDOZ4qRh/fjTYmx1y7Bo= +github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api v0.0.0-20240913221752-e831db545217/go.mod h1:yvON5b9BHp3yJ99+i+JUMGb985g3h6Eco+w9swS5rds= +github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913221752-e831db545217 h1:cCM7nTd4E6Vh/dXlRgzmyU5I7GBr7D+ImU3iMVx+Dnk= +github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api v0.0.0-20240913221752-e831db545217/go.mod h1:lj6oLhpXgnc9ZaulV7jysgRaeZUDPK6XiM2TxpcGRqM= github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 h1:YQTATifMUwZEtZYb0LVA7DK2pj8s71iY8rzweuUQ5+g= github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409/go.mod h1:y5weVs5d9wXXHcDA1awRxkIhhHC1xxYJN8a7aXnE6S8= github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0= diff --git a/kontrol-service/gomod2nix.toml b/kontrol-service/gomod2nix.toml index 8cc959d..3b9871e 100644 --- a/kontrol-service/gomod2nix.toml +++ b/kontrol-service/gomod2nix.toml @@ -266,10 +266,10 @@ schema = 3 version = "v0.2.0" hash = "sha256-fadcWxZOORv44oak3jTxm6YcITcFxdGt4bpn869HxUE=" [mod."github.com/kurtosis-tech/kardinal/libs/cli-kontrol-api"] - version = "v0.0.0-20240913122732-d5a75f64bec6" + version = "v0.0.0-20240913221752-e831db545217" hash = "sha256-Snene5X+e60ztYbCLluEcT8wMtd2w3MOJHGz/KhXr3w=" [mod."github.com/kurtosis-tech/kardinal/libs/manager-kontrol-api"] - version = "v0.0.0-20240913122732-d5a75f64bec6" + version = "v0.0.0-20240913221752-e831db545217" hash = "sha256-Y1vl6Cqpvc+b9+JPnajRGPeAXqA/XQEgcGBCXsiuTek=" [mod."github.com/kurtosis-tech/stacktrace"] version = "v0.0.0-20211028211901-1c67a77b5409"