Open sagarkrsd opened 4 years ago
PROBLEM STATEMENT Can we run a metac controller without having any watch i.e., let's say as soon as openebs-upgrade is installed, we want it to be able to check if OpenEBS is already installed in the cluster or not without any CR or config triggering that?
How do we run two metac controllers parallelly which are thought to be idempotent but where the job of the first controller is to find out if OpenEBS components are installed or not and based on that
If OpenEBS components are present then label all those components which in turn get listed by the 2nd controller which uses these labels as selectors for listing the attachments.
If OpenEBS components are not present, then do nothing.
The second controller's job here is to either create the OpenEBS components if there is nothing found in its attachments as it will consider it a case where OpenEBS is not installed and if there are components listed in the attachments, it will just try to maintain the desired state.
PROBLEM STATEMENT:
In case the 2nd controller kicks in first, it will have 0 attachments even if OpenEBS components are present and it has to be adopted but since the 1st controller has not yet kicked in, those components have yet to be labeled, and when this controller gets 0 attachments, it will consider it an install case and it will go ahead and install all the OpenEBS components but ideally, OpenEBS components are already installed.
NOTE: I shall try to put my draft solution using metac configs NOTE: These configs may not be correct schema wise
# This controller will try to find openebs resources & label them
# with some pre-defined labels
#
# In addition, it will create a new resource i.e. a ConfigMap that
# has the mapping of openebs resources in form of component name
# to resource name. If any openebs resources were installed earlier,
# their names will be captured and set in this config map with
# appropriate unique keys. If there were no openebs components or
# only partial components then this controller will provide pre-defined
# name(s) for each new controller.
kind: GenericController
metadata:
name: ctrl-one
namespace: i-am-embedded
spec:
updateAny: true
watch:
apiVersion: dao.mayadata.io/v1alpha1
resource: openebses
# attachments will have all possible openebs resources
attachments:
- apiVersion: apps/v1
resource: deployments
updateStrategy:
method: InPlace
- matchReferences:
- key: metadata.namespace
- apiVersion: apps/v1
resource: daemonsets
updateStrategy:
method: InPlace
- matchReferences:
- key: metadata.namespace
- apiVersion: v1
resource: configmaps
advancedSelector:
- matchReferences:
- key: metadata.namespace
- key: metadata.name
# This controller will check if ConfigMap was created by the other
# controller & proceed further only when this configmap exists
kind: GenericController
metadata:
name: ctrl-two
namespace: i-am-embedded
spec:
updateAny: true
watch:
apiVersion: dao.mayadata.io/v1alpha1
resource: openebses
# attachments will have all possible openebs resources
attachments:
- apiVersion: apps/v1
resource: deployments
updateStrategy:
method: InPlace
advancedSelector:
- matchLabels:
openebs-upgrade.dao.mayadata.io/ndm-component-type: operator
- matchLabels:
openebs-upgrade.dao.mayadata.io/component-name: maya-apiserver
- matchLabels:
openebs-upgrade.dao.mayadata.io/component-name: openebs-provisioner
- matchReferences:
- key: metadata.namespace
- apiVersion: apps/v1
resource: daemonsets
updateStrategy:
method: InPlace
advancedSelector:
- matchLabels:
openebs-upgrade.dao.mayadata.io/ndm-component-type: daemon
- matchReferences:
- key: metadata.namespace
- apiVersion: v1
resource: configmaps
advancedSelector:
- matchReferences:
- key: metadata.namespace
- key: metadata.name
FEATURE REQUEST
This is a feature request where openebs-upgrade should be able to provide users the functionality where their existing OpenEBS configuration or components can be adopted by openebs-upgrade and going forward they can make use of it for a control-plane upgrade, configuration update, etc i.e., basically, they can manage OpenEBS using openebs-upgrade.
DESIGN DOC: https://docs.google.com/document/d/1WKE5lUMeLEikP7qzuVlY5r8fFE22KgYLRI1N8D7-DPA/edit