Skip to content

Commit

Permalink
Update k8s libraries and use patch instead of update in cluster resou…
Browse files Browse the repository at this point in the history
…rce controller (#1)

* Update k8s libraries to use patch instead of update in controller

* Update Gopkg.toml

Co-Authored-By: Haytham AbuelFutuh <[email protected]>
  • Loading branch information
katrogan and EngHabu authored Sep 24, 2019
1 parent 5ee24de commit 7bc3c41
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 54 deletions.
83 changes: 34 additions & 49 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@
name = "gopkg.in/gormigrate.v1"
version = "1.2.1"

[[constraint]]
[[override]]
name = "k8s.io/apimachinery"
version = "kubernetes-1.13.1"
version = "kubernetes-1.14.1"

[[constraint]]
[[override]]
name = "k8s.io/api"
version = "kubernetes-1.14.1"

[[override]]
name = "k8s.io/client-go"
version = "kubernetes-1.13.1"
version = "kubernetes-1.14.6"

[[override]]
branch = "master"
Expand All @@ -104,6 +108,10 @@
name = "github.com/json-iterator/go"
version = "^1.1.5"

[[override]]
name = "sigs.k8s.io/controller-runtime"
version = "0.2.0"

[prune]
go-tests = true
unused-packages = true
Expand Down
2 changes: 1 addition & 1 deletion pkg/clusterresource/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (c *controller) syncNamespace(ctx context.Context, namespace NamespaceName)
logger.Debugf(ctx, "Resource [%+v] in namespace [%s] already exists - attempting update instead",
k8sObj.GetObjectKind().GroupVersionKind().Kind, namespace)
c.metrics.AppliedTemplateExists.Inc()
err = c.kubeClient.Update(ctx, k8sObj)
err = c.kubeClient.Patch(ctx, k8sObj, client.MergeFrom(k8sObj))
if err != nil {
c.metrics.TemplateUpdateErrors.Inc()
logger.Infof(ctx, "Failed to update resource [%+v] in namespace [%s] with err :%v",
Expand Down

0 comments on commit 7bc3c41

Please sign in to comment.