Skip to content

API Get unmarshaller doesn't respect the APIVersion when the Kind is the same #127

@fanminshi

Description

@fanminshi

For example, Get can retrieve a object at APIVersion apps/v1beta1 and still unmarshall the data into the object d with a different type apps/v1 as shown in d := &appsv1.Deployment{}.

       name := "memcached-operator"
	namespace := "default"
	d := &appsv1.Deployment{
		TypeMeta: metav1.TypeMeta{
			Kind:       "Deployment",
			APIVersion: "apps/v1beta1",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      name,
			Namespace: namespace,
		},
	}
	err := query.Get(d)
	if err != nil {
		logrus.Infof("Failed to get Deployment via sdk %v : %v", name, err)
	}

Output:
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions