From f77ac89363df8b0b5787662f0148b8a9da2bab28 Mon Sep 17 00:00:00 2001 From: Xisheng Cai Date: Mon, 19 Apr 2021 21:05:30 +0800 Subject: [PATCH] fix bug #322 workload childresource user apply replace patch --- go.mod | 6 +++++- go.sum | 4 ++++ .../containerizedworkload_controller.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 58c13d0d..5286742f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/crossplane/oam-kubernetes-runtime -go 1.13 +go 1.15 require ( github.com/crossplane/crossplane-runtime v0.10.0 @@ -30,3 +30,7 @@ require ( sigs.k8s.io/controller-runtime v0.6.2 sigs.k8s.io/controller-tools v0.2.4 ) + +replace ( + k8s.io/client-go => k8s.io/client-go v0.18.8 +) diff --git a/go.sum b/go.sum index c227f0f3..2962b608 100644 --- a/go.sum +++ b/go.sum @@ -237,6 +237,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/crossplane/crossplane-runtime v0.10.0 h1:H8YvMcrm1uzZYpwU/BpxjRQfceVulxgYJMx4rmX38Hg= github.com/crossplane/crossplane-runtime v0.10.0/go.mod h1:cJl5ZZONisre4v6wTmbrC8Jh3AI+erq/lNaxZzv9tnU= +github.com/crossplane/crossplane-runtime v0.11.0 h1:hLDWsGYhU/CUVQ1sU7NHF5bnP6WT6wA6Nu2SaBSSe6w= +github.com/crossplane/crossplane-runtime v0.11.0/go.mod h1:cJl5ZZONisre4v6wTmbrC8Jh3AI+erq/lNaxZzv9tnU= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -1731,6 +1733,8 @@ k8s.io/client-go v0.18.5 h1:cLhGZdOmyPhwtt20Lrb7uAqxxB1uvY+NTmNJvno1oKA= k8s.io/client-go v0.18.5/go.mod h1:EsiD+7Fx+bRckKWZXnAXRKKetm1WuzPagH4iOSC8x58= k8s.io/client-go v0.18.6 h1:I+oWqJbibLSGsZj8Xs8F0aWVXJVIoUHWaaJV3kUN/Zw= k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q= +k8s.io/client-go v0.18.8 h1:SdbLpIxk5j5YbFr1b7fq8S7mDgDjYmUxSbszyoesoDM= +k8s.io/client-go v0.18.8/go.mod h1:HqFqMllQ5NnQJNwjro9k5zMyfhZlOwpuTLVrxjkYSxU= k8s.io/client-go v12.0.0+incompatible h1:YlJxncpeVUC98/WMZKC3JZGk/OXQWCZjAB4Xr3B17RY= k8s.io/client-go v12.0.0+incompatible/go.mod h1:E95RaSlHr79aHaX0aGSwcPNfygDiPKOVXdmivCIZT0k= k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269/go.mod h1:V5BD6M4CyaN5m+VthcclXWsVcT1Hu+glwa1bi3MIsyE= diff --git a/pkg/controller/v1alpha2/core/workloads/containerizedworkload/containerizedworkload_controller.go b/pkg/controller/v1alpha2/core/workloads/containerizedworkload/containerizedworkload_controller.go index 9ac69528..cabbf4ae 100644 --- a/pkg/controller/v1alpha2/core/workloads/containerizedworkload/containerizedworkload_controller.go +++ b/pkg/controller/v1alpha2/core/workloads/containerizedworkload/containerizedworkload_controller.go @@ -145,7 +145,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { util.PatchCondition(ctx, r, &workload, cpv1alpha1.ReconcileError(errors.Wrap(err, errRenderService))) } // server side apply the service - if err := r.Patch(ctx, service, client.Apply, applyOpts...); err != nil { + if err := r.applicator.Apply(ctx, service, applyOpts...); err != nil { log.Error(err, "Failed to apply a service") r.record.Event(eventObj, event.Warning(errApplyDeployment, err)) return util.ReconcileWaitResult,