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

Implement logic for KeptnAppCreationRequest controller #613

Closed
1 of 5 tasks
Tracked by #514 ...
odubajDT opened this issue Jan 13, 2023 · 1 comment · Fixed by #1191
Closed
1 of 5 tasks
Tracked by #514 ...

Implement logic for KeptnAppCreationRequest controller #613

odubajDT opened this issue Jan 13, 2023 · 1 comment · Fixed by #1191
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@odubajDT
Copy link
Contributor

odubajDT commented Jan 13, 2023

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-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
  • Unit tests
  • Integration tests

Note

PoC of implementation available here: #559

@odubajDT odubajDT added enhancement New feature or request status: ready-for-refinement Issue is relevant for the next backlog refinment labels Jan 13, 2023
@odubajDT odubajDT added this to the 0.6 milestone Jan 13, 2023
@odubajDT odubajDT moved this to 🏗 Shaping in Keptn Lifecycle Toolkit Jan 13, 2023
@odubajDT odubajDT changed the title Implement logic for KeptnAppCreationRequest resource Implement logic for KeptnAppCreationRequest controller Jan 13, 2023
@thisthat thisthat modified the milestones: 0.6, 0.7 Jan 18, 2023
@thisthat thisthat removed the status: ready-for-refinement Issue is relevant for the next backlog refinment label Jan 31, 2023
@thisthat thisthat moved this from 🏗 Shaping to 🎟️ Refined in Keptn Lifecycle Toolkit Feb 7, 2023
@thisthat thisthat modified the milestones: 0.7, 0.8 Feb 24, 2023
@bacherfl bacherfl self-assigned this Mar 31, 2023
@bacherfl bacherfl moved this from 🎟️ Refined to 🏃 In progress in Keptn Lifecycle Toolkit Mar 31, 2023
@bacherfl
Copy link
Member

bacherfl commented Apr 5, 2023

During implementation it turned out that we need to solve #1185 before this can be fully implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants