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

Create empty CRDs and Controllers structure #6

Merged
merged 4 commits into from
Nov 15, 2024

Conversation

amoralej
Copy link
Contributor

@amoralej amoralej commented Nov 13, 2024

This PR is creating the empty structure of crds and controllers for the watcher operator architecture:

  • watcher:

    • Does prep infra: create database, keystone service/user/endpoint, etc...
    • Calls watcherapi, watcher-decision-engine and watcher-applier as the top level CRD and controller.
  • watcherapi

    • Deployes the watcher api service as a wsgi service with httpd
  • watcher-decision-egine

    • Deployes watcher-decision-engine service
  • watcher-applier

    • Deployes watcher-applier

Related: OSPRH-11422
Related: OSPRH-11483
Related: OSPRH-11484
Related: OSPRH-11485

// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of WatcherApplier. Edit watcherapplier_types.go to remove/update
Foo string `json:"foo,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is the plan to merge this skeleton and then work on filling out each service?

or will you start iterating here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my proposal, yes. Merge the empty skeleton and then filling out each service.

// SetupWithManager sets up the controller with the Manager.
func (r *WatcherReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&watcherv1beta1.Watcher{}).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add the sub-resources (WatcherDecisionEngine, etc) here since this is the top-level controller. i.e. something like this [1].

[1] https://github.com/openstack-k8s-operators/cinder-operator/blob/main/controllers/cinder_controller.go#L337-L339

//+kubebuilder:rbac:groups=watcher.openstack.org,resources=watchers,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=watcher.openstack.org,resources=watchers/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=watcher.openstack.org,resources=watchers/finalizers,verbs=update

Copy link

@abays abays Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally you could explicitly add annotations for the sub-resources here. Technically they are not needed because they already exist in the sub-resource controllers, but it might be beneficial for human readers to see that this controller is expected to have full access to the sub-sources. Something like this [1].

[1] https://github.com/openstack-k8s-operators/cinder-operator/blob/8cd575ca0e608f4289a3ec42f29cf3dcd4c3d4ab/controllers/cinder_controller.go#L94-L105

Using openstack-sdk:

$ operator-sdk create api \
                      --group watcher \
                      --version v1beta1 \
                      --kind Watcher \
                      --resource \
                      --controller

JIRA: OSPRH-11422
For consistency with other operators and with defaults in operators-sdk.
Intended to manage de watcher-decision-engine component of watcher
service.

 Using openstack-sdk:

$ operator-sdk create api \
                      --group watcher \
                      --version v1beta1 \
                      --kind WatcherDecisionEngine \
                       --resource \
                       --controller

JIRA: OSPRH-11484
Intended to manage de watcher-applier component of watcher
service.

Using openstack-sdk:

$ operator-sdk create api \
                      --group watcher \
                      --version v1beta1 \
                      --kind WatcherApplier \
                      --resource \
                      --controller

JIRA: OSPRH-11485
Copy link

@abays abays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link

openshift-ci bot commented Nov 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abays

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

@openshift-merge-bot openshift-merge-bot bot merged commit 953b0a8 into openstack-k8s-operators:main Nov 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants