Skip to content

Added controller functionality

Joao Esteves Marcal requested to merge projects into master

Things to take into account whilst reviewing this MR.

Boilerplate code generated by the operator-sdk command was already merged into master to facilitate the reviewing.

I've added a custom Dockerfile (inspired on the one operator-sdk generates which is under build/Dockerfile) to be able to use the common CI.

In this MR the functionality of the operator covers:

  • Creating a project
  • Updating the project description
  • Updating the project owner (only project annotations and labels, missing updating service accounts)
  • Deleting a project

The organization of the code I'm aiming for is the following.

  • CR definition is under pkg/apis/webservices/v1alpha1/paassite_types.go
  • Main reconcile loop is in pkg/controller/paassite/paassite_controller.go this file will contain the reconcile loop and possible every function the loop will directly call to reconcile an object, currently updateOwner, updateDescription.
  • Functions related to resources like projects or namespaces are in the respective file of these resources pkg/controller/paassite/project.go, pkg/controller/paassite/namespace.go
  • Common functions to multiple resources Openshift/Kubernetes are in pkg/controller/paassite/utils.go
  • Common functions to go are in pkg/utils/array_utils.go

The objective of this organization is to try and minimize changes if something changes and ease the process of code navigation.

Problems with current version already fixed in the next version

  • Controller was not using the Status of the CR
Edited by Joao Esteves Marcal

Merge request reports