Skip to content

Commit 5e90b7f

Browse files
committed
Additional updates to Environment API intro doc
1 parent c03f3de commit 5e90b7f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

docs/environment-api/introduction.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,31 @@ The Red Hat product/project that this is attached to has had many names: AppStud
99
- For the purposes of this document, I will use 'Konflux', the latest name, as of this writing, February 2024.
1010
- However, the code/API referenced in this document has been deprecated, will no longer be used, and will be removed from the Konflux project.
1111

12-
For more information on the Environment API, see this [long, detailed document I wrote](https://github.com/redhat-appstudio/managed-gitops/blob/main/docs/environment-api/environment-api-proposal-v3.md) which details the final cross-organization agreement on how this API would work within Konflux.
12+
For more information on the Environment API, see the [detailed document I wrote](https://github.com/redhat-appstudio/managed-gitops/blob/main/docs/environment-api/environment-api-proposal-v3.md) which details the final cross-organization agreement on how this API would work within Konflux.
1313

1414
## Big Picture
15+
- Konflux concepts (and K8s custom resources): `Application`, `Component`, `Environment`, `Snapshot`, `SnapshotEnvironmentBinding`
1516

1617
- You define an `Application`. (e.g. `bank-loan-app`)
1718
- **NOTE**: ZERO relation to Argo CD's Application custom resource (CR)/concept, put this out of your mind here in this context. They just happen share a name 😀
1819
- In this document, I'll use "Argo CD Application" when I specifically mean that.
1920
- You define `Components`, which are the child components of that Application (e.g. `frontend` in Node, `backend` in Java, `database` in PSQL)
21+
- A Component is a single version of a single container
2022
- You define `Environment`s, which are the K8s clusters that you wish to deploy that Application to (only K8s clusters are supported)
2123
- e.g. `test`, `staging`, `prod-eu`, `prod-us`
2224
- A DAG, e.g. dev -> test -> staging -> prod. Can be single or multiple children (for example, see last deployment in this example.)
2325
- ![Relationships between resources](Stages.png)
24-
26+
- Automated/Manual promotion in this diagram refers to whether human intervention is required to promote from a parent Enviroment to a child Environment:
27+
- Automated: Immediately promote to the next child on status of Healthy.
28+
- Manual: Wait for a human to tell us to promote to the next child in the DAG.
2529
- You define a `Snapshot`, which is a particular version of your Application (and specifically, of its constituent Components). (e.g. `bank-loan-app-v2-(commit id)`)
30+
- Snapshot defines container image for each component.
2631
- The actual deployment of a Snapshot (specific version of an Application) to an Environment (specific k8s cluster) is performed via a `SnapshotEnvironmentBinding`
27-
- `SnapshotEnvironmentBinding` defines *(Application, Snapshot, Environment)* tuple
32+
- `SnapshotEnvironmentBinding` (SEB) defines *(Application, Snapshot, Environment)* tuple
2833
- tuple: Application A, of version S, should be deployed to Environment E
29-
- Finally, `SnapshotEnvironmentBinding` is translated (reconciled, via K8s controller) into 1 or more Argo CD Application
30-
- Thus, all of these abstractions **ultimately boil down into Argo CD Application CRs** (custom resources) deploying to K8s clusters.
34+
- Multiple SEBs can target a single environment
35+
- Finally, `SnapshotEnvironmentBinding` is translated (reconciled, via K8s controller) into 1 or more Argo CD Applications
36+
- Thus, all of these abstractions **ultimately boil down into 1 or more Argo CD Application CRs** (custom resources) deploying to K8s clusters.
3137

3238

3339

@@ -92,13 +98,15 @@ All concepts mentioned have a corresponding CR of the same name. I use the two i
9298
- A Snapshot is only useful in the context of the Application it references: a Snapshot is not shared between multiple Applications.
9399
- A Snapshot is a set of container images, one for each component of an Application.
94100
- If an Application has 3 components, the Snapshot will have 3 container images.
95-
- Example Snapshot:
101+
- Example Snapshot 'v2':
96102
- Application: loan-app
97-
- Component 'frontend': `quay.io/my-bank/loan-app-frontend:(version, git commit id, or date built, for example)`
103+
- Component 'frontend': `quay.io/my-bank/loan-app-frontend:v2` (or tag could be, version, git commit id, or date built, for example)
98104
- Component 'backend': `quay.io/my-bank/loan-app-backend:(version, git commit id or date built, for example)`
99105
- Component 'database': `postgres:16.1`
100106
- Snapshots can be annotated with additional information, for example, whether or not the Snapshot passed integration tests (thus making the Snapshot ready for promotion to next child in the DAG).
101-
- This ensures a particular version of an Application has necessarily been tested with a particular set of constituent container images
107+
- Why have the version be an independent concept from the Application/Component itself? Why not set the version in `.spec`` of Component?
108+
- Well, Snapshot ensures a particular version of an Application has necessarily been tested with a particular set of constituent container images
109+
- And thus, when deployed together as an Application, those specific Component versions have necessarily been tested together.
102110
- Snapshots are not shared between different Applications. A Snapshot will have a single Application as a mandatory parent.
103111
- [API description](https://github.com/redhat-appstudio/managed-gitops/blob/main/docs/api.md#snapshot)
104112
- [Snapshot CR code](https://github.com/redhat-appstudio/application-api/blob/18f545e48a03cbc6df71fb0468dac9aa66209c4c/api/v1alpha1/snapshot_types.go#L25)
@@ -140,6 +148,7 @@ All concepts mentioned have a corresponding CR of the same name. I use the two i
140148
#### PromotionRun
141149
- A single use CR which will promote a particular Application/Snapshot to a particular Environment
142150
- For example: I could use a `PromotionRun` to promote Snapshot 'loan-app-v2' from 'staging NA' to 'prod NA'
151+
- This is the mechanism for manual promotion between Environments (versus 'automated promotion' which would trigger a new promotion once an Application between healthy in an Environment)
143152
- [API description](https://github.com/redhat-appstudio/application-api/blob/18f545e48a03cbc6df71fb0468dac9aa66209c4c/api/v1alpha1/promotionrun_types.go#L24)
144153
- [PromotionRun CR code](https://github.com/redhat-appstudio/application-api/blob/18f545e48a03cbc6df71fb0468dac9aa66209c4c/api/v1alpha1/promotionrun_types.go#L24)
145154

0 commit comments

Comments
 (0)