Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions functions/go/create-setters/createsetters/create_setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ func (cs *CreateSetters) visitScalar(object *yaml.RNode, path string) error {
return nil
}

// skip internal kpt annotations — these are runtime metadata, not user-authored content
if strings.Contains(path, ".annotations.internal.config.kubernetes.io") ||
strings.Contains(path, ".annotations.config.kubernetes.io") {
return nil
}

// doesn't add the comment to the nodes with multiple line values
if hasMultipleLines(object.YNode().Value) {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,33 @@ metadata:
name: nginx-development # kpt-set: nginx-${app}
spec:
image: dev # kpt-set: ${role}
`,
},
{
name: "skip internal kpt annotations",
config: `
data:
replicas: "4"
`,
input: `apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
annotations:
internal.config.kubernetes.io/package-path: /tmp/some-path-with-4-in-it
config.kubernetes.io/local-config: "true"
spec:
replicas: 4
`,
expectedResources: `apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
annotations:
internal.config.kubernetes.io/package-path: /tmp/some-path-with-4-in-it
config.kubernetes.io/local-config: "true"
spec:
replicas: 4 # kpt-set: ${replicas}
`,
},
}
Expand Down
Loading