kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

Writing controllers without generating api

Open swiftslee opened this issue 3 years ago • 9 comments

What do you want to happen?

Sometimes the users don't need to create an API for themselves(e.g. implementing a loadbalancer svc provider only needs to watch kubernetes native service), how to do that? Any suggestions would be appreciated!

Extra Labels

No response

swiftslee avatar Oct 26 '21 07:10 swiftslee

Then. that means that you will reconcile a core type. That is supported already. You ought to run such as :

    $kb create api --group apps --version v1 --kind Deployment --controller=true --resource=false 

Note that all that is scaffolded by the tool is tracked in the PROJECT file. Why? The tool uses the data to provide helpers and we wish to have more plugins and helpers in the future.

However, we need to document in the KB docs:

  • How to work with core types? ( That is your case )
  • Also, how to work with external types which also is possible when we want to reconcile a resource that is not owned by the project. E.g reconcile the CRD created in Operator B in Operator A.

See that we have:

  • https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/using_an_external_type.md (which probably is outdated and needs to be added to the book docs)
  • https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/src/reference/project-config.md which describe the project config and is added to the book docs. See:
Screenshot 2021-10-27 at 10 20 23

We need a doc which describes the above command + links the KB code with all core types mapped. See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/options.go#L28-L51

Would you like to help with that? PS. I am changing this one for docs.

camilamacedo86 avatar Oct 27 '21 09:10 camilamacedo86

Then. that means that you will reconcile a core type. That is supported already. You ought to run such as :

    $kb create api --group apps --version v1 --kind Deployment --controller=true --resource=false 

Note that all that is scaffolded by the tool is tracked in the PROJECT file. Why? The tool uses the data to provide helpers and we wish to have more plugins and helpers in the future.

However, we need to document in the KB docs:

  • How to work with core types? ( That is your case )
  • Also, how to work with external types which also is possible when we want to reconcile a resource that is not owned by the project. E.g reconcile the CRD created in Operator B in Operator A.

See that we have:

  • https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/using_an_external_type.md (which probably is outdated and needs to be added to the book docs)
  • https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/src/reference/project-config.md which describe the project config and is added to the book docs. See:
Screenshot 2021-10-27 at 10 20 23

We need a doc which describes the above command + links the KB code with all core types mapped. See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/options.go#L28-L51

Would you like to help with that? PS. I am changing this one for docs.

Thanks for your so clear answer! I'm going to help with that this weekend. /assign

swiftslee avatar Oct 28 '21 02:10 swiftslee

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 26 '22 03:01 k8s-triage-robot

/remove-lifecycle stale

swiftslee avatar Jan 26 '22 03:01 swiftslee

Hi @swiftslee,

Have you any position about this one? Are you working on this one? If not that is OK. However, could you please remove the assignment for another person to be able to contribute?

camilamacedo86 avatar Mar 14 '22 13:03 camilamacedo86

Hi @camilamacedo86 @swiftslee, is this issue open can I work on this? :slightly_smiling_face:

Nivedita-coder avatar Mar 16 '22 08:03 Nivedita-coder

Hi, I found this issue interesting. @swiftslee @Nivedita-coder could I work along with you on this PR?

AshwinRamachandran2002 avatar Mar 16 '22 12:03 AshwinRamachandran2002

Hi @swiftslee,

Have you any position about this one? Are you working on this one? If not that is OK. However, could you please remove the assignment for another person to be able to contribute?

Sorry for the miss.
I don't have much time recently. Let's assign it to @AshwinRamachandran2002. /unassign /assign @AshwinRamachandran2002

swiftslee avatar Mar 24 '22 08:03 swiftslee

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 22 '22 09:06 k8s-triage-robot

Hey @AshwinRamachandran2002 are you working on this ?

Sajiyah-Salat avatar Feb 25 '23 03:02 Sajiyah-Salat

I would like to work on this /assign

ashutosh887 avatar Mar 16 '23 16:03 ashutosh887

hello, @camilamacedo86 I have understood the issue. If this issue is still valid I would like to work on this.

Sajiyah-Salat avatar Apr 29 '23 02:04 Sajiyah-Salat

I worked on this a bit but a bit confused @camilamacedo86

Do you mean we need to extend the content in resources.path and update the mentioned here part with another link/url.

Could you help me @Sajiyah-Salat by elaborating a bit?

ashutosh887 avatar Apr 29 '23 03:04 ashutosh887

This one is about document the explanation give in https://github.com/kubernetes-sigs/kubebuilder/issues/2398#issuecomment-952709317

See that we have the issue and a PR that we need to finish which cover it already, see: https://github.com/kubernetes-sigs/kubebuilder/issues/3210

Also, please feel free to contribute for we finish the open pr (address the comments so we can get that merged) And if you see any other point where we are missing to doc please feel free to open prs to provide suggestions for we improve the documentation.

In this way, I am closing this one in favor of https://github.com/kubernetes-sigs/kubebuilder/issues/3210

camilamacedo86 avatar Apr 29 '23 18:04 camilamacedo86