Skip to content

Commit

Permalink
[#IOPLT-228] - Remove routing to AKS beta cluster (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleDore authored Oct 30, 2023
1 parent b3ae33a commit 83ebfff
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<policies>
<inbound>
<base />
<choose>
<set-backend-service base-url="https://weuprod01.messages.internal.io.pagopa.it/io-backend/api/v1" />
<!-- <choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("beta"))">
<set-backend-service base-url="https://weubeta.messages.internal.io.pagopa.it/io-backend/api/v1" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("weu-prod01"))">
<set-backend-service base-url="https://weuprod01.messages.internal.io.pagopa.it/io-backend/api/v1" />
</when>
<otherwise>
<!-- https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32) -->
https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32)
<set-variable name="urlWeight" value="@{
Random rnd = new Random();
int urlWeight = rnd.Next(1, 1001);
Expand All @@ -35,7 +36,7 @@
</otherwise>
</choose>
</otherwise>
</choose>
</choose> -->
<set-header name="x-user-groups" exists-action="override">
<value>@(String.Join(",", context.User.Groups.Select(g => g.Name)))</value>
</set-header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<policies>
<inbound>
<base />
<choose>
<set-backend-service base-url="https://weuprod01.messages.internal.io.pagopa.it/service-messages/api/v1" />
<!-- <choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("beta"))">
<set-backend-service base-url="https://weubeta.messages.internal.io.pagopa.it/service-messages/api/v1" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("weu-prod01"))">
<set-backend-service base-url="https://weuprod01.messages.internal.io.pagopa.it/service-messages/api/v1" />
</when>
<otherwise>
<!-- https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32) -->
https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32)
<set-variable name="urlWeight" value="@{
Random rnd = new Random();
int urlWeight = rnd.Next(1, 1001);
Expand All @@ -35,7 +36,7 @@
</otherwise>
</choose>
</otherwise>
</choose>
</choose> -->
<set-header name="x-user-groups" exists-action="override">
<value>@(String.Join(",", context.User.Groups.Select(g => g.Name)))</value>
</set-header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
<policies>
<inbound>
<base />
<choose>
<set-backend-service base-url="https://weuprod01.payments.internal.io.pagopa.it/api/v1/payment" />
<!-- <choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("beta"))">
<set-backend-service base-url="https://weubeta.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("environment", "false").Equals("weu-prod01"))">
<set-backend-service base-url="https://weuprod01.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<otherwise>
<!-- https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32) -->
# https://docs.microsoft.com/en-us/dotnet/api/system.random.next?view=net-6.0#system-random-next(system-int32-system-int32)
<set-variable name="urlWeight" value="@{
Random rnd = new Random();
int urlWeight = rnd.Next(1, 1001);
return urlWeight;}" />
<choose>
<when condition="@(context.Variables.GetValueOrDefault
<int>("urlWeight")
<= 1)">
<set-backend-service base-url="https://weubeta.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<when condition="@(context.Variables.GetValueOrDefault
<int>("urlWeight") > 1)">
<set-backend-service base-url="https://weuprod01.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<otherwise>
<return-response>
<set-status code="500" reason="InternalServerError" />
<set-header name="Microsoft-Azure-Api-Management-Correlation-Id" exists-action="override">
<value>@{return Guid.NewGuid().ToString();}</value>
</set-header>
<set-body>A gateway-related error occurred while processing the request.</set-body>
</return-response>
</otherwise>
</choose>
</otherwise>
</choose>
</inbound>
<outbound>
<base />
</outbound>
<backend>
<base />
</backend>
<on-error>
<base />
</on-error>
</policies>
<int>("urlWeight")
<= 1)">
<set-backend-service base-url="https://weubeta.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<when condition="@(context.Variables.GetValueOrDefault
<int>("urlWeight") > 1)">
<set-backend-service base-url="https://weuprod01.payments.internal.io.pagopa.it/api/v1/payment" />
</when>
<otherwise>
<return-response>
<set-status code="500" reason="InternalServerError" />
<set-header name="Microsoft-Azure-Api-Management-Correlation-Id" exists-action="override">
<value>@{return Guid.NewGuid().ToString();}</value>
</set-header>
<set-body>A gateway-related error occurred while processing the request.</set-body>
</return-response>
</otherwise>
</choose>
</otherwise>
</choose> -->
</inbound>
<outbound>
<base />
</outbound>
<backend>
<base />
</backend>
<on-error>
<base />
</on-error>
</policies>

0 comments on commit 83ebfff

Please sign in to comment.