Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

implement Trait patch back before workload emitted #134

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

implement Trait patch back before workload emitted #134

wants to merge 4 commits into from

Conversation

Copy link
Member

@wonderflow wonderflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help add an real example about patch trait?

@@ -172,26 +193,87 @@ func (r *components) renderComponent(ctx context.Context, acc v1alpha2.Applicati
return &Workload{ComponentName: acc.ComponentName, ComponentRevisionName: componentRevisionName, Workload: w, Traits: traits, Scopes: scopes}, nil
}

func (r *components) renderTrait(ctx context.Context, ct v1alpha2.ComponentTrait, ac *v1alpha2.ApplicationConfiguration,
func (r *components) renderComponentFromPatchTrait(ctx context.Context, w *unstructured.Unstructured, acc *v1alpha2.ApplicationConfigurationComponent, t *unstructured.Unstructured) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this one have a unit test? I would also suggest to break this function into multiple pieces (the patch itself can be a function)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll add a unit test

@hongchaodeng
Copy link
Member

Any progress on this PR?
If @ifree613 doesn't have time, we can help continue to finish it.
cc @wonderflow

@wonderflow
Copy link
Member

pending on this issue #157

@ryanzhang-oss
Copy link
Collaborator

Just FYI, the strategicMergepatch is in a library at "k8s.io/apimachinery/pkg/util/strategicpatch"

@antiClocke
Copy link

antiClocke commented Dec 4, 2020

//oam-k8s-runtime will periodically check the status of patch trait. If the phase of status become Ready, the oam-k8s-runtime will gather the patch data from the ConfigMap. After all patch traits gathered, oam-k8s-runtime will patch all the information into workload

i have a little problem..where is this logic,periodically check and patch
@wonderflow @ifree613

@antiClocke

This comment has been minimized.

@antiClocke
Copy link

antiClocke commented Dec 4, 2020

//All patch traits MUST be created or updated before workload emit, and oam-k8s-runtime will be pending until all patch traits are ready.
i am a fish,a questioin
where is the pending logic, i d not fount

@wonderflow
Copy link
Member

@antiClocke Let's talk deep in wechat or Dingtalk, my ID is wonderflow

@antiClocke
Copy link

antiClocke commented Dec 4, 2020

@antiClocke Let's talk deep in wechat or Dingtalk, my ID is wonderflow

wechat

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants