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

How can a developer represent the application prior to application configuration? #334

Closed
artursouza opened this issue Mar 13, 2020 · 21 comments
Milestone

Comments

@artursouza
Copy link
Contributor

Issue

A developer defines the components, on the other hand, an application is composed of multiple components (usually microservices). The only place where components are grouped together is at the ApplicationConfiguration, which is supposed to be authored by ops team.

Proposal

Create a new concept, called "Application" that will be a way to define a set of components (without traits or param values or scopes). Then, ApplicationConfiguration references the Application and provides all required params and (probably) also add traits and scopes. If the ApplicationConfiguration does not specify one of the components because there is no trait or params to be added, the component is still considered as part of the ApplicationConfiguration since it refers the Application.

@wonderflow
Copy link
Member

Could you give a real case why a developer want to define a set of components (especially without traits or param values or scopes)?

In our cloud team, we really feel application configuration not enough, but that's not for developer. Because we have multiple clusters and multiple availability zones, while application configuration can only used in one cluster. So in my view, the new concept Application should leave for that multiple cluster case.

@artursouza
Copy link
Contributor Author

@wonderflow It might be different things. What you are describing (correct me if I am wrong here) is to have some sort of ApplicationConfigurationTemplate, where some params can be defined in an ApplicationConfiguration. Then each cluster would be a different ApplicationConfiguration for the same ApplicationConfigurationTemplate.

My initial proposal is more dev oriented. In the example of a developer to build an application with 4 different components. The application does not work with only 3 of those, must be all 4. So, the developer could define an Application (without traits or scopes) that says these 4 component together defines Application A. This way, when the app operator is creating an ApplicationConfiguration, all the components for the app are automatically inherited. Only traits, scopes and params must be defined.

@Haishi2016
Copy link

I agree the Application object should be dev oriented. It should provide an abstract modeling langauge for developers to design the topology of their applications. In my mind, the Application object won't be a generic model that can include everything. Instead, it shall be an opinionated model that abstract common construct of a distributed application. For instance, ingress, scaling limitations, network scopes, as well as sites (for multi-site applications) should be built-in attributes of the Application model. Then, at operation time, operations can decide to attach traits to these properties to realize how the developer intention is fulfilled.

This allows us to have a clear separation - all the developer ever needs to touch is the Application object. Application describes the application topology, a responsibility that is currently mixed into ApplicationConfiguration. Once this is separated out, ApplicationConfiguration is purely for configuration overrides, as it should have been.

ApplicationConfiguration also serves as a Deployment, a concept I think we should separate out by itself. A Deployment can be a single component or an Application, which can be associated with an optional ApplicationConfiguration.

A separate Deployment object make tricky things like canary deployment natural - we can simply define a Deployment that includes two Application versions and then associate traffic shaping policy on it. This kind of deployment is hard to express without a separate Deployment concept.

@resouer
Copy link
Member

resouer commented Mar 15, 2020

In addition, Application object will be descriptor for app metadata, i.e. author/maintainer, name, release/version of the app. xref: app crd in kube. I'm generally in favor of this idea.

@artursouza
Copy link
Contributor Author

I am not sure if Application should be aware of Traits like (ingress, scaling) or scopes (network, health) since it crosses the line (IMO) between dev and ops. I see Application as a formal description of the application's architecture, prior to bringing deployment related concepts. If we bring all these concepts to Application, then it will be almost a copy and paste of ApplicationConfiguration - giving ops just the chance to populate params.

@Haishi2016
Copy link

The Application should NOT know about traits. These will be abstracts that we offer. And these abstracts will be the key value the application model contributes to the community. This is definitely not copy&paste. Otherwise, if you think about it, the OAM application is a collection of things that you can attach additional things. It's very generic and extensible for sure. But we are lacking of modeling language that allow user can describe their application topology in a platform-agnostic way with high precision - instead of making assumptions on how particular traits, or even implementations of traits, work.

@artursouza
Copy link
Contributor Author

artursouza commented Mar 19, 2020 via email

@wonderflow
Copy link
Member

Could someone draft a proposal for it? Including some cases and YAML examples, then we could understand and discuss deeply.

@artursouza
Copy link
Contributor Author

Yes. That is on me.

@artursouza
Copy link
Contributor Author

Prior related work:
#185
#148

@negz
Copy link
Contributor

negz commented Mar 24, 2020

I wonder if we could do this with something like a simple label selector?

---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
  name: cool-component-a
  labels:
    app: coolapp
---
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
  name: cool-component-b
  labels:
    app: coolapp
---
# This new object kind helps discover groups of components.
apiVersion: core.oam.dev/v1alpha2
kind: ComponentGroup  # Probably needs a better name.
metadata:
  name: cool-components
spec:
  componentSelector:
    matchLabels:
      app: coolapp

@artursouza
Copy link
Contributor Author

It can work. I am concerned about the double reference - the group and the components need to know the labels. I was thinking about a solution where component can be reused and shared without any dependency with the layer above (group or application or whatever we decide to be)

@Haishi2016
Copy link

I generally lean towards a single application manifest deploying the whole topology as the single source of truth. Scattering truth to more places make things like version management difficult.

@hongchaodeng
Copy link
Member

@Haishi2016
Are you proposing that we would have ApplicationModel which dev uses:

kind: ApplicationModel
spec:
  componnets:
  - name: a
  - name: b

Then ops defines ApplicationConfiguration:

kind: ApplicationConfiguration
spec:
  componnets:
  - name: a
    paramValues: ...
    traits: ...
  - name: b

Right?

@Haishi2016
Copy link

@hongchaodeng Yes, along those lines. I also think the ApplicationModel can define parameters with default values, and ApplicationConfiguration can override them. I'll work with @artursouza to come up with a proposal for feedback.

@artursouza
Copy link
Contributor Author

I am on the same page as Haishi.

@hongchaodeng
Copy link
Member

Is this PR: #342
originated from this issue?

@artursouza
Copy link
Contributor Author

Related but Deployment is separate from Application.

@hongchaodeng
Copy link
Member

Thanks for explaining.
Just in case let me rephrase again:

  • The Application is a construct that groups components and describes their topology
  • The Deployment is about runtime configuration of Application

@ryanzhang-oss
Copy link
Contributor

Prior related work:
#185
#148

Please take a look at #336, it's very much related

@resouer
Copy link
Member

resouer commented Sep 20, 2020

Close in favor of #306

@resouer resouer closed this as completed Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants