-
Notifications
You must be signed in to change notification settings - Fork 31
Update Kubernetes deps to use release-1.8 branches #47
Conversation
Since kubernetes/kubernetes#52186 has merged, we can now really easily build generators and also generate files. We should gradually switch all of our projects over to use these new This PR switches us to use this, fixes us to the |
Fix up Makefile
Add note in update-client-gen.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @munnerz
- I checked out the branch and ran
dep ensure -v --dry-run --no-vendor
. It reports:
Gopkg.lock was not up to date
- I ran
make all
and got the following error:
vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go:57: cannot use info (type *"github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".UnaryServerInfo) as type *"google.golang.org/grpc".UnaryServerInfo in argument to grpc_prometheus.UnaryServerInterceptor
vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go:57: cannot use handler (type "github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".UnaryHandler) as type "google.golang.org/grpc".UnaryHandler in argument to grpc_prometheus.UnaryServerInterceptor
vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go:93: cannot use ss (type "github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".ServerStream) as type "google.golang.org/grpc".ServerStream in argument to grpc_prometheus.StreamServerInterceptor:
"github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".ServerStream does not implement "google.golang.org/grpc".ServerStream (wrong type for Context method)
have Context() "github.com/jetstack-experimental/navigator/vendor/golang.org/x/net/context".Context
want Context() "golang.org/x/net/context".Context
vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go:93: cannot use info (type *"github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".StreamServerInfo) as type *"google.golang.org/grpc".StreamServerInfo in argument to grpc_prometheus.StreamServerInterceptor
vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/interceptor.go:93: cannot use handler (type "github.com/jetstack-experimental/navigator/vendor/google.golang.org/grpc".StreamHandler) as type "google.golang.org/grpc".StreamHandler in argument to grpc_prometheus.StreamServerInterceptor
FAIL github.com/jetstack-experimental/navigator/pkg/registry/navigator/cassandracluster [build failed]
? github.com/jetstack-experimental/navigator/pkg/registry/navigator/escluster [no test files]
? github.com/jetstack-experimental/navigator/pkg/registry/navigator/pilot [no test files]
? github.com/jetstack-experimental/navigator/pkg/test/integration/framework [no test files]
? github.com/jetstack-experimental/navigator/pkg/util [no test files]
? github.com/jetstack-experimental/navigator/pkg/util/errors [no test files]
ok github.com/jetstack-experimental/navigator/pkg/util/hash 0.032s
make: *** [Makefile:84: go_test] Error 2
With go version go1.8.4 linux/amd64
I left one or two additional questions and comments above.
Please answer or address at your discretion and then merge.
@@ -30,25 +30,21 @@ required = [ | |||
] | |||
|
|||
[[constraint]] | |||
name = "github.com/Sirupsen/logrus" | |||
revision = "v0.6.2-10-g51fe59a" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I guess this is because we've switched to glog
in navigator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - this was just a constraint since we removed use of logrus (the package itself wasn't actually depended upon since before this PR)
name = "k8s.io/client-go" | ||
branch = "master" | ||
branch = "release-5.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Is there any advantage to using a version
directive here? Will the release branch be updated with patch releases etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the release branches are updated. We'll need to run dep ensure -update
periodically to re-vendor those changes.
$(BINDIR)/client-gen \ | ||
$(BINDIR)/lister-gen \ | ||
$(BINDIR)/informer-gen | ||
touch $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ So we no longer have to compile these binaries? Where do they get compiled now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They now get compiled as part of the new script in code-generator. See: kubernetes/kubernetes#52186
clientset "github.com/jetstack-experimental/navigator/pkg/client/clientset_generated/internalclientset" | ||
informers "github.com/jetstack-experimental/navigator/pkg/client/informers_generated/internalversion" | ||
clientset "github.com/jetstack-experimental/navigator/pkg/client/clientset/internalversion" | ||
informers "github.com/jetstack-experimental/navigator/pkg/client/informers/internalversion" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ So how do we decide whether to use the internalversion
or the versioned
APIs? I guess I can see why the API server its self should use the internal versions, but why shouldn't the controller also use the internal APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal types should only be used within the API machinery for the apiserver, or if for some reason you need to convert between two external versions. That said, our controller should be built against one and only one version of the API, so there should basically never be a requirement to convert locally.
The controller shouldn't use the internal types for a number of reasons:
- These types can change, breaking compatibility.
- If we were to use the internal types, we'd then need to convert back into a versioned type in order to submit it back to the API server. We'd also need to convert to the internal version clientside too.
- I'd question what we have to gain from trying to do this
- It's also against all best practices for this sort of stuff, and would be a departure from how it is done within the k8s codebase. I can't recall an issue or justification for this decision, but I'm certain there is one with good reason.
There are a number of other potential complexities in doing this, and @dippynark and I did discuss it recently. I've managed to forget most of our thoughts on it though now! I will update here if they come back to me 😄
BINDIR=${REPO_ROOT}/bin | ||
HACKDIR=${HACKDIR:-hack} | ||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. | ||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I can't quite figure out what this is doing? Does it need an explanatory comment or is this copied over from Kubernetes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's copied over from the Kubernetes codebase. Roughly:
- Set CODEGEN_PKG to CODEGEN_PKG if it is already set
- Otherwise,
cd
into the root of the repo (SCRIPT_ROOT) and attempt to list./vendor/k8s.io/code-generator
if it exists, piping errors to /dev/null. If this command is successful,./vendor/k8s.io/code-generator
is printed to stdout fromls
, thus CODEGEN_PKG becomes./vendor/k8s.io/code-generator
. - Otherwise, return
../code-generator
. This final step is to deal with the case where our project is located within$GOPATH/src/k8s.io
(ork8s.io/kubernetes/staging/src/k8s.io/
). I copied this from thesample-controller
project, hence this extra condition 😄
The script itself will error regardless if this path is set incorrectly, so I'm not too bothered about falling back to a directory that likely doesn't exist.
Ah ignore me:
There were some lingering files frrom my cassandra work. |
Thanks for the review @wallrj - I've responded to your comments above. Running |
No description provided.