1717package merge
1818
1919import (
20- "fmt "
20+ "errors "
2121
2222 appsv1 "k8s.io/api/apps/v1"
2323 corev1 "k8s.io/api/core/v1"
24- v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
24+ apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2525 "k8s.io/apimachinery/pkg/util/sets"
2626
2727 "sigs.k8s.io/controller-runtime/pkg/client"
2828)
2929
3030var (
31- ErrWrongObjectType = fmt . Errorf ("given object does not match the merger" )
32- ErrMismatchingObjects = fmt . Errorf ("given objects have mismatching types" )
31+ ErrWrongObjectType = errors . New ("given object does not match the merger" )
32+ ErrMismatchingObjects = errors . New ("given objects have mismatching types" )
3333)
3434
3535func ServiceAccountForUpdate (current , updated client.Object ) (client.Object , error ) {
@@ -42,7 +42,7 @@ func ServiceAccountForUpdate(current, updated client.Object) (client.Object, err
4242 return nil , ErrMismatchingObjects
4343 }
4444 preserveServiceAccountPullSecrets (curSA , updSA )
45- return MetadataForUpdate (current , updated )
45+ return ObjectForUpdate (current , updated )
4646}
4747
4848func ServiceForUpdate (current , updated client.Object ) (client.Object , error ) {
@@ -55,7 +55,7 @@ func ServiceForUpdate(current, updated client.Object) (client.Object, error) {
5555 return updated , ErrMismatchingObjects
5656 }
5757 preserveIPConfigurations (& curSE .Spec , & updSE .Spec )
58- return MetadataForUpdate (current , updated )
58+ return ObjectForUpdate (current , updated )
5959}
6060
6161func ObjectForUpdate (current , updated client.Object ) (client.Object , error ) {
@@ -75,8 +75,8 @@ func StatusForUpdate(current client.Object, updated client.Object) (client.Objec
7575 updated .(* appsv1.DaemonSet ).Status = currentTyped .Status
7676 case * corev1.Service :
7777 updated .(* corev1.Service ).Status = currentTyped .Status
78- case * v1 .CustomResourceDefinition :
79- updated .(* v1 .CustomResourceDefinition ).Status = currentTyped .Status
78+ case * apiextv1 .CustomResourceDefinition :
79+ updated .(* apiextv1 .CustomResourceDefinition ).Status = currentTyped .Status
8080 default :
8181 return updated , nil
8282 }
0 commit comments