Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Update k8s libraries and use patch instead of update in cluster resource controller #1

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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