k8s-cloud-provider
k8s-cloud-provider copied to clipboard
Mock objects do nothing for Update interface
For example:
// Update is a mock for the corresponding method.
func (m *MockHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *ga.HealthCheck) error {
if m.UpdateHook != nil {
return m.UpdateHook(ctx, key, arg0, m)
}
return nil
}
It does nothing if UpdateHook is nil. I would expect it to override what is stored in m.Objects[*key]
. Do I miss something?
I believe this is because "Update" is considered an additional method, and not part of the default methods. @bowei Do you remember if this is the case?
Regardless this is something we deal with in ingress-gce with UpdateHooks, so this would be helpful there as well if we are able to fix it.
I believe this is because "Update" is considered an additional method, and not part of the default methods. @bowei Do you remember if this is the case?
Hmm, I think "Update" is used to update a GCE object in the legacy-cloud-provider package. For example: https://github.com/kubernetes/legacy-cloud-providers/blob/master/gce/gce_healthchecks.go#L80
@yanweiguo I think there is some confusion here. Update is definitely used to update a GCE object, but not all resources support the Update method. Hence why it is considered an additional method: https://github.com/GoogleCloudPlatform/k8s-cloud-provider/blob/master/pkg/cloud/meta/meta.go#L239
I think is mainly a limitation of the current codebase
@yanweiguo I think there is some confusion here. Update is definitely used to update a GCE object, but not all resources support the Update method. Hence why it is considered an additional method: https://github.com/GoogleCloudPlatform/k8s-cloud-provider/blob/master/pkg/cloud/meta/meta.go#L239
I think is mainly a limitation of the current codebase
Ah thanks for explaining.
@yanweiguo That isn't to say that we can't fix it though :)
Can you use the hooks to implement the functionality you need?