Skip to content

Latest commit

 

History

History
77 lines (73 loc) · 3.21 KB

olm-operator-plugins.md

File metadata and controls

77 lines (73 loc) · 3.21 KB

OLM operator plugins development

Existing plugins

How to implement a new OLM operator plugin

To implement support for a new OLM operator plugin you need to make following changes:

  1. Introduce new validation IDs for the new operator in the swagger specification:
    • for host validation:
      host-validation-id:
        type: string
        enum:
          - 'connected'
          ...
          - 'lso-requirements-satisfied'
          - 'cnv-requirements-satisfied'
          - 'odf-requirements-satisfied'
          - 'lvm-requirements-satisfied'
    • for cluster validation:
      cluster-validation-id:
        type: string
        enum:
          - 'machine-cidr-defined'
          ...
          - 'lso-requirements-satisfied'
          - 'cnv-requirements-satisfied'
          - 'odf-requirements-satisfied'
          - 'lvm-requirements-satisfied'
  2. Regenerate code by running
    skipper make generate
  3. Add the new validation IDs to proper category - "operators":
    • for cluster validation:
      func (v validationID) category() (string, error) {
      ...
        case IsCnvRequirementsSatisfied, IsLsoRequirementsSatisfied, IsOdfRequirementsSatisfied, IsLvmRequirementsSatisfied:
           return "operators", nil
    • for host validaton:
      func (v validationID) category() (string, error) {
      ...
        case AreLsoRequirementsSatisfied, AreCnvRequirementsSatisfied, AreOdfRequirementsSatisfied, AreLvmRequirementsSatisfied:
      		return "operators", nil
  4. Modify the installation state machine by adding the new validationIDs to the list of required checks:
    • for cluster:
      var requiredForInstall = stateswitch.And(...,
         ..., If(IsLsoRequirementsSatisfied), If(IsCnvRequirementsSatisfied), If(IsOdfRequirementsSatisfied), If(IsLvmRequirementsSatisfied))
    • for host:
      	var isSufficientForInstall = stateswitch.And(...,
      		...,
      		If(AreLsoRequirementsSatisfied), If(AreCnvRequirementsSatisfied), If(AreOdfRequirementsSatisfied), If(AreLvmRequirementsSatisfied))
  5. Implement the Operator interface
  6. Plug the new Operator implementation in the OperatorManager constructor:
    func NewManager(log logrus.FieldLogger) Manager {
    	return NewManagerWithOperators(log, lso.NewLSOperator(), cnv.NewCnvOperator(log), odf.NewOdfOperator(log), lvm.NewLvmOperator(log))
    }
  7. Implement tests verifying new OLM operator installation and validation, i.e. in internal/bminventory/inventory_test.go
  8. Make sure all the tests are green