Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/api/ent/migrate/migrations/20261015133505_rollout.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- +goose Up
-- modify "service_configs" table
ALTER TABLE "service_configs" ADD COLUMN "rollout" character varying NOT NULL DEFAULT 'rolling';

-- +goose Down
-- reverse: modify "service_configs" table
ALTER TABLE "service_configs" DROP COLUMN "rollout";
3 changes: 2 additions & 1 deletion apps/api/ent/migrate/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:nFUTWScufO1T6gaYOKn5Qt4r+0paDcwJiF/+LDsDM8s=
h1:65UApAk8j0+DxhB/htSahwHu8dqBAzw0dWDxDH3ZQGA=
20250519010757_initial_migration.sql h1:94lMwKemoNX/ichD+2Vzb7GmOHXVj4qVTfeBInQAe0g=
20250519163449_add_init_containers.sql h1:7bt+zCbtmlYr1QDztgka0R5wUxdjD7XYUkrhL9GYYIQ=
20250521202532_non_nillable_kubernetes_secret.sql h1:eDpMWyeBXh5cG4poavaUMeYs5QXddFBBIyYlxc+nq64=
Expand Down Expand Up @@ -43,3 +43,4 @@ h1:nFUTWScufO1T6gaYOKn5Qt4r+0paDcwJiF/+LDsDM8s=
20261013141524_service_stopped.sql h1:SF0LMABvT1NKaa/uRbydNSBvqh4jKo4CVkZVjnGuKfE=
20261013164138_cron_schedule.sql h1:b+ANbYZXwCko/4diPsulL6mabMsF5+7soU4lxwENlMk=
20261013182619_service_client_ip_header.sql h1:y0X8oYXovXLj3Ko0uIXTCob/LHfdl5aCGAOMYHd1AUI=
20261015133505_rollout.sql h1:XojFA6OkWm6QLDihXjqRTvCSO9alvWluFHNvBW82AUA=
5 changes: 3 additions & 2 deletions apps/api/ent/migrate/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 55 additions & 1 deletion apps/api/ent/mutation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions apps/api/ent/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/api/ent/schema/service_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (ServiceConfig) Fields() []ent.Field {
field.Bool("is_public").Default(false).Comment("Whether the service is publicly accessible, creates an ingress resource"),
field.Int32("max_request_body_size_mb").Optional().Nillable().Comment("Largest request body public domains accept in MB, unset uses the default of 100"),
field.Bool("session_affinity").Default(false).Comment("Whether public domains pin each visitor to one replica with a cookie"),
field.Enum("rollout").GoType(Rollout("")).Default(string(RolloutRolling)).Comment("How a deployment replaces the running version: rolling starts the new one next to the old one, stop-first stops the old one before the new one starts"),
field.String("client_ip_header").Optional().Nillable().Comment("Header a proxy in front of the service carries the visitor's address in, unset picks Cloudflare's when a domain is proxied through it"),
field.Bool("stopped").Default(false).Comment("Whether the service is stopped and runs no replicas"),
field.String("cron_schedule").Optional().Nillable().Comment("Cron expression. When set the service runs on this schedule instead of continuously"),
Expand Down
34 changes: 34 additions & 0 deletions apps/api/ent/schema/service_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,40 @@ func intOrZero(value *int) int {
//* Enums

// Builder enum
// Rollout is how a deployment replaces the running version
type Rollout string

const (
// RolloutRolling starts the new version next to the old one and stops the old one once the new one is ready
RolloutRolling Rollout = "rolling"
// RolloutStopFirst stops the old version before the new one starts, so the two never run at once
RolloutStopFirst Rollout = "stop-first"
)

var allRollouts = []Rollout{RolloutRolling, RolloutStopFirst}

// Values provides list valid values for Enum.
func (r Rollout) Values() (kinds []string) {
for _, r := range allRollouts {
kinds = append(kinds, string(r))
}
return
}

// Register enum in OpenAPI specification
// https://github.com/danielgtaylor/huma/issues/621
func (r Rollout) Schema(reg huma.Registry) *huma.Schema {
if reg.Map()["Rollout"] == nil {
schemaRef := reg.Schema(reflect.TypeOf(""), true, "Rollout")
schemaRef.Title = "Rollout"
for _, v := range allRollouts {
schemaRef.Enum = append(schemaRef.Enum, string(v))
}
reg.Map()["Rollout"] = schemaRef
}
return &huma.Schema{Ref: "#/components/schemas/Rollout"}
}

type ServiceBuilder string

const (
Expand Down
13 changes: 12 additions & 1 deletion apps/api/ent/serviceconfig.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions apps/api/ent/serviceconfig/serviceconfig.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions apps/api/ent/serviceconfig/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading