You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the controller logic to handle KeptnAppCreationRequest resources to support of automatic discovery of the application, where a multi-service/single-service application will not require a user-defined KeptnApp resource. Instead this resource will be generated automatically.
Technical Details
Implementation of Reconcile() function of KeptnAppCreationRequest controller
The controller will be the component creating/updating the KeptnApp resource according to the current state. It will fetch all workloads of the application and also takes care of waiting for the timeout to expire.
Explanationary notes:
How to know if KeptnApp is user defined:
if the KeptnApp has a .metadata.ownerReference pointing to KeptnAppCreationRequest, it is not a user defined KeptnApp
if it does not have this reference, it's user defined
How to know if KeptnApp is single-service or multi-service:
if the KeptnAppCreationRequest annotation keptn.sh/app-type has value single-service -> it's single-service app and the timeout is set to 0
if the KeptnAppCreationRequest annotation keptn.sh/app-type has value mutli-service -> it's multi-service app and the timeout is set to 30 (in the future this value will be configured from Keptn Config CRD, for now we will use a hard-coded value)
Workflow:
The controller tries to fetch the KeptnApp
if he finds it and it is user-defined (no auto-application discovery needed), it will remove the KeptnAppCreationRequest and do not reconcile itself again
if KeptnApp exists && is not user defined -> the controller checks the timeout -> if it's not expired yet -> reconcile
if KeptnApp does not exist -> the controller checks the timeout -> if it's not expired yet -> reconcile
If the timeout expired (the length of the timeout is based on the information if the app is single-service or multi-service), controller fetches all the KeptnWorkloads of the appropriate application and updates/creates the KeptnApp with the correct version (depending on if it already exists or not). The Version of the KeptnApp will be computed as a hash of workload versions, which are part of the application.
creation of KeptnApp -> controller creates new KeptnApp with all workloads of the application but without any pre- or post- deployment tasks/evaluations. Please do not forget to start a context of the App (example here) and a trace context (example here) where the traceContextCarrier needs to be stored in KeptnApp annotations
update of KeptnApp -> controller updates the existing non user-defined KeptnApp with all the workloads of the application which are currently in the cluster
After the KeptnApp is created/updated, the KeptnAppCreationRequest should be deleted and the reconciliation loop ends -> this behaviour is needed due to possible future updates of the KeptnApp (adding/deleting workloads).
Acceptance Criteria
KeptnAppCreationRequest controller reconciles the resources and creates/updates the appropriate KeptnApp
DoD
Implemented controller logic according to the description
Part of #514
Pre-requisites :
Goal
Implement the controller logic to handle
KeptnAppCreationRequest
resources to support of automatic discovery of the application, where a multi-service/single-service application will not require a user-definedKeptnApp
resource. Instead this resource will be generated automatically.Technical Details
Implementation of
Reconcile()
function ofKeptnAppCreationRequest
controllerThe controller will be the component creating/updating the
KeptnApp
resource according to the current state. It will fetch all workloads of the application and also takes care of waiting for the timeout to expire.Explanationary notes:
How to know if
KeptnApp
is user defined:KeptnApp
has a.metadata.ownerReference
pointing toKeptnAppCreationRequest
, it is not a user definedKeptnApp
How to know if
KeptnApp
is single-service or multi-service:KeptnAppCreationRequest
annotationkeptn.sh/app-type
has valuesingle-service
-> it's single-service app and the timeout is set to 0KeptnAppCreationRequest
annotationkeptn.sh/app-type
has valuemutli-service
-> it's multi-service app and the timeout is set to 30 (in the future this value will be configured from Keptn Config CRD, for now we will use a hard-coded value)Workflow:
The controller tries to fetch the
KeptnApp
KeptnAppCreationRequest
and do not reconcile itself againKeptnApp
exists && is not user defined -> the controller checks the timeout -> if it's not expired yet -> reconcileKeptnApp
does not exist -> the controller checks the timeout -> if it's not expired yet -> reconcileIf the timeout expired (the length of the timeout is based on the information if the app is single-service or multi-service), controller fetches all the
KeptnWorkloads
of the appropriate application and updates/creates theKeptnApp
with the correct version (depending on if it already exists or not). The Version of theKeptnApp
will be computed as a hash of workload versions, which are part of the application.KeptnApp
-> controller creates newKeptnApp
with all workloads of the application but without any pre- or post- deployment tasks/evaluations. Please do not forget to start a context of the App (example here) and a trace context (example here) where thetraceContextCarrier
needs to be stored inKeptnApp
annotationsKeptnApp
-> controller updates the existing non user-definedKeptnApp
with all the workloads of the application which are currently in the clusterAfter the
KeptnApp
is created/updated, theKeptnAppCreationRequest
should be deleted and the reconciliation loop ends -> this behaviour is needed due to possible future updates of the KeptnApp (adding/deleting workloads).Acceptance Criteria
KeptnAppCreationRequest
controller reconciles the resources and creates/updates the appropriateKeptnApp
DoD
Note
PoC of implementation available here: #559
The text was updated successfully, but these errors were encountered: