aaronlevy / kube-controller-demo Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
It's possible that new versions of kubernetes introduce new fields in objects (e.g. "taints" on node objects in v1.6). If we use update()
rather than patch()
we possibly will clear these fields inadvertently if our client-go is not up-to-date enough to know about the new fields.
Discussion of running into this issue with flannel: flannel-io/flannel#667 (comment)
Hi Aaron,
What software license is this code released under?
I installed go 1.8.3 into $HOME/go, added this to my .bashrc:
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
cloned the repo and make all
gives me:
mkdir -p bin/linux/
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/aaronlevy/kube-controller-demo/common.Version=b1ef16ef4d572ea4496502d0520c64e2565e068f" -o bin/linux/r
eboot-agent github.com/aaronlevy/kube-controller-demo/reboot-agent
can't load package: package github.com/aaronlevy/kube-controller-demo/reboot-agent: cannot find package "github.com/aaronlevy/kube-controller-demo/reboot-agent
" in any of:
/home/thk/go/src/github.com/aaronlevy/kube-controller-demo/reboot-agent (from $GOROOT)
($GOPATH not set. For more details see: 'go help gopath')
Makefile:27: recipe for target 'bin/linux/reboot-agent' failed
make: *** [bin/linux/reboot-agent] Error 1
Hi Aaron!
I really enjoyed your presentation last week at KubeCon. I played around with this controller demo, and I was wondering what your take is on how to test a controller?
Is the best way to mock out the events? If so, how do you mock them?
Cheers!
when i run make clean all i get this
rm -rf bin
mkdir -p bin/linux/
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/aaronlevy/kube-controller-demo/common.Version=0c4f2e33657ce6011a55ed9d0f6f987ae09ebdc2-dirty" -o bin/linux/reboot-agent github.com/aaronlevy/kube-controller-demo/reboot-agent
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/tools/clientcmd/api
vendor/k8s.io/client-go/tools/clientcmd/api/register.go:35:11: cannot use Config literal (type *Config) as type runtime.Object in argument to scheme.AddKnownTypes:
*Config does not implement runtime.Object (missing DeepCopyObject method)
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/authentication
vendor/k8s.io/client-go/pkg/apis/authentication/register.go:47:16: cannot use TokenReview literal (type *TokenReview) as type runtime.Object in argument to scheme.AddKnownTypes:
*TokenReview does not implement runtime.Object (missing DeepCopyObject method)
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/authorization
vendor/k8s.io/client-go/pkg/apis/authorization/register.go:47:28: cannot use SelfSubjectAccessReview literal (type *SelfSubjectAccessReview) as type runtime.Object in argument to scheme.AddKnownTypes:
*SelfSubjectAccessReview does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/authorization/register.go:48:24: cannot use SubjectAccessReview literal (type *SubjectAccessReview) as type runtime.Object in argument to scheme.AddKnownTypes:
*SubjectAccessReview does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/authorization/register.go:49:29: cannot use LocalSubjectAccessReview literal (type *LocalSubjectAccessReview) as type runtime.Object in argument to scheme.AddKnownTypes:
*LocalSubjectAccessReview does not implement runtime.Object (missing DeepCopyObject method)
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/certificates
vendor/k8s.io/client-go/pkg/apis/certificates/register.go:48:30: cannot use CertificateSigningRequest literal (type *CertificateSigningRequest) as type runtime.Object in argument to scheme.AddKnownTypes:
*CertificateSigningRequest does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/certificates/register.go:49:34: cannot use CertificateSigningRequestList literal (type *CertificateSigningRequestList) as type runtime.Object in argument to scheme.AddKnownTypes:
*CertificateSigningRequestList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/certificates/zz_generated.deepcopy.go:71:22: cannot use in.LastUpdateTime.DeepCopy() (type *v1.Time) as type v1.Time in assignment
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/policy
vendor/k8s.io/client-go/pkg/apis/policy/register.go:49:24: cannot use PodDisruptionBudget literal (type *PodDisruptionBudget) as type runtime.Object in argument to scheme.AddKnownTypes:
*PodDisruptionBudget does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/policy/register.go:50:28: cannot use PodDisruptionBudgetList literal (type *PodDisruptionBudgetList) as type runtime.Object in argument to scheme.AddKnownTypes:
*PodDisruptionBudgetList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/policy/register.go:51:13: cannot use Eviction literal (type *Eviction) as type runtime.Object in argument to scheme.AddKnownTypes:
*Eviction does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/policy/zz_generated.deepcopy.go:132:17: cannot use val.DeepCopy() (type *v1.Time) as type v1.Time in assignment
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/rbac
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:47:9: cannot use Role literal (type *Role) as type runtime.Object in argument to scheme.AddKnownTypes:
*Role does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:48:16: cannot use RoleBinding literal (type *RoleBinding) as type runtime.Object in argument to scheme.AddKnownTypes:
*RoleBinding does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:49:20: cannot use RoleBindingList literal (type *RoleBindingList) as type runtime.Object in argument to scheme.AddKnownTypes:
*RoleBindingList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:50:13: cannot use RoleList literal (type *RoleList) as type runtime.Object in argument to scheme.AddKnownTypes:
*RoleList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:52:16: cannot use ClusterRole literal (type *ClusterRole) as type runtime.Object in argument to scheme.AddKnownTypes:
*ClusterRole does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:53:23: cannot use ClusterRoleBinding literal (type *ClusterRoleBinding) as type runtime.Object in argument to scheme.AddKnownTypes:
*ClusterRoleBinding does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:54:27: cannot use ClusterRoleBindingList literal (type *ClusterRoleBindingList) as type runtime.Object in argument to scheme.AddKnownTypes:
*ClusterRoleBindingList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/rbac/register.go:55:20: cannot use ClusterRoleList literal (type *ClusterRoleList) as type runtime.Object in argument to scheme.AddKnownTypes:
*ClusterRoleList does not implement runtime.Object (missing DeepCopyObject method)
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/apis/storage
vendor/k8s.io/client-go/pkg/apis/storage/register.go:47:17: cannot use StorageClass literal (type *StorageClass) as type runtime.Object in argument to scheme.AddKnownTypes:
*StorageClass does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/apis/storage/register.go:48:21: cannot use StorageClassList literal (type *StorageClassList) as type runtime.Object in argument to scheme.AddKnownTypes:
*StorageClassList does not implement runtime.Object (missing DeepCopyObject method)
# github.com/aaronlevy/kube-controller-demo/vendor/k8s.io/client-go/pkg/api
vendor/k8s.io/client-go/pkg/api/defaults.go:26:15: scheme.AddDefaultingFuncs undefined (type *runtime.Scheme has no field or method AddDefaultingFuncs)
vendor/k8s.io/client-go/pkg/api/ref.go:44:19: impossible type assertion:
*ObjectReference does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/api/ref.go:72:12: cannot use objectMeta (type v1.Object) as type meta.List in assignment:
v1.Object does not implement meta.List (missing GetContinue method)
vendor/k8s.io/client-go/pkg/api/register.go:80:8: cannot use Pod literal (type *Pod) as type runtime.Object in argument to scheme.AddKnownTypes:
*Pod does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/api/register.go:81:12: cannot use PodList literal (type *PodList) as type runtime.Object in argument to scheme.AddKnownTypes:
*PodList does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/api/register.go:82:20: cannot use PodStatusResult literal (type *PodStatusResult) as type runtime.Object in argument to scheme.AddKnownTypes:
*PodStatusResult does not implement runtime.Object (missing DeepCopyObject method)
vendor/k8s.io/client-go/pkg/api/types.go:3821:2: const initializer v1.LabelHostname + "," + v1.LabelZoneFailureDomain + "," + v1.LabelZoneRegion is not a constant
vendor/k8s.io/client-go/pkg/api/types.go:3821:33: undefined: v1.LabelHostname
vendor/k8s.io/client-go/pkg/api/types.go:3821:62: undefined: v1.LabelZoneFailureDomain
vendor/k8s.io/client-go/pkg/api/types.go:3821:100: undefined: v1.LabelZoneRegion
vendor/k8s.io/client-go/pkg/api/register.go:82:20: too many errors
make: *** [bin/linux/reboot-agent] Error 2
I am trying to adapt this example by adding my own Custom Resource Type. When I change the name of the resource type from Example I get Deepcopy
not supported errors. I think that I am supposed to run deepcopy-gen
on the package - but it is unclear how to do so.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.