@intentius/chant-lexicon-gcp 0.38.0 → 0.41.0
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/dist/composites/cloud-function.d.ts +1 -1
- package/dist/composites/cloud-function.d.ts.map +1 -1
- package/dist/composites/cloud-run-service.d.ts +1 -1
- package/dist/composites/cloud-run-service.d.ts.map +1 -1
- package/dist/composites/cloud-sql-instance.d.ts +5 -1
- package/dist/composites/cloud-sql-instance.d.ts.map +1 -1
- package/dist/composites/gcs-bucket.d.ts +3 -1
- package/dist/composites/gcs-bucket.d.ts.map +1 -1
- package/dist/composites/gke-cluster.d.ts +5 -1
- package/dist/composites/gke-cluster.d.ts.map +1 -1
- package/dist/composites/managed-certificate.d.ts +1 -1
- package/dist/composites/managed-certificate.d.ts.map +1 -1
- package/dist/composites/memorystore-redis.d.ts +3 -1
- package/dist/composites/memorystore-redis.d.ts.map +1 -1
- package/dist/composites/private-service.d.ts +1 -1
- package/dist/composites/private-service.d.ts.map +1 -1
- package/dist/composites/pubsub-pipeline.d.ts +1 -1
- package/dist/composites/pubsub-pipeline.d.ts.map +1 -1
- package/dist/composites/secure-project.d.ts +1 -1
- package/dist/composites/secure-project.d.ts.map +1 -1
- package/dist/composites/vpc-network.d.ts +1 -1
- package/dist/composites/vpc-network.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/dist/op/activities/floci-gcp.d.ts +20 -5
- package/dist/op/activities/floci-gcp.d.ts.map +1 -1
- package/dist/op/activities/gcp-apply.d.ts +101 -9
- package/dist/op/activities/gcp-apply.d.ts.map +1 -1
- package/dist/op/activities/index.d.ts +1 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/ownership.d.ts +36 -0
- package/dist/ownership.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/composites/cloud-function.ts +1 -1
- package/src/composites/cloud-run-service.ts +1 -1
- package/src/composites/cloud-sql-instance.ts +1 -1
- package/src/composites/gcs-bucket.ts +1 -1
- package/src/composites/gke-cluster.ts +1 -1
- package/src/composites/managed-certificate.ts +1 -1
- package/src/composites/memorystore-redis.ts +1 -1
- package/src/composites/private-service.ts +1 -1
- package/src/composites/pubsub-pipeline.ts +1 -1
- package/src/composites/secure-project.ts +1 -1
- package/src/composites/vpc-network.ts +1 -1
- package/src/op/activities/floci-gcp.test.ts +25 -0
- package/src/op/activities/floci-gcp.ts +21 -6
- package/src/op/activities/gcp-apply.test.ts +234 -1
- package/src/op/activities/gcp-apply.ts +165 -24
- package/src/op/activities/index.ts +3 -0
- package/src/ownership.ts +41 -0
package/src/ownership.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GCP's ownership marker channels (#1446).
|
|
3
|
+
*
|
|
4
|
+
* The gcp lexicon marks ownership on **two different surfaces**, and they
|
|
5
|
+
* legitimately use different key vocabularies:
|
|
6
|
+
*
|
|
7
|
+
* 1. **The Config Connector object** — what the serializer emits. Its
|
|
8
|
+
* `metadata.labels` are Kubernetes labels, so it uses core's shared
|
|
9
|
+
* `LABEL_OWNERSHIP_KEYS` (`app.kubernetes.io/managed-by`). That is the key
|
|
10
|
+
* `plugin.ts` registers as the lexicon's `ownershipChannel` and the one the
|
|
11
|
+
* read paths resolve through.
|
|
12
|
+
*
|
|
13
|
+
* 2. **The GCP resource itself** — what `gcpApply` PUTs to the REST API. GCP
|
|
14
|
+
* label keys may not contain `/` or `.`, so `app.kubernetes.io/managed-by`
|
|
15
|
+
* is not a legal key there. Hence {@link GCP_RESOURCE_OWNERSHIP_KEYS}.
|
|
16
|
+
*
|
|
17
|
+
* This is worth stating because the split looks like the bug #1446 found in the
|
|
18
|
+
* azure applier, and is not. Azure's serializer and applier both write ARM tags
|
|
19
|
+
* — one surface, and they had drifted onto two keys for no reason. Here the two
|
|
20
|
+
* surfaces are real and each key is the only legal one for its target.
|
|
21
|
+
*
|
|
22
|
+
* What #1446 changes is that the applier's predicate resolves through core's
|
|
23
|
+
* `hasOwnershipMarker` against a declared channel, rather than comparing a
|
|
24
|
+
* string literal inline. The key does not move; the drift risk does.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ChannelKeys } from "@intentius/chant/ownership";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Ownership keys for labels on a live GCP resource — the surface `gcpApply`
|
|
31
|
+
* writes and `pruneOrphans` reads.
|
|
32
|
+
*
|
|
33
|
+
* GCP label keys are lowercase alphanumerics, `-` and `_` only, so this is the
|
|
34
|
+
* GCP-valid equivalent of core's label convention rather than that convention
|
|
35
|
+
* itself.
|
|
36
|
+
*/
|
|
37
|
+
export const GCP_RESOURCE_OWNERSHIP_KEYS: ChannelKeys = {
|
|
38
|
+
managedBy: "managed-by",
|
|
39
|
+
stack: "chant-stack",
|
|
40
|
+
env: "chant-env",
|
|
41
|
+
};
|