use custom id as key of the mapping and make kio.Pipeline behave the same as framework.Execute

This commit is contained in:
Mengqi Yu
2021-11-18 19:53:46 -08:00
parent 81edfb7ee8
commit 2ee2d3e389
4 changed files with 502 additions and 96 deletions

View File

@@ -44,7 +44,8 @@ const (
)
func GetFileAnnotations(rn *yaml.RNode) (string, string, error) {
annotations := rn.GetAnnotations()
rm, _ := rn.GetMeta()
annotations := rm.Annotations
path, found := annotations[PathAnnotation]
if !found {
path = annotations[LegacyPathAnnotation]
@@ -57,7 +58,8 @@ func GetFileAnnotations(rn *yaml.RNode) (string, string, error) {
}
func GetIdAnnotation(rn *yaml.RNode) string {
annotations := rn.GetAnnotations()
rm, _ := rn.GetMeta()
annotations := rm.Annotations
id, found := annotations[IdAnnotation]
if !found {
id = annotations[LegacyIdAnnotation]
@@ -391,7 +393,8 @@ func ConfirmInternalAnnotationUnchanged(r1 *yaml.RNode, r2 *yaml.RNode, exclusio
// `internal.config.kubernetes.io` 2) is one of `config.kubernetes.io/path`,
// `config.kubernetes.io/index` and `config.k8s.io/id`.
func GetInternalAnnotations(rn *yaml.RNode) map[string]string {
annotations := rn.GetAnnotations()
meta, _ := rn.GetMeta()
annotations := meta.Annotations
result := make(map[string]string)
for k, v := range annotations {
if strings.HasPrefix(k, internalPrefix) || k == LegacyPathAnnotation || k == LegacyIndexAnnotation || k == LegacyIdAnnotation {