Skip to content

Update sdk 1.x #186

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

Closed
wants to merge 3 commits into from
Closed

Update sdk 1.x #186

wants to merge 3 commits into from

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Oct 27, 2020

What does this PR do?

Update to Operator SDK 1.1.

This process requires bootstrapping a new project using kubebuilder and porting files over to the new structure. See this repo for a more detailed commit history (though it's still a bit messy and hard to read). I generally tried to avoid making unnecessary changes, to make the transition easier, so the configmap is still used, webhooks are done as they are currently, etc.

Main directory structure changes:

  • deploy/ => config/

    • The deployment yaml files are now defined using kustomize.
    • The "main" deployment is built from config/default
    • development deployments are generated from config/devel/
    • CRDs are stored in config/crds/
    • Pieces of the deployment are defined in config/components/ and combined
    • Plugin registry is defined in config/registry
    • RBAC files for the controller are generated from annotations on *_controller.go files
  • pkg/apis/ => apis/

    • subdirectores in apis/ are named after the resource's group (controller in our case)
  • pkg/controller/ => controllers

    • subdirectories in controllers are named for the group of the CR they control (controller for Components, WorkspaceRoutings; workspace for DevWorkspaces)
    • the controllers/controller subdirectory is further divided to distinguish between the controller for Components and WorkspaceRoutings.
  • pkg now contains mostly helper code from pkg in the current repo

Other notable differences

  • No longer have a hard dependency on operator-sdk code.
  • Makefile had to be reworked significantly; there might be gaps in functionality.
  • Setting up controllers is done differently now which makes some things harder (watching a configmap)
  • To simplify importing CRDs for devfile/api, I reworked the script to grab the files. It now downloads to a temp dir and copies definitions to the expected directory (config/crds). The copied files are gitignored.

Further TODOs

  • Remove the configmap-related code from the controller and use environment variables instead, or figure out proper way to configure an operator.
  • Depends on changes to devfile/api, reflected by changes here. This is set in go.mod as a replace.
  • I didn't look into adapting e2e tests.

What issues does this PR fix or reference?

Resolves #180

We'll likely need to do additional fixes to finalize this work

Is it tested? How?

Tested on minikube; still need to test WTO and crc use cases

Update dependencies and run go mod tidy
Re-bootstrap project to reflect kubebuilder project structure and port
over existing files as required. Notable changes:

* Directory structure is changed (deploy becomes config, controllers go
in controllers/, etc.)
* Kustomize is used to generate deploy files
* Some auto-generated files are done differently (e.g. rbac is generated from
annotations)

Signed-off-by: Angel Misevski <[email protected]>
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Angel Misevski <[email protected]>
@amisevsk
Copy link
Collaborator Author

Closing in favor or #187, since that branch is pushed to this repo instead of my fork.

@amisevsk amisevsk closed this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the DevWorkspace Controller to Operator SDK 1.0
2 participants