Comments (10)
- Fetch all the childResources from the corresponding workloadDefinition CR.
- List each child resource by its type and filter by owner reference. Here, we assume that all the child resources that the workload generates have an owner reference field pointing back to the workload instance.
These steps are too verbose. We can do an alternative that by adding child object references in the annotations of workload CR, this can be simplified and easier to understand. Here's an example:
kind: ContainerizedWorkload
metadata:
annotations:
core.oam.dev/child-objects: "..."
from oam-kubernetes-runtime.
These steps are too verbose. We can do an alternative that by adding child object references in the annotations of workload CR, this can be simplified and easier to understand. Here's an example:
Who would put that info in the workload CR? It seems that appConfig controller would have no idea.
from oam-kubernetes-runtime.
It seems that appConfig controller would have no idea.
It is the appConfig controller actually because it has all the context to watch child resources created, filter owner references, and attaching those info back.
from oam-kubernetes-runtime.
@ryanzhang-oss Let's make this a PR so folks can leave comment easier?
Here's a perfect place for proposals: https://github.com/crossplane/crossplane/tree/f86e47e06fd5d221b33f29847bf4e12813f769da/design
from oam-kubernetes-runtime.
Agree. Making it a proposal would be a great start to have a well defined, unambiguous direction for implementation.
To make a proposal, we should structure this more user friendly, and have a end2end user story.
First of all, the title should be focused on adding a new trait from user perspective. Currently the title is too implementation focused. From platform builder's POV, Trait is a reusable module in OAM. A platform builder can add a new trait for specific operational capability and have it plugged into any OAM platform.
Second, we should demonstrate at least 2 user scenarios in the proposal:
Scenario 1 (Bespoke): Implement a new trait
Let's say a platform builder has a custom workload object called MyDeployment, and wants to add a new operational function called MyCanaryRollout to MyDeployment. In this case, he is building a bespoke trait and needs to understand how to interact with OAM runtime? This includes how to get the MyDeployment object and its child resources, what are the other traits (e.g. traffic split and monitoring metrics), etc. We need to demonstrate what OAM capabilities to help him build that.
The problem to solve in this scenario is to make a platform builder know how to implement a new trait and add it to OAM.
Specifically, we should cover at least two things:
- Standardized trait implementation workflow. The data (labels, annotations, fields) and the hooks (when should reconcile happen).
- SDK to help developer interact with the OAM runtime to achieve data and focus on business logic.
Scenario 2 (COTS): Reuse an existing trait
Let's say an OAM user has a standard ContainerizedWorkload deployment, and retrieves a monitoring trait from others. In this case, he is deploying a COTS trait and needs to understand what does OAM do? This includes putting the restrictions on trait and component relationship (appliesTo field), conflicts (oam-dev/spec#352), potentially ordering as discussed in #11, etc.
The problem to solve in this scenario is to make a user understand how adding an existing trait affects his current workflow.
from oam-kubernetes-runtime.
"Add a childResources field in the WorkloadDefinition."
It only works for simple 1-1 mappings. One Workload to one service and to one deployment. It does not work if there is a more complex logic involved to generate those. We should define an interface instead. This way, how one particular WorkloadType maps to CRDs is abstracted and just matters at runtime.
"ApplicationConfig controller add labels containing the workload information to the emitted trait CR."
App operator should not need to describe how the trait is applied - we are removing value from OAM if we start to peal out the abstraction. The app operator just applies the Trait to the Component in AppConfig and the implementation knows how to apply it. In this case, if we want to make this extensible, it feels like another interface.
My general feedback is to not pollute the spec due to implementation details. We should try to make this library extensible without creating an OAM's sub-spec. We should be defining an API instead.
from oam-kubernetes-runtime.
Echo to this comment: https://github.com/crossplane/crossplane/issues/1448#issuecomment-620275559
I agree we should try best to simplify the workflow in Trait controller by annotating GVK + name (not sure if possible) of child resource on Workload CR. There's several approaches to do this and we can follow up the discussion on the upcoming proposal.
from oam-kubernetes-runtime.
proposal: crossplane/crossplane#1454
from oam-kubernetes-runtime.
Per #55 we're centralising all things OAM in one repo, and oam-kubernetes-runtime seems like the leading candidate. I'm going to move this issue there.
from oam-kubernetes-runtime.
Closing as it already implemented https://github.com/crossplane/oam-kubernetes-runtime/blob/master/design/one-pager-trait-workload-interaction-mechanism.md
from oam-kubernetes-runtime.
Related Issues (20)
- [BUG] 【containerized workload】 Updating the trait of application will result in all workload rebuilding HOT 2
- [BUG]Two examples of oam: flight-tracker and dependency do not authorize oam's permissions to crd, so the example will not run. HOT 2
- Trait apply should use update instead of patch HOT 27
- [Feature] Support Namespaced Scope for Defintion
- [Feature] support don't reconcile if AppConfig or Component not updated HOT 1
- observedGeneration in Component and ControllerRevision should be equal [BUG]
- Should not update workload if only revisionEnabled trait was added first time HOT 1
- [Feature] make development log setting as an argument HOT 2
- [Feature] ContainerConfigFile support subPath HOT 4
- [Feature] Add Helm chart for K8s version < 1.16 HOT 1
- [Feature] scope should include all workload instance with versioning mechanism HOT 1
- [BUG] trait CR label will be override when more than two traits exist
- [Feature] using trait type instead of hardcode word 'trait' to create trait CR HOT 2
- [BUG] not convenient to debug e2e-test locally
- [Feature] Make local development more enjoyable HOT 2
- In ScopeRef it seems like Kind and Name cause for too much configuration, name should be replaced with properties HOT 2
- [Feature] Support ALL oam-kubernetes-runtime feature in KubeVela HOT 2
- once component set command, can't remove.
- Support complex/object data type for parameterValues in ApplicationConfiguration HOT 2
- [BUG] delete component and modify appConfig's components to null array lead to panic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oam-kubernetes-runtime.