-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PackageVariant debugging from Nephio #4001
Conversation
This commit adds a workaround for an issue with Kptfile rendering that is causing a controller battle between PackageVariant controller and the Nephio controllers. It also adds some instrumentation to help debug some issues with PackageVariant cloning.
e2e flaked out. Definitely see occasional issues with the packagerev finalizers, which then causes timeouts. I wonder if it is the test git server failing somehow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
// HACK ALERT - TODO(jbelamaric): Fix this | ||
// Currently nephio controllers and package variant controller are rendering Kptfiles slightly differently in YAML | ||
// not sure why, need to investigate more. It may be due to different versions of kyaml. So, here, just for Kptfiles, | ||
// we will parse and compare semantically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked chatgpt to help :) and it generated the following.
package main
import (
"fmt"
"reflect"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/yaml"
)
func main() {
// Example YAML strings
yamlString1 := `
apiVersion: v1
kind: Pod
metadata:
name: pod-1
spec:
containers:
- name: container-1
image: nginx:latest
- name: container-2
image: redis:latest
`
yamlString2 := `
apiVersion: v1
kind: Pod
metadata:
name: pod-2
spec:
containers:
- name: container-1
image: nginx:latest
- name: container-2
image: redis:latest
`
// Convert YAML strings to unstructured objects
obj1, err := yaml.ToUnstructured([]byte(yamlString1))
if err != nil {
panic(err)
}
obj2, err := yaml.ToUnstructured([]byte(yamlString2))
if err != nil {
panic(err)
}
// Compare unstructured objects
equal := reflect.DeepEqual(obj1, obj2)
fmt.Println("Objects are equal:", equal)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
This commit adds a workaround for an issue with Kptfile rendering that is causing a controller battle between PackageVariant controller and the Nephio controllers. It also adds some instrumentation to help debug some issues with PackageVariant cloning.
This commit adds a workaround for an issue with Kptfile rendering that is causing a controller battle between PackageVariant controller and the Nephio controllers.
It also adds some instrumentation to help debug some issues with PackageVariant cloning.