Documentation
¶
Overview ¶
Package naming 是 fleetly 平台对象命名与最小 label 集的唯一定义点 (state-model §2.4 对象标记契约 + architecture §2.4 服务命名与网络行)。
纪律:
- 命名公式逐字对齐设计文档,任何字符串改动都意味着契约破坏(表驱动 测试对照文档原文钉死,naming_test.go);
- 平台命名只存在于适配器——归一化 compose 不出现平台名(§2.4「平台 命名不进归一化 compose」);调用方 = internal/substrate / 发布引擎;
- label 密钥/payload 永不进 label(state-model §2.4)。
Index ¶
- func AppID8(appID string) (string, error)
- func ContainerLabels(app string) (map[string]string, error)
- func Hash8(content string) string
- func NetworkAlias(service string) (string, error)
- func NetworkName(app string) (string, error)
- func SecretName(app, name, hash8 string) (string, error)
- func ServiceLabels(app, service, deploymentID string) (map[string]string, error)
- func ServiceName(app, service string) (string, error)
- func SortedServiceLabels(labels map[string]string) [][2]string
- func VolumeName(app, key, appID string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerLabels ¶
ContainerLabels 构造容器归属 label(state-model §2.4 表 Container 行: 仅 fleetly.app——人工排障识别归属,不参与决策;执行中继的容器准入 判定同用此 label,architecture §2.6 D19)。
func NetworkAlias ¶
NetworkAlias 返回服务在 app 网络内的别名 = compose 服务名(app 内短名 互访与 compose 语义一致;跨 app 不可见——隔离由每 app 专属网络保证)。
func NetworkName ¶
NetworkName 返回 app 专属 overlay 网络名(保守补全 `fleetly-<app>-net`; 文档钉死的是「每 app 专属 overlay 网络 + 服务别名 = compose 服务名」语义, 未钉网络名字符串——命名与前缀纪律保持一致,跨 app 网络隔离由专属网络 承载,architecture §2.4 服务命名与网络行)。
func SecretName ¶
SecretName 返回 Swarm secret 名 `fleetly-<app>-<name>-<hash8>`。hash8 由调用方经 Hash8(内容) 计算——**值轮换即换名换引用**(architecture §2.4 密钥行;desired-hash 以 secret 引用参与,轮换天然触发重部署)。
func ServiceLabels ¶
ServiceLabels 构造 Swarm 服务的平台 label 最小集(state-model §2.4 对象 标记契约,表 Service 行:managed=true、app、process、deployment;cron 为 v0.2 契约、调用方经 state 常量另行附加)。写者唯一 = 适配器 Marker 端口; 密钥/payload 永不入 label。返回 map 无序,消费方(Docker API)对顺序无 语义依赖;需要稳定序列化时用 SortedServiceLabels。
app/compose 服务名经过 validateComponent 校验(与命名函数同一字符集—— 两者最终都落到 Swarm 对象名/label 值)。
func ServiceName ¶
ServiceName 返回 Swarm 服务名 `fleetly-<app>-<service>`:两个 app 各有 同名服务(web/db)不冲突;服务别名 = compose 服务名(app 内短名互访与 compose 语义一致,见 NetworkAlias)。
func SortedServiceLabels ¶
SortedServiceLabels 返回键序稳定的 label 序列(golden 测试与日志脱敏 渲染用)。
func VolumeName ¶
VolumeName 返回平台卷名 `fleetly-<app>-<key>-<appid8>`:卷无 label, 用命名约定承载归属(state-model §2.4;VolumeOptions.Labels 生效前的 收敛路径,stateful-placement §6)。appid8 = app 平台 ID 前 8 位。
Types ¶
This section is empty.