func updateAnnotations()

in controller/webhook.go [352:366]


func updateAnnotations(target map[string]string, annotations map[string]string) (patch []PatchOperation) {
	for key, value := range annotations {
		op := "replace"
		if target == nil || target[key] == "" {
			op = "add"
		}
		patch = append(patch, PatchOperation{
			Op:    op,
			Path:  "/metadata/annotations/" + strings.ReplaceAll(key, "/", "~1"),
			Value: value,
		})
	}

	return patch
}