@cyc-seattle/platform 1.39.4 → 1.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/schema/index.d.ts +9 -0
- package/dist/workload.d.ts +2 -0
- package/dist/workload.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,11 +31,13 @@ app owns. The apps that run on it live in their own repos, such as
|
|
|
31
31
|
one replica, `spreadAcrossZones` spreads them, and `minAvailable` adds a PodDisruptionBudget.
|
|
32
32
|
`podAnnotations` sets annotations such as `cluster-autoscaler.kubernetes.io/safe-to-evict`. A
|
|
33
33
|
pod with `safe-to-evict: "false"` gets at least 500m CPU and 512Mi from Autopilot, so ask for that
|
|
34
|
-
much, or every preview shows a change.
|
|
34
|
+
much, or every preview shows a change. `progressDeadlineSeconds` gives a slow rollout longer than
|
|
35
|
+
Kubernetes' 600 seconds before the deploy fails.
|
|
35
36
|
- `WebService` is a `Workload` behind the environment's Gateway at `hostname`. Its Service exposes
|
|
36
37
|
`port` as port 80, and its readiness probe must be an HTTP GET, which the load balancer's health
|
|
37
38
|
check reuses unless `healthCheck.path` names a cheaper path. With `paths`, it claims only those path prefixes on `hostname`, and another
|
|
38
|
-
`WebService` can serve the rest of it.
|
|
39
|
+
`WebService` can serve the rest of it. A stopping pod keeps serving for 10 seconds, while the load
|
|
40
|
+
balancer stops sending to it, then has 30 seconds to exit.
|
|
39
41
|
- `ScheduledJob` runs a CronJob on `schedule`, in `America/Los_Angeles` unless `timeZone` says
|
|
40
42
|
otherwise. A run never overlaps the one before it, gets an hour, and doesn't retry, by default.
|
|
41
43
|
- All three run non-root with a read-only root filesystem, no capabilities, and no service account
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export interface Schema {
|
|
|
68
68
|
registrations: Registrations[];
|
|
69
69
|
resource_kinds: ResourceKinds[];
|
|
70
70
|
schools: Schools[];
|
|
71
|
+
sync_leases: SyncLeases[];
|
|
71
72
|
sync_runs: SyncRuns[];
|
|
72
73
|
sync_tasks: SyncTasks[];
|
|
73
74
|
version_set_members: VersionSetMembers[];
|
|
@@ -1058,6 +1059,14 @@ export interface Schools {
|
|
|
1058
1059
|
/** Other ways families write this school on their Clubspot forms. An answer matching the name or one of these, ignoring capitals and punctuation and counting a run of spaces as one, is this school. Anything else is kept as their own words. */
|
|
1059
1060
|
aliases: string[] | null;
|
|
1060
1061
|
}
|
|
1062
|
+
/** Which syncs are running now. A sync holds its queue while it runs, so a second run waits its turn. Written by the syncs. */
|
|
1063
|
+
export interface SyncLeases {
|
|
1064
|
+
id: string;
|
|
1065
|
+
/** Which sync's queue is held. A queue has one lease at a time. */
|
|
1066
|
+
queue: string;
|
|
1067
|
+
/** The running sync renews this every minute. Once it passes, the sync has stopped, and the next run takes the queue. */
|
|
1068
|
+
expires_at: string;
|
|
1069
|
+
}
|
|
1061
1070
|
/** One row each time a sync runs. */
|
|
1062
1071
|
export interface SyncRuns {
|
|
1063
1072
|
id: string;
|
package/dist/workload.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface WorkloadArgs extends PodArgs {
|
|
|
65
65
|
spreadAcrossZones?: boolean;
|
|
66
66
|
/** Adds a PodDisruptionBudget that keeps this many pods up through drains. Must be below `replicas`. */
|
|
67
67
|
minAvailable?: number;
|
|
68
|
+
/** How long a rollout may take before the Deployment, and so the deploy, fails. Defaults to 600. */
|
|
69
|
+
progressDeadlineSeconds?: number;
|
|
68
70
|
}
|
|
69
71
|
/** The pods' Workload Identity principal, for IAM grants. */
|
|
70
72
|
export declare function workloadMember(platform: pulumi.Output<PlatformOutputs>, serviceAccountName: pulumi.Input<string>): pulumi.Output<string>;
|
package/dist/workload.js
CHANGED
|
@@ -79,6 +79,7 @@ export function podSpec(name, args, serviceAccountName, container = {}) {
|
|
|
79
79
|
],
|
|
80
80
|
}));
|
|
81
81
|
}
|
|
82
|
+
const preStopSeconds = 10;
|
|
82
83
|
/**
|
|
83
84
|
* The Deployment, ServiceAccount, and Service of a `Workload` or a `WebService`, as children of
|
|
84
85
|
* `parent`. `http` is a `WebService`'s port, which its Service exposes as port 80.
|
|
@@ -99,10 +100,16 @@ export function deployment(parent, name, args, http) {
|
|
|
99
100
|
throw new Error(`${name}: "minAvailable" (${args.minAvailable}) must be below "replicas" (${replicas}).`);
|
|
100
101
|
}
|
|
101
102
|
const ports = [...(http !== undefined ? [{ name: "http", port: http }] : []), ...(args.ports ?? [])];
|
|
103
|
+
// The load balancer keeps sending to a stopping pod for a few seconds (cyc-seattle/platform#153), so
|
|
104
|
+
// a WebService's pod keeps serving that long before it gets SIGTERM, then has the default 30s to exit.
|
|
105
|
+
const drain = http !== undefined && {
|
|
106
|
+
lifecycle: { preStop: { sleep: { seconds: preStopSeconds } } },
|
|
107
|
+
};
|
|
102
108
|
new k8s.apps.v1.Deployment(name, {
|
|
103
109
|
metadata,
|
|
104
110
|
spec: {
|
|
105
111
|
replicas,
|
|
112
|
+
...(args.progressDeadlineSeconds !== undefined && { progressDeadlineSeconds: args.progressDeadlineSeconds }),
|
|
106
113
|
selector: { matchLabels: labels },
|
|
107
114
|
template: {
|
|
108
115
|
metadata: { labels, ...(args.podAnnotations && { annotations: args.podAnnotations }) },
|
|
@@ -111,8 +118,10 @@ export function deployment(parent, name, args, http) {
|
|
|
111
118
|
...(args.readinessProbe && { readinessProbe: args.readinessProbe }),
|
|
112
119
|
...(args.livenessProbe && { livenessProbe: args.livenessProbe }),
|
|
113
120
|
...(args.startupProbe && { startupProbe: args.startupProbe }),
|
|
121
|
+
...drain,
|
|
114
122
|
}).apply((spec) => ({
|
|
115
123
|
...spec,
|
|
124
|
+
...(drain && { terminationGracePeriodSeconds: preStopSeconds + 30 }),
|
|
116
125
|
...(args.spreadAcrossZones && {
|
|
117
126
|
topologySpreadConstraints: [
|
|
118
127
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyc-seattle/platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.1",
|
|
4
4
|
"description": "Pulumi components for CYC's shared Google Cloud platform: WebService, the platform outputs reader, and the stacks that build the platform",
|
|
5
5
|
"author": "CYC Community Sailing Center",
|
|
6
6
|
"license": "Apache-2.0",
|