Replace illegal characters in Kubernetes labels (#5013)

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
This commit is contained in:
Jener Rasmussen 2025-03-25 20:24:55 +01:00 committed by GitHub
parent d05b1287aa
commit c392250384
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -108,7 +108,10 @@ func podLabels(step *types.Step, config *config, options BackendOptions) (map[st
// Only copy user labels if allowed by agent config.
// Internal labels are filtered on the server-side.
if config.PodLabelsAllowFromStep || strings.HasPrefix(k, pipeline.InternalLabelPrefix) {
labels[k] = v
labels[k], err = toDNSName(v)
if err != nil {
return labels, err
}
}
}

View File

@ -260,7 +260,10 @@ func registrySecretLabels(step *types.Step, config *config) (map[string]string,
// Only copy user labels if allowed by agent config.
// Internal labels are filtered on the server-side.
if config.PodLabelsAllowFromStep || strings.HasPrefix(k, pipeline.InternalLabelPrefix) {
labels[k] = v
labels[k], err = toDNSName(v)
if err != nil {
return labels, err
}
}
}