- Add PendingServiceDiscovery model and database migration - Add PendingServices API controller for service assignment - Add KubernetesPendingSyncService for background sync - Add RBAC configuration for K8s service discovery - Update Dockerfile and K8s deployment configs - Add service discovery design documentation Workflow: K8s services with label managed-by=yarp are discovered and stored in pending table. Admin approves before they become active gateway downstream services.
276 lines
9.6 KiB
C#
276 lines
9.6 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
using YarpGateway.Data;
|
|
|
|
#nullable disable
|
|
|
|
namespace YarpGateway.Migrations
|
|
{
|
|
[DbContext(typeof(GatewayDbContext))]
|
|
[Migration("20260222134342_AddPendingServiceDiscovery")]
|
|
partial class AddPendingServiceDiscovery
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "10.0.2")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
|
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("YarpGateway.Models.GwPendingServiceDiscovery", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<DateTime?>("AssignedAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("AssignedBy")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<string>("AssignedClusterId")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<DateTime>("DiscoveredAt")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("DiscoveredPorts")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("character varying(500)");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<string>("K8sClusterIP")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)");
|
|
|
|
b.Property<string>("K8sNamespace")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("character varying(255)");
|
|
|
|
b.Property<string>("K8sServiceName")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("character varying(255)");
|
|
|
|
b.Property<string>("Labels")
|
|
.IsRequired()
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("character varying(2000)");
|
|
|
|
b.Property<int>("PodCount")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Version")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DiscoveredAt");
|
|
|
|
b.HasIndex("Status");
|
|
|
|
b.HasIndex("K8sServiceName", "K8sNamespace", "IsDeleted")
|
|
.IsUnique();
|
|
|
|
b.ToTable("PendingServiceDiscoveries");
|
|
});
|
|
|
|
modelBuilder.Entity("YarpGateway.Models.GwServiceInstance", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<string>("Address")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<string>("ClusterId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<long?>("CreatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("CreatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<string>("DestinationId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<int>("Health")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<long?>("UpdatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime?>("UpdatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("Version")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<int>("Weight")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Health");
|
|
|
|
b.HasIndex("ClusterId", "DestinationId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("ServiceInstances");
|
|
});
|
|
|
|
modelBuilder.Entity("YarpGateway.Models.GwTenant", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<long?>("CreatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("CreatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("TenantCode")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)");
|
|
|
|
b.Property<string>("TenantName")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<long?>("UpdatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime?>("UpdatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("Version")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TenantCode")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Tenants");
|
|
});
|
|
|
|
modelBuilder.Entity("YarpGateway.Models.GwTenantRoute", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<string>("ClusterId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<long?>("CreatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("CreatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<bool>("IsDeleted")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<bool>("IsGlobal")
|
|
.HasColumnType("boolean");
|
|
|
|
b.Property<string>("PathPattern")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("character varying(200)");
|
|
|
|
b.Property<int>("Priority")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("ServiceName")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("character varying(100)");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("integer");
|
|
|
|
b.Property<string>("TenantCode")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("character varying(50)");
|
|
|
|
b.Property<long?>("UpdatedBy")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime?>("UpdatedTime")
|
|
.HasColumnType("timestamp with time zone");
|
|
|
|
b.Property<int>("Version")
|
|
.HasColumnType("integer");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ClusterId");
|
|
|
|
b.HasIndex("ServiceName");
|
|
|
|
b.HasIndex("TenantCode");
|
|
|
|
b.HasIndex("ServiceName", "IsGlobal", "Status");
|
|
|
|
b.ToTable("TenantRoutes");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|