🐛 update jsonpatch#499
Conversation
|
Welcome @kdada! |
go.mod
Outdated
| golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be // indirect | ||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect | ||
| golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect | ||
| gomodules.xyz/jsonpatch v0.0.0-20190625105815-9fbceb03c566 |
There was a problem hiding this comment.
It should be gomodules.xyz/jsonpatch/v2 v2.0.0
pkg/webhook/admission/multi_test.go
Outdated
| . "github.com/onsi/gomega" | ||
|
|
||
| "github.com/appscode/jsonpatch" | ||
| "gomodules.xyz/jsonpatch" |
There was a problem hiding this comment.
gomodules.xyz/jsonpatch/v2 everywhere.
|
@tamalsaha PTAL |
|
/lgtm |
|
@tamalsaha: changing LGTM is restricted to assignees, and only kubernetes-sigs/controller-runtime repo collaborators may be assigned issues. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
We should declare that this error could cause the user cluster to chaos. Users should update |
|
@tamalsaha I can't reconcile go mod and dep. go mod asks me to import "gomodules.xyz/jsonpatch/v2" but dep requires "gomodules.xyz/jsonpatch" |
|
Hmm. I am not sure how to fix this. I think it is time to drop Go dep? |
|
golang/dep#1963 was supposed to help but I don't know when that will happen. Given Go 1.13 is going to come out in a month (Aug 1) and Kubernetes 1.15 has go mod support, it might be time to drop Go dep support. |
|
@tamalsaha I'll update this PR and use go mod only. I think we need another PR to remove dep. |
|
@kdada Can you use something like the following in |
|
@mengqiy , I am afraid that this will not work. Because jsonpatch now uses v2, |
|
I'd prefer not to break dep users till we promised (v1.13 release, and probably later to be nice), but if there's no other way, we might have to cave. @tamalsaha are you involved in the maintenance of that project? Shouldn't the import path returned by the meta tag in |
|
need to double check |
|
@DirectXMan12, I am the maintainer of the jsonpatch repo. I am following the instructions here: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher . I also looked at https://github.com/google/go-github as an example. I think I did it correctly. This is my first time releasing a v2 for a go mod project. So, if you see any issue, please let me know. |
|
yep, that works. You can test by building a diff --git a/gps/deduce.go b/gps/deduce.go
index ee097e18..3c372968 100644
--- a/gps/deduce.go
+++ b/gps/deduce.go
@@ -1003,5 +1003,8 @@ func getMetadata(ctx context.Context, path, scheme string) (string, string, stri
if match == -1 {
return "", "", "", errors.Errorf("go-import metadata not found")
}
+ if imports[match].Prefix == "gomodules.xyz/jsonpatch" && path == "gomodules.xyz/jsonpatch/v2" {
+ return path, imports[match].VCS, imports[match].RepoRoot, nil
+ }
return imports[match].Prefix, imports[match].VCS, imports[match].RepoRoot, nil
} |
|
(which'll fake out |
|
@tamalsaha I think you did the actual module correctly :-) What's incorrect (I believe) is your webserver for |
|
I am just using https://github.com/gomodules/govanityurls deployed on appengine. |
|
I have updated the https://github.com/gomodules/jsonpatch repo to use the Major subdirectory structure. So, it should work ok with both |
|
@tamalsaha @DirectXMan12 PTAL. |
|
@kdada , LGTM. You may also want to add the dependency to the |
|
@tamalsaha It seems I can only add the dependency with [[override]]. I think it's not necessary to add the dependency if the |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: kdada The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
I think that may need to be tweaked then. Switching to the major subdirectory structure also works for now :-) |
add RBAC annotation for status subresource
To fix gomodules/jsonpatch#16.
This bug may cause wrong patches when modifying arrays in webhook.
Example:
Origin:
{ "apiVersion": "kubedb.com/v1alpha1", "kind": "Elasticsearch", "metadata": { "name": "quick-elasticsearch", "namespace": "demo" }, "spec": { "tolerations": [ { "key": "node.kubernetes.io/key1", "operator": "Equal", "value": "value1", "effect": "NoSchedule" }, { "key": "node.kubernetes.io/key2", "operator": "Equal", "value": "value2", "effect": "NoSchedule" }, { "key": "node.kubernetes.io/not-ready", "operator": "Exists", "effect": "NoExecute", "tolerationSeconds": 300 }, { "key": "node.kubernetes.io/unreachable", "operator": "Exists", "effect": "NoExecute", "tolerationSeconds": 300 } ] } }Target:
{ "apiVersion": "kubedb.com/v1alpha1", "kind": "Elasticsearch", "metadata": { "name": "quick-elasticsearch", "namespace": "demo" }, "spec": { "tolerations": [ { "key": "node.kubernetes.io/key2", "operator": "Equal", "value": "value2", "effect": "NoSchedule" }, { "key": "node.kubernetes.io/key1", "operator": "Equal", "value": "value1", "effect": "NoSchedule" } ] } }The
jsonpatchwill generate patches: