mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
fix invalid managed-by label value
This commit is contained in:
@@ -85,7 +85,7 @@ func (b *Kustomizer) Run(path string) (resmap.ResMap, error) {
|
|||||||
t := builtins.LabelTransformerPlugin{
|
t := builtins.LabelTransformerPlugin{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
konfig.ManagedbyLabelKey: fmt.Sprintf(
|
konfig.ManagedbyLabelKey: fmt.Sprintf(
|
||||||
"kustomize-%s", provenance.GetProvenance().Version)},
|
"kustomize-%s", provenance.GetProvenance().Semver())},
|
||||||
FieldSpecs: []types.FieldSpec{{
|
FieldSpecs: []types.FieldSpec{{
|
||||||
Path: "metadata/labels",
|
Path: "metadata/labels",
|
||||||
CreateIfNotPresent: true,
|
CreateIfNotPresent: true,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package provenance
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -57,3 +58,11 @@ func (v Provenance) Short() string {
|
|||||||
BuildDate: v.BuildDate,
|
BuildDate: v.BuildDate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Semver returns the semantic version of kustomize.
|
||||||
|
// kustomize version is set in format "kustomize/vX.X.X" in every release.
|
||||||
|
// X.X.X is a semver. If the version string is not in this format,
|
||||||
|
// return the original version string
|
||||||
|
func (v Provenance) Semver() string {
|
||||||
|
return strings.TrimPrefix(v.Version, "kustomize/")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user