Skip to content

ownership: lexicons declare their ownership key convention (drop core's aws-tag/azure-tag map) #686

Closed

Description

@lex00

Context

Ownership markers (managed-by / stack / env) are stamped onto synthesized resources so chant can recognize what it manages. The key naming differs per provider (k8s labels vs AWS tags vs Azure tags).

Finding

packages/core/src/ownership.ts centralizes the per-provider conventions:

export type OwnershipChannel = "label" | "aws-tag" | "azure-tag";
const CHANNEL_KEYS: Record<OwnershipChannel, ChannelKeys> = {
  label:      { managedBy: "app.kubernetes.io/managed-by", stack: "chant.intentius.io/stack", env: "chant.intentius.io/env" },
  "aws-tag":  { managedBy: "chant:managed-by", stack: "chant:stack", env: "chant:env" },
  "azure-tag":{ managedBy: "chant-managed-by", ... },
};

The aws/azure serializers select their channel (ownershipEntries("aws-tag", …)), but the key convention for each provider is hard-coded in core. Adding a provider with a different tag/label convention means editing core.

Proposed approach

Have each lexicon declare its ownership key convention (the managedBy/stack/env key names) through the LexiconPlugin seam, rather than core enumerating label/aws-tag/azure-tag. Core keeps the generic ownership logic (stamp/detect); the key names come from the lexicon. The "label" (k8s) convention can be the default for lexicons that don't override.

Consideration

This is smaller than the others and the channel set is bounded — reasonable to defer if a fourth convention isn't imminent. Filing so the boundary is tracked.

Acceptance criteria

  • No per-provider key map in packages/core/src/ownership.ts; conventions come from the loaded lexicon.
  • aws/azure/k8s lexicons declare their own key names; ownership stamp/detect behavior unchanged; tests green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions