# Octant Application View
## Summary
Create an Application views that summarize the status of an _application_. These views will live in a new module: Applications. The goal of these views to give users one place to look when viewing their applications instead of of having to know all the indvidual components.
## Motivation
The Application View is wanted because it will give users a single location to see all the components of their application. This will reduce the amount of work required to know if their application is working correctly.
### Goals
* Allow users to see all applications in a namespace.
* Allow user to see the components of an application in namespace.
* Create resource view that shows all components of an application.
* Annotate applications managed by Helm charts.
### Non-Goals
* Using the Application CRD to determine application membership.
## Proposal
### Implementation Details
#### Determining application membership
Objects can declare their membership to an application by using labels. The labels are based on the document at https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels
Four labels are used to determine membership to an application:
* `app.kubernetes.io/name`: The name of the application
* `app.kubernetes.io/part-of`: The name of a higher level application this one is part of
* `app.kubernetes.io/instance`: A unique name identifying the instance of an application
* `app.kubernetes.io/version`: The current version of the application. This should is optional.
`name` and `instance` will be required to unique identify an application. Components with `part-of` should be added to the root application. (i.e. If `foo` is part-of `bar` which part of `baz`, all the components in `foo` and `bar` will be identified as application `baz`)
An application can exist only if there if a pod exists.
Additionally, there are other labels of signficance:
* `app.kubernetes.io/managed-by`: Item which manages this application. This is used by Helm and possibly others.
#### Application Module
Create an Application module to house the Application view. The Application module's home page will consist of a list of applications in the current namespace. The applications can be shown as a list or icons.
In the list view, has the following columns:
* Application Name
* Application Instance
* Application State
* Application Version
* Application Manager
* Number of Pods
In the icon view, show an icon with the application's name, instance, state, version, and pod count. When selecting an application, the user will be forwarded to a new view which contains tabs for Application Detail and the Application Resource Viewer.
#### Application Detail
An application detail consists of an overview style list of objects separated by their type. The existing printers can be reused for this purpose. The user will be redirected to the overview module when they select an object from the overview list.
#### Application Resource Viewer
A new version of the resource viewer will need to be constructed that contains all the objects in the current application. This differs from the overview/cluster overview as they only show the relationships from a single object. The existing resource viewer code can be repurposed for this work.
The existing resource viewer should be moved to a top level internal namespace so the code can be shared with multiple modules.
The existing object visitor should be moved to a top level internal namespace so the code can be shared with multiple modules.
#### Object Printer
The printers currently live under the overview module. They will need to be moved to a top level internal namespace. This will signify they can be used by multiple modules.
The object printer should be updated to provide a link back to the Application an object belongs to.