Support hybrid operators · Issue #670 · operator-framework/operator-sdk · GitHub
Skip to content

Support hybrid operators #670

Closed
Closed

Description

@hasbro17

EDIT(@estroz): this issue originally addressed a bug where users could create apis, controllers, and k8s deepcopy code in non-Go projects. Since significant discussion related to hybrid operators is present here, I changed the title and am keeping this issue open to further track hybrid operator discussion. #672 fixed the original bug.


Original issue text:

The following SDK commands are only relevant to a Go type project and should not run in another project type like Ansible(or Helm in the future).

  • operator-sdk add api ...
  • operator-sdk add controller ...
  • operator-sdk generate k8s

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug.
    on Oct 30, 2018
  2. self-assigned this
    on Oct 30, 2018
  3. hasbro17 commented on Oct 30, 2018

    @hasbro17
    ContributorAuthor

    We need to consider the use case of transitioning from a pure Ansible type project to a hybrid or Go type project before we restrict these commands from running in an ansible type project.

  4. shawn-hurley commented on Oct 31, 2018

    @shawn-hurley
    Member

    I was thinking that the steps for transition are:

    1. In Go path.
    2. drop cmd/manager/main.go on disk (this will need to be the correct main.go though maybe there is enough overlap between helm and ansible here that we can make this really easy and only 1 file?).
    3. add/change dockerfile to incorporate the binary
    4. dependencies for golang.

    All of these are steps I could document today and we would have a transition path, before or after operator-sdk add api is called. Maybe it makes sense that we have to do these steps before you can call these? I am torn here because I could see myself creating the API and then doing the main file bits etc..., but on another hand sometimes taking away options just leads to fewer bugs.

    I think either way the above commands must be in the gopath is that correct?

  5. joelanford commented on Oct 31, 2018

    @joelanford
    Member
    1. drop cmd/manager/main.go on disk (this will need to be the correct main.go though maybe there is enough overlap between helm and ansible here that we can make this really easy and only 1 file?).

    @shawn-hurley I think the only differences would be loading the watches.yaml file and calling Add() with the correct controller. If those aren't the only differences, I would think we could get there.

    Also, do we need to consider transitions between or hybrid combinations of arbitrary types (e.g. Ansible to Helm, or hybrid Ansible/Helm)?

    I think this discussion raises the question of what the strategy for the CLI design should be. The current design holds up well when there's only one operator type, but now that we'll have three, each adding new subcommands and/or implementing existing subcommands differently, some issues arise:

    • As a user, how do I know which subcommands make sense for my project?
    • If we support hybrid operators, what should the SDK do when more than one of the operator types is present in the project and a subcommand is executed that has different implementations for different operator types? Maybe we detect that multiple types exist and fail telling the user that --type is required for hybrid operators?

    Is it possible to invert the precedence of operator type and subcommand in the CLI so that the operator type drives what subcommands are available and makes the subcommand execution explicit?

  6. estroz commented on Nov 1, 2018

    @estroz
    Contributor

    A combination of good transition/hybrid documentation and strict checks/plenty of warnings on CLI usage should be enough.

    Instead of thinking of all the ways a user can combine operator types, we should be opinionated about how they should be combined, and to what extent combination is allowable, if at all. For example, what parts of an Ansible project can be customized with Go, and what cannot?

    If we want to allow hybrid projects, we need to reconsider how OperatorType is used since type checks are currently exclusive. I suggest we implement a bitfield.

  7. changed the title [-]SDK commands for Go operators should only run in Go type projects[/-] [+]Support hybrid operators[/+] on Nov 7, 2018
  8. added
    kind/featureCategorizes issue or PR as related to a new feature.
    and removed
    kind/bugCategorizes issue or PR as related to a bug.
    on Nov 7, 2018
  9. hasbro17 commented on Jan 18, 2019

    @hasbro17
    ContributorAuthor

    ref: #860
    With #887 and #897 the operator-sdk now has a migrate command to transition Helm and Ansible operator projects to hybrid projects.

    @joelanford and @mhrivnak I don't think we have docs or extra sections in the ansible and helm user-guides showing an example of migrating to a hybrid project. We have the CLI reference but I think an example would be beneficial.

    Is there anything else that we would need with regards to hybrid operators before we close out this issue? We can follow up on the docs in separate issues.

  10. mhrivnak commented on Jan 18, 2019

    @mhrivnak
    Member

    On the ansible side (haven't looked closely at the helm side, but might be similar) we have a working migrate command that might be useful. But we have not put any thought yet into specifically how we'll enable users to add their own logic. We don't have a good story yet for: "ok, I have a main.go file. What now?"

    What we do have lays the groundwork for improving the experience, and it was important to do in concert with the other refactoring around where and how we're building the ansible/helm operator binary and base image. But it might not yet be useful enough to make noise about, which is why I haven't rushed to write docs about it.

    The next step would be to spend a little time designing what we want to expose in main.go that would be useful to a user who wants to add some go code to their ansible or helm operator. How that relates to this github issue depends on how you prefer to track it. I'm happy if you want to close this as done and follow up with a separate design effort, o if yo'd rather keep this open until it's fully baked.

  11. hasbro17 commented on Jan 19, 2019

    @hasbro17
    ContributorAuthor

    Agreed. We should spend some time on the overall user story around hybrid operators.
    I'll keep this issue open until we have something more concrete on that front.

  12. 9 remaining items

  13. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Sep 19, 2019
  14. openshift-bot commented on Oct 19, 2019

    @openshift-bot

    Stale issues rot after 30d of inactivity.

    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Rotten issues close after an additional 30d of inactivity.
    Exclude this issue from closing by commenting /lifecycle frozen.

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

    /lifecycle rotten
    /remove-lifecycle stale

  15. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Oct 19, 2019
  16. hasbro17 commented on Oct 20, 2019

    @hasbro17
    ContributorAuthor

    /lifecycle frozen

  17. added
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    and removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on Oct 20, 2019
  18. removed their assignment
    on Jan 29, 2020
  19. added this to the v1.0.0 milestone on Mar 2, 2020
  20. huizengaJoe commented on Mar 19, 2020

    @huizengaJoe

    @devnulled your comment
    #670 (comment)
    really resonates, I know its an old post but wondering if you had pursued your hybrid approach and might have some more insight

  21. devnulled commented on Apr 28, 2020

    @devnulled

    @huizengaJoe I'm no longer working at the company where I was working on that solution, and it's been some time since I was there. Something I will likely end-up digging back into within the next year or so, I think.

  22. modified the milestones: v1.0.0, Backlog on Jul 15, 2020
  23. varshaprasad96 commented on Jul 31, 2023

    @varshaprasad96
    Member

    Hybrid operators are being supported currently with SDK. The current hybrid model involves both Go and Helm APIs to be scaffolded together: https://github.com/operator-framework/helm-operator-plugins/tree/main. Closing this issue for now. If there is any follow up needed, we can pick it up later.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    designkind/featureCategorizes issue or PR as related to a new feature.language/ansibleIssue is related to an Ansible operator projectlanguage/helmIssue is related to a Helm operator projectlifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.needs discussion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions