Support immutable attribute on generators

This commit is contained in:
jlandowner
2021-04-13 01:02:58 +00:00
parent 9d50890174
commit 82ff64c374
7 changed files with 37 additions and 0 deletions

View File

@@ -76,3 +76,16 @@ func copyLabelsAndAnnotations(
}
return nil
}
func setImmutable(
rn *yaml.RNode, opts *types.GeneratorOptions) error {
if opts == nil {
return nil
}
if opts.Immutable {
if _, err := rn.Pipe(yaml.SetField("immutable", yaml.NewScalarRNode("true"))); err != nil {
return err
}
}
return nil
}