Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade coredns to kubebuilder 2 #24

Closed
johnsonj opened this issue Jul 9, 2019 · 7 comments · Fixed by #50
Closed

Upgrade coredns to kubebuilder 2 #24

johnsonj opened this issue Jul 9, 2019 · 7 comments · Fixed by #50
Assignees
Labels
lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor.

Comments

@johnsonj
Copy link
Contributor

johnsonj commented Jul 9, 2019

Kubebuilder 2.0 is approaching and results in significant change in directory structure.

We should migrate the coredns operator to this (either re-create and retain the custom bits or manually diff?) once 2.0 is released.

Here's an example PR

@dholbach
Copy link
Member

dholbach commented Sep 18, 2019

Now that kubernetes-sigs/kubebuilder#943 is landed, I built it from master (no new release yet - kubernetes-sigs/kubebuilder#1001) using

GO111MODULE=on make build

(because tests failed for some reason).

After that I created a new directory and ran:

kubebuilder init --fetch-deps=false --domain=k8s.io --license=apache2
KUBEBUILDER_ENABLE_PLUGINS=1 kubebuilder create api --pattern addon --controller=true --example=false --group=addons --kind=CoreDNS --make=false --namespaced=true --resource=true --version=v1alpha1

Then I followed the instructions in the ./coredns/README.md. Some look like they need updating.

The resulting diffstat looks like this:

 .gitignore                                           |    1 
 Dockerfile                                           |   25 --
 Makefile                                             |   63 +++---
 PROJECT                                              |    8 
 README.md                                            |   82 ++++++++
 api/v1alpha1/coredns_types.go                        |   59 ------
 api/v1alpha1/groupversion_info.go                    |   35 ---
 channels/packages/coredns/0.0.1/manifest.yaml        |    1 
 cmd/manager/main.go                                  |   88 +++++++++
 config/certmanager/certificate.yaml                  |   24 --
 config/certmanager/kustomization.yaml                |    5 
 config/certmanager/kustomizeconfig.yaml              |   16 -
 config/crd/kustomization.yaml                        |   21 --
 config/crd/kustomizeconfig.yaml                      |   17 -
 config/crd/patches/cainjection_in_coredns.yaml       |    8 
 config/crd/patches/webhook_in_coredns.yaml           |   17 -
 config/crds/addons_v1alpha1_coredns.yaml             |   61 ++++++
 config/default/kustomization.yaml                    |   71 ++-----
 config/default/manager_auth_proxy_patch.yaml         |    3 
 config/default/manager_image_patch.yaml              |   12 +
 config/default/manager_prometheus_metrics_patch.yaml |    2 
 config/default/manager_webhook_patch.yaml            |   23 --
 config/default/webhookcainjection_patch.yaml         |   15 -
 config/manager/kustomization.yaml                    |    2 
 config/manager/manager.yaml                          |   52 +++++
 config/rbac/auth_proxy_service.yaml                  |    2 
 config/rbac/kustomization.yaml                       |   11 -
 config/rbac/leader_election_role.yaml                |   32 ---
 config/rbac/leader_election_role_binding.yaml        |   12 -
 config/rbac/manager_role.yaml                        |  116 ++++++++++++
 config/rbac/manager_role_binding.yaml                |   12 +
 config/rbac/role_binding.yaml                        |   12 -
 config/samples/addons_v1alpha1_coredns.yaml          |   14 +
 config/webhook/kustomization.yaml                    |    6 
 config/webhook/kustomizeconfig.yaml                  |   25 --
 config/webhook/service.yaml                          |   12 -
 controllers/coredns_controller.go                    |   50 -----
 k8s/manager.yaml                                     |  178 +++++++++++++++++++
 main.go                                              |   78 --------
 pkg/apis/addons/group.go                             |   17 +
 pkg/apis/addons/v1alpha1/coredns_types.go            |   81 ++++++++
 pkg/apis/addons/v1alpha1/doc.go                      |   22 ++
 pkg/apis/addons/v1alpha1/register.go                 |   45 ++++
 pkg/apis/addons/v1alpha1/zz_generated.deepcopy.go    |  119 ++++++++++++
 pkg/apis/addtoscheme_addons_v1alpha1.go              |   25 ++
 pkg/apis/apis.go                                     |   32 +++
 pkg/controller/add_coredns.go                        |   25 ++
 pkg/controller/controller.go                         |   33 +++
 pkg/controller/coredns/coredns_controller.go         |  142 +++++++++++++++
 pkg/webhook/webhook.go                               |   36 +++
 tools.go                                             |    9 
 51 files changed, 1255 insertions(+), 602 deletions(-)

