Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Migrate code structure to kubebuilder v1.0.x #208

Closed
shashidharatd opened this issue Aug 15, 2018 · 6 comments
Closed

Migrate code structure to kubebuilder v1.0.x #208

shashidharatd opened this issue Aug 15, 2018 · 6 comments

Comments

@shashidharatd
Copy link
Contributor

  • kubebuilder 1.0.0 introduces big architectural change in the project/code structure. 1.0.0 projects uses client and controller libraries developed under controller-runtime repo. It uses tools from controller-tools repo for scaffolding and manifests (CRD/RBAC) generation.
  • 1.0.0 will continue to support projects generated using older version (pre 1.0.0 version) of Kubebuilder, but we would highly recommend migrating to newer version. Follow instructions for migration your project to 1.0.0 version.

I know this is not a urgent issue for us as of now. just adding it to backlog.
/cc @marun @gyliu513 @kubernetes-sigs/federation-wg

@gyliu513
Copy link
Contributor

Thanks @shashidharatd .

There is a WIP PR here #148 , hope we can get more comments from @marun to see when we can do the migration.

@gyliu513
Copy link
Contributor

gyliu513 commented Sep 6, 2018

Perhaps we can upgrade to kubebuilder to 1.0.3, as 1.0.3 release ships with k8s 1.11 binaries and controller-runtime/tools have also moved to k8s 1.11.

kubernetes-sigs/kubebuilder#339 (comment)

@marun @pmorie comments for this?

@marun
Copy link
Contributor

marun commented Sep 6, 2018

@gyliu513 Upgrading the binaries is fine. Migrating to the new client-less framework should wait until after #60, which I'll be tackling after #216 is complete.

@gyliu513
Copy link
Contributor

gyliu513 commented Sep 7, 2018

@marun yes, I only created PR #250 to update binaries based on your comments.

@marun
Copy link
Contributor

marun commented Jan 2, 2019

I think the next steps for this issue are:

  • Replacing all calls to the generated clients with equivalent calls to the controller-runtime generic client
  • Removing the generated clients (and the +genclient annotation on the types to prevent regeneration)

Here is an example of a call to a generated client:

fedClient := fedclientset.NewForConfigOrDie(kubeConfig).
typeConfig, err := fedClient.CoreV1alpha1().FederatedTypeConfigs(namespace).Get(name, metav1.GetOptions{})

Here is an equivalent call with the generic client:

// Assumes import of: 
//    - "context"
//    - "sigs.k8s.io/controller-runtime/pkg/client"

genericClient, err := client.New(kubeConfig, client.Options{})
if err != nil {
...
}
typeConfig := &fedv1a1.FederatedTypeConfig{}
key := client.ObjectKey{Name: name, Namespace: namespace}
err := genericClient.Get(context.Background(), key, typeConfig)

k8s-ci-robot pushed a commit to kubernetes-sigs/cluster-api-provider-openstack that referenced this issue Jan 4, 2019
* Basic implementation of creating networks

Added ports for subnets to router

Implemented cluster update

Replaced glog by klog

Changed usage of NetworService

Now Reconcile creates an instance of NetworkService on each run. So in
theory it will be possible to configure OS-Credentials per cluster.

Added router to ClusterStatus

Changed to only one Router

Resynced Gopkg.lock

Improved logs

Reconciling of networks now log the default log level

Added Docs to ClusterStatus.Network

Recreated zz_generated with new types

* Migrated to params of PR 136

* removed unneeded line

* Updated Network to only hold a single subnet

At the current point in time, we don't need multiple subnets, and we are
not even able to configure them.

Beside this, I refactored the reconciling code to return network, subnet
and router instead of manipulating pointer data.

* Removed unneeded clusterclient in favor of runtime.Client

See also
kubernetes-retired/kubefed#208 (comment)

We don't need the clientset_generated any more.

* Fixed typos, re-ordered fields
flaper87 pushed a commit to flaper87/cluster-api-provider-openstack that referenced this issue Jan 9, 2019
* Basic implementation of creating networks

Added ports for subnets to router

Implemented cluster update

Replaced glog by klog

Changed usage of NetworService

Now Reconcile creates an instance of NetworkService on each run. So in
theory it will be possible to configure OS-Credentials per cluster.

Added router to ClusterStatus

Changed to only one Router

Resynced Gopkg.lock

Improved logs

Reconciling of networks now log the default log level

Added Docs to ClusterStatus.Network

Recreated zz_generated with new types

* Migrated to params of PR 136

* removed unneeded line

* Updated Network to only hold a single subnet

At the current point in time, we don't need multiple subnets, and we are
not even able to configure them.

Beside this, I refactored the reconciling code to return network, subnet
and router instead of manipulating pointer data.

* Removed unneeded clusterclient in favor of runtime.Client

See also
kubernetes-retired/kubefed#208 (comment)

We don't need the clientset_generated any more.

* Fixed typos, re-ordered fields
@shashidharatd
Copy link
Contributor Author

This is addressed with #716

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants