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

Directory structure #25

Closed
barry8schneider opened this issue Apr 30, 2018 · 4 comments
Closed

Directory structure #25

barry8schneider opened this issue Apr 30, 2018 · 4 comments

Comments

@barry8schneider
Copy link
Contributor

I am just trying to understand the directory structure for this project. Especially the .go files under https://github.com/cloud-ark/kubeplus/tree/master/postgres-crd-v2

@devdattakulkarni
Copy link
Contributor

main.go -> Starting point
controller.go -> Controller code for Postgres CRD
user.go -> Functions for performing User related actions on a Postgres instance
database.go -> Functions for performing Database related actions on a Postgres instance
utils.go -> Utility functions

./postgres-crd-v2/pkg/apis/postgrescontroller/v1/types.go -> Definition of Postgres CRD spec

@barry8schneider
Copy link
Contributor Author

The structure on the kubernetes sample controller issue 14 has the Controller's logic in another location. I am not sure where these files should live but in the root does not feel right. What do you think?

Create the Controller's logic
Now that all the required code has been generated we've got ourselves some nice options to perform some routine tasks:

./pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/samplecontroller_client.go which will act as our goto-structure to access any api-endpoint related to the CustomResource we created.

./pkg/client/clientset/versioned/typed/samplecontroller/v1alpha1/foo.go which will add the .Foo("") which in turn supplies an interface to operations like:

  • List
  • Get
  • Watch

@devdattakulkarni
Copy link
Contributor

Good point.

Makes sense to move the go files in some sub-directory -- one option is to move them in the folder where types.go is defined.

In your setup, may be you can try it and see if that change would work or not. If it does then we can make the change here. You will probably need to change import statements in some of the files.

@devdattakulkarni devdattakulkarni added the enhancement New feature or request label Aug 3, 2018
@devdattakulkarni devdattakulkarni added refactoring and removed enhancement New feature or request labels Nov 20, 2018
@devdattakulkarni
Copy link
Contributor

Rather than refactoring postgres-crd-v2, we can consider these points in any new Operator/custom controller that we will create.

Steps to create new custom controller are included in:
https://github.com/cloud-ark/kubeplus/blob/master/docs/setup/creating-operator.txt

One of the things that can be considered as part of this process is location of the source code files.

So closing this issue.

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

No branches or pull requests

2 participants