I'm spelling all of this out, so we can document it in #11 and as part of this issue.

@dholbach
Copy link
Member

@johnsonj recommended I pull kubernetes-sigs/kubebuilder#1059 and try again. The outcome is fairly similar:

 .gitignore                                           |    1 
 Dockerfile                                           |   27 -
 Makefile                                             |   63 ++--
 PROJECT                                              |    8 
 README.md                                            |   82 +++++
 api/v1alpha1/coredns_types.go                        |   74 ----
 api/v1alpha1/groupversion_info.go                    |   35 --
 channels/packages/coredns/0.0.1/manifest.yaml        |    1 
 cmd/manager/main.go                                  |   88 +++++
 config/certmanager/certificate.yaml                  |   24 -
 config/certmanager/kustomization.yaml                |    5 
 config/certmanager/kustomizeconfig.yaml              |   16 -
 config/crd/kustomization.yaml                        |   21 -
 config/crd/kustomizeconfig.yaml                      |   17 -
 config/crd/patches/cainjection_in_coredns.yaml       |    8 
 config/crd/patches/webhook_in_coredns.yaml           |   17 -
 config/crds/addons_v1alpha1_coredns.yaml             |   61 ++++
 config/default/kustomization.yaml                    |   71 +---
 config/default/manager_auth_proxy_patch.yaml         |    5 
 config/default/manager_image_patch.yaml              |   12 
 config/default/manager_prometheus_metrics_patch.yaml |    2 
 config/default/manager_webhook_patch.yaml            |   23 -
 config/default/webhookcainjection_patch.yaml         |   15 -
 config/manager/kustomization.yaml                    |    2 
 config/manager/manager.yaml                          |   52 +++
 config/rbac/auth_proxy_service.yaml                  |    2 
 config/rbac/kustomization.yaml                       |   11 
 config/rbac/leader_election_role.yaml                |   32 --
 config/rbac/leader_election_role_binding.yaml        |   12 
 config/rbac/manager_role.yaml                        |  116 +++++++
 config/rbac/manager_role_binding.yaml                |   12 
 config/rbac/role_binding.yaml                        |   12 
 config/samples/addons_v1alpha1_coredns.yaml          |   14 
 config/webhook/kustomization.yaml                    |    6 
 config/webhook/kustomizeconfig.yaml                  |   25 -
 config/webhook/service.yaml                          |   12 
 controllers/coredns_controller.go                    |   73 ----
 go.mod                                               |   98 ++++++
 go.sum                                               |  283 +++++++++++++++++++
 k8s/manager.yaml                                     |  178 +++++++++++
 main.go                                              |   80 -----
 pkg/apis/addons/group.go                             |   17 +
 pkg/apis/addons/v1alpha1/coredns_types.go            |   81 +++++
 pkg/apis/addons/v1alpha1/doc.go                      |   22 +
 pkg/apis/addons/v1alpha1/register.go                 |   45 +++
 pkg/apis/addons/v1alpha1/zz_generated.deepcopy.go    |  119 +++++++
 pkg/apis/addtoscheme_addons_v1alpha1.go              |   25 +
 pkg/apis/apis.go                                     |   32 ++
 pkg/controller/add_coredns.go                        |   25 +
 pkg/controller/controller.go                         |   33 ++
 pkg/controller/coredns/coredns_controller.go         |  142 +++++++++
 pkg/webhook/webhook.go                               |   36 ++
 tools.go                                             |    9 

The full diff can be seen here: https://gist.github.com/dholbach/d55b93f8055ca6eb8df5e7895bb5e94c

@rajansandeep
Copy link
Contributor

/assign

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 10, 2020
@rajansandeep
Copy link
Contributor

/remove-lifecycle stale
/lifecycle active

@k8s-ci-robot k8s-ci-robot added lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 10, 2020
@vnzongzna
Copy link

@rajansandeep are you working on it?

@rajansandeep
Copy link
Contributor

@vaibhavk, I am working on this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants