From d3e01aa2605ed7cfab686b62e474d0904a035aa4 Mon Sep 17 00:00:00 2001 From: "yongzhi.yang" Date: Tue, 14 May 2019 14:29:32 +0800 Subject: [PATCH] Redefine Migrate CRD. --- artifacts/examples/crd.yaml | 4 +- artifacts/examples/example-foo.yaml | 2 +- controller.go | 8 +- go.mod | 5 +- go.sum | 91 +++++- hack/codegen.sh | 5 +- main.go | 2 +- pkg/apis/example/v1/doc.go | 12 + pkg/apis/{migrate => example}/v1/register.go | 12 +- .../v1/footypes.go => example/v1/types.go} | 0 pkg/apis/migrate/v1/doc.go | 5 - pkg/apis/migrate/v1/types.go | 68 ---- pkg/apis/migrate/v1/zz_generated.deepcopy.go | 296 ------------------ pkg/client/clientset/versioned/clientset.go | 87 ----- pkg/client/clientset/versioned/doc.go | 9 - .../versioned/fake/clientset_generated.go | 71 ----- pkg/client/clientset/versioned/fake/doc.go | 9 - .../clientset/versioned/fake/register.go | 45 --- pkg/client/clientset/versioned/scheme/doc.go | 9 - .../clientset/versioned/scheme/register.go | 45 --- .../versioned/typed/migrate/v1/doc.go | 9 - .../versioned/typed/migrate/v1/fake/doc.go | 9 - .../typed/migrate/v1/fake/fake_foo.go | 129 -------- .../typed/migrate/v1/fake/fake_migrate.go | 129 -------- .../migrate/v1/fake/fake_migrate_client.go | 33 -- .../versioned/typed/migrate/v1/foo.go | 163 ---------- .../typed/migrate/v1/generated_expansion.go | 12 - .../versioned/typed/migrate/v1/migrate.go | 163 ---------- .../typed/migrate/v1/migrate_client.go | 84 ----- .../informers/externalversions/factory.go | 169 ---------- .../informers/externalversions/generic.go | 53 ---- .../internalinterfaces/factory_interfaces.go | 27 -- .../externalversions/migrate/interface.go | 35 --- .../externalversions/migrate/v1/foo.go | 78 ----- .../externalversions/migrate/v1/interface.go | 41 --- .../externalversions/migrate/v1/migrate.go | 78 ----- .../listers/migrate/v1/expansion_generated.go | 24 -- pkg/client/listers/migrate/v1/foo.go | 83 ----- pkg/client/listers/migrate/v1/migrate.go | 83 ----- 39 files changed, 118 insertions(+), 2069 deletions(-) create mode 100644 pkg/apis/example/v1/doc.go rename pkg/apis/{migrate => example}/v1/register.go (84%) rename pkg/apis/{migrate/v1/footypes.go => example/v1/types.go} (100%) delete mode 100644 pkg/apis/migrate/v1/doc.go delete mode 100644 pkg/apis/migrate/v1/types.go delete mode 100644 pkg/apis/migrate/v1/zz_generated.deepcopy.go delete mode 100644 pkg/client/clientset/versioned/clientset.go delete mode 100644 pkg/client/clientset/versioned/doc.go delete mode 100644 pkg/client/clientset/versioned/fake/clientset_generated.go delete mode 100644 pkg/client/clientset/versioned/fake/doc.go delete mode 100644 pkg/client/clientset/versioned/fake/register.go delete mode 100644 pkg/client/clientset/versioned/scheme/doc.go delete mode 100644 pkg/client/clientset/versioned/scheme/register.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/fake/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_foo.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate_client.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/foo.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/generated_expansion.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/migrate.go delete mode 100644 pkg/client/clientset/versioned/typed/migrate/v1/migrate_client.go delete mode 100644 pkg/client/informers/externalversions/factory.go delete mode 100644 pkg/client/informers/externalversions/generic.go delete mode 100644 pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go delete mode 100644 pkg/client/informers/externalversions/migrate/interface.go delete mode 100644 pkg/client/informers/externalversions/migrate/v1/foo.go delete mode 100644 pkg/client/informers/externalversions/migrate/v1/interface.go delete mode 100644 pkg/client/informers/externalversions/migrate/v1/migrate.go delete mode 100644 pkg/client/listers/migrate/v1/expansion_generated.go delete mode 100644 pkg/client/listers/migrate/v1/foo.go delete mode 100644 pkg/client/listers/migrate/v1/migrate.go diff --git a/artifacts/examples/crd.yaml b/artifacts/examples/crd.yaml index ea9986e..f95c501 100644 --- a/artifacts/examples/crd.yaml +++ b/artifacts/examples/crd.yaml @@ -1,9 +1,9 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: foos.migrate.dmall.com + name: foos.example.dmall.com spec: - group: migrate.dmall.com + group: example.dmall.com version: v1 names: kind: Foo diff --git a/artifacts/examples/example-foo.yaml b/artifacts/examples/example-foo.yaml index 67adf67..02d9938 100644 --- a/artifacts/examples/example-foo.yaml +++ b/artifacts/examples/example-foo.yaml @@ -1,4 +1,4 @@ -apiVersion: migrate.dmall.com/v1 +apiVersion: example.dmall.com/v1 kind: Foo metadata: name: example-foo diff --git a/controller.go b/controller.go index 5b238f8..dcf4d9d 100644 --- a/controller.go +++ b/controller.go @@ -38,11 +38,11 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog" - samplev1alpha1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" + samplev1alpha1 "github.com/yangyongzhi/sym-operator/pkg/apis/example/v1" clientset "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" samplescheme "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/scheme" - informers "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/migrate/v1" - listers "github.com/yangyongzhi/sym-operator/pkg/client/listers/migrate/v1" + informers "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/example/v1" + listers "github.com/yangyongzhi/sym-operator/pkg/client/listers/example/v1" ) const controllerAgentName = "sample-controller" @@ -329,7 +329,7 @@ func (c *Controller) updateFooStatus(foo *samplev1alpha1.Foo, deployment *appsv1 // we must use Update instead of UpdateStatus to update the Status block of the Foo resource. // UpdateStatus will not allow changes to the Spec of the resource, // which is ideal for ensuring nothing other than resource status has been updated. - _, err := c.sampleclientset.MigrateV1().Foos(foo.Namespace).Update(fooCopy) + _, err := c.sampleclientset.ExampleV1().Foos(foo.Namespace).Update(fooCopy) return err } diff --git a/go.mod b/go.mod index 9a2d9f2..0322ad8 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,9 @@ module github.com/yangyongzhi/sym-operator go 1.12 require ( - k8s.io/api v0.0.0-20190425012535-181e1f9c52c1 - k8s.io/apimachinery v0.0.0-20190425132440-17f84483f500 + k8s.io/api v0.0.0-20190430012547-97d6bb8ea5f4 + k8s.io/apiextensions-apiserver v0.0.0-20190502093314-7526e4c489ad + k8s.io/apimachinery v0.0.0-20190502092502-a44ef629a3c9 k8s.io/client-go v0.0.0-20190425172711-65184652c889 k8s.io/code-generator v0.0.0-20190419212335-ff26e7842f9d k8s.io/klog v0.3.0 diff --git a/go.sum b/go.sum index 5b4fed1..3dc2344 100644 --- a/go.sum +++ b/go.sum @@ -1,54 +1,130 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest v11.1.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/YangYongZhi/sym-operator v0.0.0-20190425173525-f9c23632fb31 h1:FdGzSRXIeoPvlZjAkPE2jEcivZNLUbCJ3ncej+l5Rsc= +github.com/YangYongZhi/sym-operator v0.0.0-20190425173525-f9c23632fb31/go.mod h1:GHuOX/EqRZMKxNeVbZW7O0e9A6QsqDjruyOD0k49uVc= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-oidc v0.0.0-20180117170138-065b426bd416/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.0.0-20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550 h1:mV9jbLoSW/8m4VK16ZkHTozJa8sesK5u5kTMFysTYac= github.com/evanphx/json-patch v0.0.0-20190203023257-5858425f7550/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= +github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.17.2/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.17.2/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.17.2/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= +github.com/go-openapi/runtime v0.17.2/go.mod h1:QO936ZXeisByFmZEO1IS1Dqhtf4QV1sYYFtIq6Ld86Q= +github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.17.2/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.17.2/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/validate v0.17.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= +github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415 h1:WSBJMqJbLxsn+bTCPyPYZfqHdJmc8MK4wrBjMft6BAM= github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 h1:LbsanbbD6LieFkXbj9YNNBupiGHJgFeLpO0j0Fza1h8= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20160524151835-7d79101e329e/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20190126172459-c818fa66e4c8/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20190222133341-cfaf5686ec79/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20170330212424-2500245aa611/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.0.0-20141017032234-72f9bd7c4e0c/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be h1:AHimNtVIpiBjPUhEF5KNCkrUyqTSA5zWUl8sQ2bfGBE= github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3 h1:EooPXg51Tn+xmWPXJUGCnJhJSpeuMlBmfJVcqIRmmv8= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +github.com/pquerna/ffjson v0.0.0-20180717144149-af8b230fcd20/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spf13/cobra v0.0.0-20180319062004-c439c4fa0937/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +go.uber.org/atomic v0.0.0-20181018215023-8dc6146f7569/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v0.0.0-20180122172545-ddea229ff1df/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v0.0.0-20180814183419-67bc79d13d15/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 h1:a4tQYYYuK9QdeO/+kEvNYyuR21S+7ve5EANok6hABhI= golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -58,6 +134,8 @@ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMx golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 h1:bfLnR+k0tq5Lqt6dflRLcZiz6UaXCMt3vhYJ1l4FQ80= golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -82,32 +160,40 @@ gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmK google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20170731182057-09f6ed296fc6/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.0 h1:3zYtXIO92bvsdS3ggAdA8Gb4Azj0YU+TVY1uGYNFA8o= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/square/go-jose.v2 v2.0.0-20180411045311-89060dee6a84/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= k8s.io/api v0.0.0-20190425012535-181e1f9c52c1 h1:VfWCVGGx0+ll/JC2oT+5ClpHdiLKLhuko1l7LKG4dh4= k8s.io/api v0.0.0-20190425012535-181e1f9c52c1/go.mod h1:AhUc3Ph6fhRc0SCpt0Hwv0E+Q8QiEAASkXKwfmT2JwU= +k8s.io/apiextensions-apiserver v0.0.0-20190502093314-7526e4c489ad h1:Q8IaN2LtugoqV8/Fje/FE4vp4YROCC/h4weutuVmx9M= +k8s.io/apiextensions-apiserver v0.0.0-20190502093314-7526e4c489ad/go.mod h1:Dp4sCAz9MEoM3OEZ9LRtFOBPJTzHkquYEXothhs/f6s= k8s.io/apimachinery v0.0.0-20190425132440-17f84483f500 h1:WP0qwo6Cks8BJpy/B2EOUWOyuVoGEYu3x9kVpON7wTs= k8s.io/apimachinery v0.0.0-20190425132440-17f84483f500/go.mod h1:5CBnzrKYGHzv9ZsSKmQ8wHt4XI4/TUBPDwYM9FlZMyw= +k8s.io/apiserver v0.0.0-20190430013002-3d1cdf2f60bd/go.mod h1:Qd6Q9MzYKs0mxye8vaBweHFzjQSwMaKy+CIUz7mkm2s= k8s.io/client-go v0.0.0-20190425172711-65184652c889 h1:pWRBXbVKnn/NYm4uGk3If9XmXaaWxwJ9J+fSok8LmME= k8s.io/client-go v0.0.0-20190425172711-65184652c889/go.mod h1:PeVFCnjeDy6EwLN+wdDIZd1DwDY6jnkpQt9psMo5YRU= k8s.io/code-generator v0.0.0-20190419212335-ff26e7842f9d h1:QY1FeareEgkYrWnF2D2XxZFlF0k5Ir4uE8YjD1kHi94= k8s.io/code-generator v0.0.0-20190419212335-ff26e7842f9d/go.mod h1:rVrFWfTVftGH7bb972nWC6N4QkJ4LU7FOXu8GH2UkJo= +k8s.io/component-base v0.0.0-20190424053038-9fe063da3132/go.mod h1:pi2NQz+AaW5UMjaswai1Hfzqzhh7bV6ssi3X3k4s03g= k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af h1:SwjZbO0u5ZuaV6TRMWOGB40iaycX8sbdMQHtjNZ19dk= k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.3.0 h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 h1:TRb4wNWoBVrH9plmkp2q86FIDppkbrEXdXlxU3a3BMI= k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= -github.com/YangYongZhi/sym-operator v0.0.0-20190425173525-f9c23632fb31 h1:FdGzSRXIeoPvlZjAkPE2jEcivZNLUbCJ3ncej+l5Rsc= -github.com/YangYongZhi/sym-operator v0.0.0-20190425173525-f9c23632fb31/go.mod h1:GHuOX/EqRZMKxNeVbZW7O0e9A6QsqDjruyOD0k49uVc= k8s.io/utils v0.0.0-20190221042446-c2654d5206da h1:ElyM7RPonbKnQqOcw7dG2IK5uvQQn3b/WPHqD5mBvP4= k8s.io/utils v0.0.0-20190221042446-c2654d5206da/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= @@ -115,5 +201,6 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +sigs.k8s.io/structured-merge-diff v0.0.0-20190302045857-e85c7b244fd2/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/hack/codegen.sh b/hack/codegen.sh index e3087c7..8d52b8d 100755 --- a/hack/codegen.sh +++ b/hack/codegen.sh @@ -7,12 +7,13 @@ PACKAGE_NAME=github.com/yangyongzhi/sym-operator REPO_ROOT="$GOPATH/src/$PACKAGE_NAME" DOCKER_REPO_ROOT="/go/src/$PACKAGE_NAME" DOCKER_CODEGEN_PKG="/go/src/k8s.io/code-generator" -apiGroups=(migrate/v1) +apiGroups=(example/v1 devops/v1) pushd $REPO_ROOT ## Generate ugorji stuff rm "$REPO_ROOT"/pkg/apis/migrate/v1/*.deepcopy.go +rm "$REPO_ROOT"/pkg/apis/example/v1/*.deepcopy.go @@ -23,7 +24,7 @@ docker run --rm -ti -u $(id -u):$(id -g) \ hub.tencentyun.com/xkcp0324/gengo:release-1.12 "$DOCKER_CODEGEN_PKG"/generate-groups.sh all \ $PACKAGE_NAME/pkg/client \ $PACKAGE_NAME/pkg/apis \ - "migrate:v1" \ + "example:v1 devops:v1" \ --go-header-file "$DOCKER_REPO_ROOT/hack/boilerplate.go.txt" popd \ No newline at end of file diff --git a/main.go b/main.go index 7a1a986..5bf7953 100644 --- a/main.go +++ b/main.go @@ -65,7 +65,7 @@ func main() { controller := NewController(kubeClient, exampleClient, kubeInformerFactory.Apps().V1().Deployments(), - exampleInformerFactory.Migrate().V1().Foos()) + exampleInformerFactory.Example().V1().Foos()) // notice that there is no need to run Start methods in a separate goroutine. (i.e. go kubeInformerFactory.Start(stopCh) // Start method is non-blocking and runs all registered informers in a dedicated goroutine. diff --git a/pkg/apis/example/v1/doc.go b/pkg/apis/example/v1/doc.go new file mode 100644 index 0000000..10041ae --- /dev/null +++ b/pkg/apis/example/v1/doc.go @@ -0,0 +1,12 @@ +// Package v1 is the v1 version of the API. + +// +k8s:deepcopy-gen=package,register +// +groupName=example.dmall.com +package v1 + +const ( + // GroupName is the group name use in this package + GroupName = "example.dmall.com" + // ResourceVersion represent the resource version + ResourceVersion = "v1" +) diff --git a/pkg/apis/migrate/v1/register.go b/pkg/apis/example/v1/register.go similarity index 84% rename from pkg/apis/migrate/v1/register.go rename to pkg/apis/example/v1/register.go index d5ef8b6..add785b 100644 --- a/pkg/apis/migrate/v1/register.go +++ b/pkg/apis/example/v1/register.go @@ -7,16 +7,12 @@ import ( ) const ( - // GroupName is the group name use in this package - GroupName = "migrate.dmall.com" // ResourcePlural is the id to indentify pluarals - ResourcePlural = "migrates" + ResourcePlural = "foos" // ResourceSingular represents the id for identify singular resource - ResourceSingular = "migrate" + ResourceSingular = "foo" // ResourceKind represent the resource kind - ResourceKind = "Migrate" - // ResourceVersion represent the resource version - ResourceVersion = "v1" + ResourceKind = "Foo" ) // SchemeGroupVersion is group version used to register these objects @@ -45,8 +41,6 @@ func init() { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &Migrate{}, - &MigrateList{}, &Foo{}, &FooList{}, ) diff --git a/pkg/apis/migrate/v1/footypes.go b/pkg/apis/example/v1/types.go similarity index 100% rename from pkg/apis/migrate/v1/footypes.go rename to pkg/apis/example/v1/types.go diff --git a/pkg/apis/migrate/v1/doc.go b/pkg/apis/migrate/v1/doc.go deleted file mode 100644 index 00766c9..0000000 --- a/pkg/apis/migrate/v1/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package v1 is the v1 version of the API. - -// +k8s:deepcopy-gen=package,register -// +groupName=migrate.dmall.com -package v1 diff --git a/pkg/apis/migrate/v1/types.go b/pkg/apis/migrate/v1/types.go deleted file mode 100644 index 96cc1c5..0000000 --- a/pkg/apis/migrate/v1/types.go +++ /dev/null @@ -1,68 +0,0 @@ -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Migrate -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type Migrate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec MigrateSpec `json:"spec,omitempty"` - Status MigrateStatus `json:"status,omitempty"` -} - -// MigrateList -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type MigrateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Migrate `json:"items"` -} - -// MigrateSpec -type MigrateSpec struct { - // matchLabels for pod deploy endpoint event ... - MatchLabels map[string]string `json:"matchLabels,omitempty"` - - // Name is the name of the release - Releases map[string]*ReleasesConfig `json:"Releases,omitempty"` - - Chart []byte `json:"chart,omitempty"` - - // Check helm Release are removed - Paused bool `json:"paused,omitempty"` - - // Data *map[string][]byte `json:"data,omitempty"` -} - -// ReleasesConfig -type ReleasesConfig struct { - // Name is the name of the release - Name string `json:"name,omitempty"` - // Namespace is the kubernetes namespace of the release. - Namespace string `json:"namespace,omitempty"` - // Config supplies values to the parametrizable templates of a chart. - Raw string `json:"raw,omitempty"` - Values map[string]*string `json:"values,omitempty"` -} - -// MigrateStatus -type MigrateStatus struct { - Conditions []MigrateCondition `json:"conditions,omitempty"` - StartTime *metav1.Time `json:"startTime,omitempty"` - LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"` -} - -type MigrateCondition struct { - Type string `json:"type"` - Status string `json:"status"` - LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` -} diff --git a/pkg/apis/migrate/v1/zz_generated.deepcopy.go b/pkg/apis/migrate/v1/zz_generated.deepcopy.go deleted file mode 100644 index c5ac972..0000000 --- a/pkg/apis/migrate/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,296 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Foo) DeepCopyInto(out *Foo) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Foo. -func (in *Foo) DeepCopy() *Foo { - if in == nil { - return nil - } - out := new(Foo) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Foo) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooList) DeepCopyInto(out *FooList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Foo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooList. -func (in *FooList) DeepCopy() *FooList { - if in == nil { - return nil - } - out := new(FooList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *FooList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooSpec) DeepCopyInto(out *FooSpec) { - *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooSpec. -func (in *FooSpec) DeepCopy() *FooSpec { - if in == nil { - return nil - } - out := new(FooSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FooStatus) DeepCopyInto(out *FooStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FooStatus. -func (in *FooStatus) DeepCopy() *FooStatus { - if in == nil { - return nil - } - out := new(FooStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Migrate) DeepCopyInto(out *Migrate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Migrate. -func (in *Migrate) DeepCopy() *Migrate { - if in == nil { - return nil - } - out := new(Migrate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Migrate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MigrateCondition) DeepCopyInto(out *MigrateCondition) { - *out = *in - in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateCondition. -func (in *MigrateCondition) DeepCopy() *MigrateCondition { - if in == nil { - return nil - } - out := new(MigrateCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MigrateList) DeepCopyInto(out *MigrateList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Migrate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateList. -func (in *MigrateList) DeepCopy() *MigrateList { - if in == nil { - return nil - } - out := new(MigrateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MigrateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MigrateSpec) DeepCopyInto(out *MigrateSpec) { - *out = *in - if in.MatchLabels != nil { - in, out := &in.MatchLabels, &out.MatchLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Releases != nil { - in, out := &in.Releases, &out.Releases - *out = make(map[string]*ReleasesConfig, len(*in)) - for key, val := range *in { - var outVal *ReleasesConfig - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(ReleasesConfig) - (*in).DeepCopyInto(*out) - } - (*out)[key] = outVal - } - } - if in.Chart != nil { - in, out := &in.Chart, &out.Chart - *out = make([]byte, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateSpec. -func (in *MigrateSpec) DeepCopy() *MigrateSpec { - if in == nil { - return nil - } - out := new(MigrateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MigrateStatus) DeepCopyInto(out *MigrateStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]MigrateCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.StartTime != nil { - in, out := &in.StartTime, &out.StartTime - *out = (*in).DeepCopy() - } - if in.LastUpdateTime != nil { - in, out := &in.LastUpdateTime, &out.LastUpdateTime - *out = (*in).DeepCopy() - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateStatus. -func (in *MigrateStatus) DeepCopy() *MigrateStatus { - if in == nil { - return nil - } - out := new(MigrateStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReleasesConfig) DeepCopyInto(out *ReleasesConfig) { - *out = *in - if in.Values != nil { - in, out := &in.Values, &out.Values - *out = make(map[string]*string, len(*in)) - for key, val := range *in { - var outVal *string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = new(string) - **out = **in - } - (*out)[key] = outVal - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleasesConfig. -func (in *ReleasesConfig) DeepCopy() *ReleasesConfig { - if in == nil { - return nil - } - out := new(ReleasesConfig) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go deleted file mode 100644 index 2a41441..0000000 --- a/pkg/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - migratev1 "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/typed/migrate/v1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - MigrateV1() migratev1.MigrateV1Interface - // Deprecated: please explicitly pick a version if possible. - Migrate() migratev1.MigrateV1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - migrateV1 *migratev1.MigrateV1Client -} - -// MigrateV1 retrieves the MigrateV1Client -func (c *Clientset) MigrateV1() migratev1.MigrateV1Interface { - return c.migrateV1 -} - -// Deprecated: Migrate retrieves the default version of MigrateClient. -// Please explicitly pick a version. -func (c *Clientset) Migrate() migratev1.MigrateV1Interface { - return c.migrateV1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.migrateV1, err = migratev1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.migrateV1 = migratev1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.migrateV1 = migratev1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/pkg/client/clientset/versioned/doc.go b/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 3f10b0f..0000000 --- a/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index 9b1fbad..0000000 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" - migratev1 "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/typed/migrate/v1" - fakemigratev1 "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/typed/migrate/v1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -var _ clientset.Interface = &Clientset{} - -// MigrateV1 retrieves the MigrateV1Client -func (c *Clientset) MigrateV1() migratev1.MigrateV1Interface { - return &fakemigratev1.FakeMigrateV1{Fake: &c.Fake} -} - -// Migrate retrieves the MigrateV1Client -func (c *Clientset) Migrate() migratev1.MigrateV1Interface { - return &fakemigratev1.FakeMigrateV1{Fake: &c.Fake} -} diff --git a/pkg/client/clientset/versioned/fake/doc.go b/pkg/client/clientset/versioned/fake/doc.go deleted file mode 100644 index 393b429..0000000 --- a/pkg/client/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go deleted file mode 100644 index 86199fc..0000000 --- a/pkg/client/clientset/versioned/fake/register.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) -var parameterCodec = runtime.NewParameterCodec(scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - migratev1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/pkg/client/clientset/versioned/scheme/doc.go b/pkg/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index 0500c92..0000000 --- a/pkg/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go deleted file mode 100644 index ccced79..0000000 --- a/pkg/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - migratev1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/doc.go b/pkg/client/clientset/versioned/typed/migrate/v1/doc.go deleted file mode 100644 index c9bf819..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/migrate/v1/fake/doc.go deleted file mode 100644 index 20faa07..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/fake/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_foo.go b/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_foo.go deleted file mode 100644 index f062ce3..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_foo.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeFoos implements FooInterface -type FakeFoos struct { - Fake *FakeMigrateV1 - ns string -} - -var foosResource = schema.GroupVersionResource{Group: "migrate.dmall.com", Version: "v1", Resource: "foos"} - -var foosKind = schema.GroupVersionKind{Group: "migrate.dmall.com", Version: "v1", Kind: "Foo"} - -// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any. -func (c *FakeFoos) Get(name string, options v1.GetOptions) (result *migratev1.Foo, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(foosResource, c.ns, name), &migratev1.Foo{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Foo), err -} - -// List takes label and field selectors, and returns the list of Foos that match those selectors. -func (c *FakeFoos) List(opts v1.ListOptions) (result *migratev1.FooList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(foosResource, foosKind, c.ns, opts), &migratev1.FooList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &migratev1.FooList{ListMeta: obj.(*migratev1.FooList).ListMeta} - for _, item := range obj.(*migratev1.FooList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested foos. -func (c *FakeFoos) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(foosResource, c.ns, opts)) - -} - -// Create takes the representation of a foo and creates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *FakeFoos) Create(foo *migratev1.Foo) (result *migratev1.Foo, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(foosResource, c.ns, foo), &migratev1.Foo{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Foo), err -} - -// Update takes the representation of a foo and updates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *FakeFoos) Update(foo *migratev1.Foo) (result *migratev1.Foo, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(foosResource, c.ns, foo), &migratev1.Foo{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Foo), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeFoos) UpdateStatus(foo *migratev1.Foo) (*migratev1.Foo, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(foosResource, "status", c.ns, foo), &migratev1.Foo{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Foo), err -} - -// Delete takes name of the foo and deletes it. Returns an error if one occurs. -func (c *FakeFoos) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(foosResource, c.ns, name), &migratev1.Foo{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeFoos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(foosResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &migratev1.FooList{}) - return err -} - -// Patch applies the patch and returns the patched foo. -func (c *FakeFoos) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *migratev1.Foo, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(foosResource, c.ns, name, data, subresources...), &migratev1.Foo{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Foo), err -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate.go b/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate.go deleted file mode 100644 index cebde78..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate.go +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeMigrates implements MigrateInterface -type FakeMigrates struct { - Fake *FakeMigrateV1 - ns string -} - -var migratesResource = schema.GroupVersionResource{Group: "migrate.dmall.com", Version: "v1", Resource: "migrates"} - -var migratesKind = schema.GroupVersionKind{Group: "migrate.dmall.com", Version: "v1", Kind: "Migrate"} - -// Get takes name of the migrate, and returns the corresponding migrate object, and an error if there is any. -func (c *FakeMigrates) Get(name string, options v1.GetOptions) (result *migratev1.Migrate, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(migratesResource, c.ns, name), &migratev1.Migrate{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Migrate), err -} - -// List takes label and field selectors, and returns the list of Migrates that match those selectors. -func (c *FakeMigrates) List(opts v1.ListOptions) (result *migratev1.MigrateList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(migratesResource, migratesKind, c.ns, opts), &migratev1.MigrateList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &migratev1.MigrateList{ListMeta: obj.(*migratev1.MigrateList).ListMeta} - for _, item := range obj.(*migratev1.MigrateList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested migrates. -func (c *FakeMigrates) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(migratesResource, c.ns, opts)) - -} - -// Create takes the representation of a migrate and creates it. Returns the server's representation of the migrate, and an error, if there is any. -func (c *FakeMigrates) Create(migrate *migratev1.Migrate) (result *migratev1.Migrate, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(migratesResource, c.ns, migrate), &migratev1.Migrate{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Migrate), err -} - -// Update takes the representation of a migrate and updates it. Returns the server's representation of the migrate, and an error, if there is any. -func (c *FakeMigrates) Update(migrate *migratev1.Migrate) (result *migratev1.Migrate, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(migratesResource, c.ns, migrate), &migratev1.Migrate{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Migrate), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeMigrates) UpdateStatus(migrate *migratev1.Migrate) (*migratev1.Migrate, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(migratesResource, "status", c.ns, migrate), &migratev1.Migrate{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Migrate), err -} - -// Delete takes name of the migrate and deletes it. Returns an error if one occurs. -func (c *FakeMigrates) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(migratesResource, c.ns, name), &migratev1.Migrate{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeMigrates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(migratesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &migratev1.MigrateList{}) - return err -} - -// Patch applies the patch and returns the patched migrate. -func (c *FakeMigrates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *migratev1.Migrate, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(migratesResource, c.ns, name, data, subresources...), &migratev1.Migrate{}) - - if obj == nil { - return nil, err - } - return obj.(*migratev1.Migrate), err -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate_client.go b/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate_client.go deleted file mode 100644 index 00b4381..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/fake/fake_migrate_client.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/typed/migrate/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeMigrateV1 struct { - *testing.Fake -} - -func (c *FakeMigrateV1) Foos(namespace string) v1.FooInterface { - return &FakeFoos{c, namespace} -} - -func (c *FakeMigrateV1) Migrates(namespace string) v1.MigrateInterface { - return &FakeMigrates{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeMigrateV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/foo.go b/pkg/client/clientset/versioned/typed/migrate/v1/foo.go deleted file mode 100644 index 32943ea..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/foo.go +++ /dev/null @@ -1,163 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - scheme "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// FoosGetter has a method to return a FooInterface. -// A group's client should implement this interface. -type FoosGetter interface { - Foos(namespace string) FooInterface -} - -// FooInterface has methods to work with Foo resources. -type FooInterface interface { - Create(*v1.Foo) (*v1.Foo, error) - Update(*v1.Foo) (*v1.Foo, error) - UpdateStatus(*v1.Foo) (*v1.Foo, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.Foo, error) - List(opts metav1.ListOptions) (*v1.FooList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Foo, err error) - FooExpansion -} - -// foos implements FooInterface -type foos struct { - client rest.Interface - ns string -} - -// newFoos returns a Foos -func newFoos(c *MigrateV1Client, namespace string) *foos { - return &foos{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any. -func (c *foos) Get(name string, options metav1.GetOptions) (result *v1.Foo, err error) { - result = &v1.Foo{} - err = c.client.Get(). - Namespace(c.ns). - Resource("foos"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Foos that match those selectors. -func (c *foos) List(opts metav1.ListOptions) (result *v1.FooList, err error) { - result = &v1.FooList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("foos"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested foos. -func (c *foos) Watch(opts metav1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("foos"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a foo and creates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *foos) Create(foo *v1.Foo) (result *v1.Foo, err error) { - result = &v1.Foo{} - err = c.client.Post(). - Namespace(c.ns). - Resource("foos"). - Body(foo). - Do(). - Into(result) - return -} - -// Update takes the representation of a foo and updates it. Returns the server's representation of the foo, and an error, if there is any. -func (c *foos) Update(foo *v1.Foo) (result *v1.Foo, err error) { - result = &v1.Foo{} - err = c.client.Put(). - Namespace(c.ns). - Resource("foos"). - Name(foo.Name). - Body(foo). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *foos) UpdateStatus(foo *v1.Foo) (result *v1.Foo, err error) { - result = &v1.Foo{} - err = c.client.Put(). - Namespace(c.ns). - Resource("foos"). - Name(foo.Name). - SubResource("status"). - Body(foo). - Do(). - Into(result) - return -} - -// Delete takes name of the foo and deletes it. Returns an error if one occurs. -func (c *foos) Delete(name string, options *metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("foos"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *foos) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("foos"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched foo. -func (c *foos) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Foo, err error) { - result = &v1.Foo{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("foos"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/migrate/v1/generated_expansion.go deleted file mode 100644 index a58f333..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/generated_expansion.go +++ /dev/null @@ -1,12 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -type FooExpansion interface{} - -type MigrateExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/migrate.go b/pkg/client/clientset/versioned/typed/migrate/v1/migrate.go deleted file mode 100644 index 0604d31..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/migrate.go +++ /dev/null @@ -1,163 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - scheme "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// MigratesGetter has a method to return a MigrateInterface. -// A group's client should implement this interface. -type MigratesGetter interface { - Migrates(namespace string) MigrateInterface -} - -// MigrateInterface has methods to work with Migrate resources. -type MigrateInterface interface { - Create(*v1.Migrate) (*v1.Migrate, error) - Update(*v1.Migrate) (*v1.Migrate, error) - UpdateStatus(*v1.Migrate) (*v1.Migrate, error) - Delete(name string, options *metav1.DeleteOptions) error - DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error - Get(name string, options metav1.GetOptions) (*v1.Migrate, error) - List(opts metav1.ListOptions) (*v1.MigrateList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Migrate, err error) - MigrateExpansion -} - -// migrates implements MigrateInterface -type migrates struct { - client rest.Interface - ns string -} - -// newMigrates returns a Migrates -func newMigrates(c *MigrateV1Client, namespace string) *migrates { - return &migrates{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the migrate, and returns the corresponding migrate object, and an error if there is any. -func (c *migrates) Get(name string, options metav1.GetOptions) (result *v1.Migrate, err error) { - result = &v1.Migrate{} - err = c.client.Get(). - Namespace(c.ns). - Resource("migrates"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Migrates that match those selectors. -func (c *migrates) List(opts metav1.ListOptions) (result *v1.MigrateList, err error) { - result = &v1.MigrateList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("migrates"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested migrates. -func (c *migrates) Watch(opts metav1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("migrates"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a migrate and creates it. Returns the server's representation of the migrate, and an error, if there is any. -func (c *migrates) Create(migrate *v1.Migrate) (result *v1.Migrate, err error) { - result = &v1.Migrate{} - err = c.client.Post(). - Namespace(c.ns). - Resource("migrates"). - Body(migrate). - Do(). - Into(result) - return -} - -// Update takes the representation of a migrate and updates it. Returns the server's representation of the migrate, and an error, if there is any. -func (c *migrates) Update(migrate *v1.Migrate) (result *v1.Migrate, err error) { - result = &v1.Migrate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("migrates"). - Name(migrate.Name). - Body(migrate). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *migrates) UpdateStatus(migrate *v1.Migrate) (result *v1.Migrate, err error) { - result = &v1.Migrate{} - err = c.client.Put(). - Namespace(c.ns). - Resource("migrates"). - Name(migrate.Name). - SubResource("status"). - Body(migrate). - Do(). - Into(result) - return -} - -// Delete takes name of the migrate and deletes it. Returns an error if one occurs. -func (c *migrates) Delete(name string, options *metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("migrates"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *migrates) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("migrates"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched migrate. -func (c *migrates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Migrate, err error) { - result = &v1.Migrate{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("migrates"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/migrate/v1/migrate_client.go b/pkg/client/clientset/versioned/typed/migrate/v1/migrate_client.go deleted file mode 100644 index 3362f47..0000000 --- a/pkg/client/clientset/versioned/typed/migrate/v1/migrate_client.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type MigrateV1Interface interface { - RESTClient() rest.Interface - FoosGetter - MigratesGetter -} - -// MigrateV1Client is used to interact with features provided by the migrate.dmall.com group. -type MigrateV1Client struct { - restClient rest.Interface -} - -func (c *MigrateV1Client) Foos(namespace string) FooInterface { - return newFoos(c, namespace) -} - -func (c *MigrateV1Client) Migrates(namespace string) MigrateInterface { - return newMigrates(c, namespace) -} - -// NewForConfig creates a new MigrateV1Client for the given config. -func NewForConfig(c *rest.Config) (*MigrateV1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &MigrateV1Client{client}, nil -} - -// NewForConfigOrDie creates a new MigrateV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *MigrateV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new MigrateV1Client for the given RESTClient. -func New(c rest.Interface) *MigrateV1Client { - return &MigrateV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *MigrateV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go deleted file mode 100644 index bd8bb8c..0000000 --- a/pkg/client/informers/externalversions/factory.go +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - reflect "reflect" - sync "sync" - time "time" - - versioned "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" - internalinterfaces "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/internalinterfaces" - migrate "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/migrate" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// SharedInformerOption defines the functional option type for SharedInformerFactory. -type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory - -type sharedInformerFactory struct { - client versioned.Interface - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc - lock sync.Mutex - defaultResync time.Duration - customResync map[reflect.Type]time.Duration - - informers map[reflect.Type]cache.SharedIndexInformer - // startedInformers is used for tracking which informers have been started. - // This allows Start() to be called multiple times safely. - startedInformers map[reflect.Type]bool -} - -// WithCustomResyncConfig sets a custom resync period for the specified informer types. -func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - for k, v := range resyncConfig { - factory.customResync[reflect.TypeOf(k)] = v - } - return factory - } -} - -// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. -func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.tweakListOptions = tweakListOptions - return factory - } -} - -// WithNamespace limits the SharedInformerFactory to the specified namespace. -func WithNamespace(namespace string) SharedInformerOption { - return func(factory *sharedInformerFactory) *sharedInformerFactory { - factory.namespace = namespace - return factory - } -} - -// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. -func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync) -} - -// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. -// Listers obtained via this SharedInformerFactory will be subject to the same filters -// as specified here. -// Deprecated: Please use NewSharedInformerFactoryWithOptions instead -func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { - return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) -} - -// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. -func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { - factory := &sharedInformerFactory{ - client: client, - namespace: v1.NamespaceAll, - defaultResync: defaultResync, - informers: make(map[reflect.Type]cache.SharedIndexInformer), - startedInformers: make(map[reflect.Type]bool), - customResync: make(map[reflect.Type]time.Duration), - } - - // Apply all options - for _, opt := range options { - factory = opt(factory) - } - - return factory -} - -// Start initializes all requested informers. -func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { - f.lock.Lock() - defer f.lock.Unlock() - - for informerType, informer := range f.informers { - if !f.startedInformers[informerType] { - go informer.Run(stopCh) - f.startedInformers[informerType] = true - } - } -} - -// WaitForCacheSync waits for all started informers' cache were synced. -func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func() map[reflect.Type]cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res -} - -// InternalInformerFor returns the SharedIndexInformer for obj using an internal -// client. -func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { - f.lock.Lock() - defer f.lock.Unlock() - - informerType := reflect.TypeOf(obj) - informer, exists := f.informers[informerType] - if exists { - return informer - } - - resyncPeriod, exists := f.customResync[informerType] - if !exists { - resyncPeriod = f.defaultResync - } - - informer = newFunc(f.client, resyncPeriod) - f.informers[informerType] = informer - - return informer -} - -// SharedInformerFactory provides shared informers for resources in all known -// API group versions. -type SharedInformerFactory interface { - internalinterfaces.SharedInformerFactory - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - - Migrate() migrate.Interface -} - -func (f *sharedInformerFactory) Migrate() migrate.Interface { - return migrate.New(f, f.namespace, f.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go deleted file mode 100644 index 0ec88ca..0000000 --- a/pkg/client/informers/externalversions/generic.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package externalversions - -import ( - "fmt" - - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - schema "k8s.io/apimachinery/pkg/runtime/schema" - cache "k8s.io/client-go/tools/cache" -) - -// GenericInformer is type of SharedIndexInformer which will locate and delegate to other -// sharedInformers based on type -type GenericInformer interface { - Informer() cache.SharedIndexInformer - Lister() cache.GenericLister -} - -type genericInformer struct { - informer cache.SharedIndexInformer - resource schema.GroupResource -} - -// Informer returns the SharedIndexInformer. -func (f *genericInformer) Informer() cache.SharedIndexInformer { - return f.informer -} - -// Lister returns the GenericLister. -func (f *genericInformer) Lister() cache.GenericLister { - return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) -} - -// ForResource gives generic access to a shared informer of the matching type -// TODO extend this to unknown resources with a client pool -func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { - switch resource { - // Group=migrate.dmall.com, Version=v1 - case v1.SchemeGroupVersion.WithResource("foos"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Migrate().V1().Foos().Informer()}, nil - case v1.SchemeGroupVersion.WithResource("migrates"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Migrate().V1().Migrates().Informer()}, nil - - } - - return nil, fmt.Errorf("no informer found for %v", resource) -} diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go deleted file mode 100644 index da7be95..0000000 --- a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package internalinterfaces - -import ( - time "time" - - versioned "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - cache "k8s.io/client-go/tools/cache" -) - -type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer - -// SharedInformerFactory a small interface to allow for adding an informer without an import cycle -type SharedInformerFactory interface { - Start(stopCh <-chan struct{}) - InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer -} - -type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/informers/externalversions/migrate/interface.go b/pkg/client/informers/externalversions/migrate/interface.go deleted file mode 100644 index a1a4d5b..0000000 --- a/pkg/client/informers/externalversions/migrate/interface.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package migrate - -import ( - internalinterfaces "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/migrate/v1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1 provides access to shared informers for resources in V1. - V1() v1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1 returns a new v1.Interface. -func (g *group) V1() v1.Interface { - return v1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/migrate/v1/foo.go b/pkg/client/informers/externalversions/migrate/v1/foo.go deleted file mode 100644 index f84dffb..0000000 --- a/pkg/client/informers/externalversions/migrate/v1/foo.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - time "time" - - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - versioned "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" - internalinterfaces "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/yangyongzhi/sym-operator/pkg/client/listers/migrate/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// FooInformer provides access to a shared informer and lister for -// Foos. -type FooInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.FooLister -} - -type fooInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewFooInformer constructs a new informer for Foo type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFooInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredFooInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredFooInformer constructs a new informer for Foo type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredFooInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MigrateV1().Foos(namespace).List(options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MigrateV1().Foos(namespace).Watch(options) - }, - }, - &migratev1.Foo{}, - resyncPeriod, - indexers, - ) -} - -func (f *fooInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredFooInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *fooInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&migratev1.Foo{}, f.defaultInformer) -} - -func (f *fooInformer) Lister() v1.FooLister { - return v1.NewFooLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/migrate/v1/interface.go b/pkg/client/informers/externalversions/migrate/v1/interface.go deleted file mode 100644 index b60f29e..0000000 --- a/pkg/client/informers/externalversions/migrate/v1/interface.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - internalinterfaces "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Foos returns a FooInformer. - Foos() FooInformer - // Migrates returns a MigrateInformer. - Migrates() MigrateInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Foos returns a FooInformer. -func (v *version) Foos() FooInformer { - return &fooInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - -// Migrates returns a MigrateInformer. -func (v *version) Migrates() MigrateInformer { - return &migrateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/migrate/v1/migrate.go b/pkg/client/informers/externalversions/migrate/v1/migrate.go deleted file mode 100644 index 2b5ac54..0000000 --- a/pkg/client/informers/externalversions/migrate/v1/migrate.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - time "time" - - migratev1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - versioned "github.com/yangyongzhi/sym-operator/pkg/client/clientset/versioned" - internalinterfaces "github.com/yangyongzhi/sym-operator/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/yangyongzhi/sym-operator/pkg/client/listers/migrate/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// MigrateInformer provides access to a shared informer and lister for -// Migrates. -type MigrateInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.MigrateLister -} - -type migrateInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewMigrateInformer constructs a new informer for Migrate type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewMigrateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMigrateInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredMigrateInformer constructs a new informer for Migrate type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredMigrateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MigrateV1().Migrates(namespace).List(options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MigrateV1().Migrates(namespace).Watch(options) - }, - }, - &migratev1.Migrate{}, - resyncPeriod, - indexers, - ) -} - -func (f *migrateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMigrateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *migrateInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&migratev1.Migrate{}, f.defaultInformer) -} - -func (f *migrateInformer) Lister() v1.MigrateLister { - return v1.NewMigrateLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/migrate/v1/expansion_generated.go b/pkg/client/listers/migrate/v1/expansion_generated.go deleted file mode 100644 index 9c4d4be..0000000 --- a/pkg/client/listers/migrate/v1/expansion_generated.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -// FooListerExpansion allows custom methods to be added to -// FooLister. -type FooListerExpansion interface{} - -// FooNamespaceListerExpansion allows custom methods to be added to -// FooNamespaceLister. -type FooNamespaceListerExpansion interface{} - -// MigrateListerExpansion allows custom methods to be added to -// MigrateLister. -type MigrateListerExpansion interface{} - -// MigrateNamespaceListerExpansion allows custom methods to be added to -// MigrateNamespaceLister. -type MigrateNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/migrate/v1/foo.go b/pkg/client/listers/migrate/v1/foo.go deleted file mode 100644 index c9dc393..0000000 --- a/pkg/client/listers/migrate/v1/foo.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// FooLister helps list Foos. -type FooLister interface { - // List lists all Foos in the indexer. - List(selector labels.Selector) (ret []*v1.Foo, err error) - // Foos returns an object that can list and get Foos. - Foos(namespace string) FooNamespaceLister - FooListerExpansion -} - -// fooLister implements the FooLister interface. -type fooLister struct { - indexer cache.Indexer -} - -// NewFooLister returns a new FooLister. -func NewFooLister(indexer cache.Indexer) FooLister { - return &fooLister{indexer: indexer} -} - -// List lists all Foos in the indexer. -func (s *fooLister) List(selector labels.Selector) (ret []*v1.Foo, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Foo)) - }) - return ret, err -} - -// Foos returns an object that can list and get Foos. -func (s *fooLister) Foos(namespace string) FooNamespaceLister { - return fooNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// FooNamespaceLister helps list and get Foos. -type FooNamespaceLister interface { - // List lists all Foos in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1.Foo, err error) - // Get retrieves the Foo from the indexer for a given namespace and name. - Get(name string) (*v1.Foo, error) - FooNamespaceListerExpansion -} - -// fooNamespaceLister implements the FooNamespaceLister -// interface. -type fooNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Foos in the indexer for a given namespace. -func (s fooNamespaceLister) List(selector labels.Selector) (ret []*v1.Foo, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Foo)) - }) - return ret, err -} - -// Get retrieves the Foo from the indexer for a given namespace and name. -func (s fooNamespaceLister) Get(name string) (*v1.Foo, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("foo"), name) - } - return obj.(*v1.Foo), nil -} diff --git a/pkg/client/listers/migrate/v1/migrate.go b/pkg/client/listers/migrate/v1/migrate.go deleted file mode 100644 index 29f1820..0000000 --- a/pkg/client/listers/migrate/v1/migrate.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright The Symphony Authors. - -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/yangyongzhi/sym-operator/pkg/apis/migrate/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// MigrateLister helps list Migrates. -type MigrateLister interface { - // List lists all Migrates in the indexer. - List(selector labels.Selector) (ret []*v1.Migrate, err error) - // Migrates returns an object that can list and get Migrates. - Migrates(namespace string) MigrateNamespaceLister - MigrateListerExpansion -} - -// migrateLister implements the MigrateLister interface. -type migrateLister struct { - indexer cache.Indexer -} - -// NewMigrateLister returns a new MigrateLister. -func NewMigrateLister(indexer cache.Indexer) MigrateLister { - return &migrateLister{indexer: indexer} -} - -// List lists all Migrates in the indexer. -func (s *migrateLister) List(selector labels.Selector) (ret []*v1.Migrate, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Migrate)) - }) - return ret, err -} - -// Migrates returns an object that can list and get Migrates. -func (s *migrateLister) Migrates(namespace string) MigrateNamespaceLister { - return migrateNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// MigrateNamespaceLister helps list and get Migrates. -type MigrateNamespaceLister interface { - // List lists all Migrates in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1.Migrate, err error) - // Get retrieves the Migrate from the indexer for a given namespace and name. - Get(name string) (*v1.Migrate, error) - MigrateNamespaceListerExpansion -} - -// migrateNamespaceLister implements the MigrateNamespaceLister -// interface. -type migrateNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Migrates in the indexer for a given namespace. -func (s migrateNamespaceLister) List(selector labels.Selector) (ret []*v1.Migrate, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.Migrate)) - }) - return ret, err -} - -// Get retrieves the Migrate from the indexer for a given namespace and name. -func (s migrateNamespaceLister) Get(name string) (*v1.Migrate, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("migrate"), name) - } - return obj.(*v1.Migrate), nil -}