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

Conversation

@wonderflow
Copy link
Member

@wonderflow wonderflow commented Jun 3, 2020

ref: #29
fixes #34

  • Add Component Mutable demo
  • Add Rollout trait using revision as demo
  • Add more tests

@wonderflow wonderflow force-pushed the component branch 2 times, most recently from f27fcd9 to e9b8821 Compare June 4, 2020 07:41
@wonderflow wonderflow requested a review from ryanzhang-oss June 4, 2020 07:42
@wonderflow wonderflow marked this pull request as draft June 4, 2020 07:43
@wonderflow wonderflow marked this pull request as ready for review June 4, 2020 07:44
@wonderflow wonderflow marked this pull request as draft June 4, 2020 07:46
@wonderflow wonderflow force-pushed the component branch 4 times, most recently from febc501 to 3a06cf7 Compare June 5, 2020 06:23
@wonderflow wonderflow marked this pull request as ready for review June 5, 2020 06:23
@wonderflow wonderflow changed the title WIP implementation of component mutable and versioning mechanism implementation of component mutable and versioning mechanism Jun 5, 2020
// affect from the prior revision to the new one. This is mutually exclusive
// with RevisionName.
// +optional
ComponentName string `json:"componentName"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way for Json tag enforce mutually exclusive fields? or we have to use an admission controller

Copy link
Member Author

Choose a reason for hiding this comment

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

We have to use admission controller for this

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's create an admission then. Maybe make it part of oam controllers local if it's not clear for now how to do it in crossplane release? /cc @ryanzhang-oss

2. component change will be recorded in controllerRevision
3. According to trait.createRevision to decide whether to use componentName or revisionName to create workload instance.
4. Garbage collection will not collect old revision workload
Signed-off-by: 天元 <[email protected]>
@wonderflow wonderflow force-pushed the component branch 3 times, most recently from aa1a35c to e117df1 Compare June 22, 2020 05:40
@wonderflow wonderflow force-pushed the component branch 6 times, most recently from a09ccd0 to b343bdb Compare June 22, 2020 09:43
Signed-off-by: 天元 <[email protected]>
Copy link
Member

@hongchaodeng hongchaodeng left a comment

Choose a reason for hiding this comment

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

Nice work!
LGTM

```shell script
$ kubectl get simplerollouttraits.extend.oam.dev
NAME AGE
example-component 3m16s
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is a trait's name called xxx-component?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently,we directly use componentName as a trait name.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could raise another issue for it. I also thinks it's not appropriate.

kind: ContainerizedWorkload
name: example-component-brngj9ript3e8125vhf0
status:
currentWorkloadRef:
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does the "currentWorkloadRef" only have the previous workloadRef?

Copy link
Member Author

Choose a reason for hiding this comment

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

Status shows real, Spec means expect. They are different, so the rolling update start. After the rolling finished, the status will align with the spec.

Signed-off-by: 天元 <[email protected]>
Copy link
Contributor

@resouer resouer left a comment

Choose a reason for hiding this comment

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

LGTM

@zzxwill
Copy link
Member

zzxwill commented Jun 24, 2020

LGTM

@ryanzhang-oss ryanzhang-oss merged commit 3f4e315 into crossplane:master Jun 24, 2020
l logging.Logger
}

// Create implements EventHandler
Copy link
Collaborator

Choose a reason for hiding this comment

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

highly recommend to add

var _ handler.EventHandler = &ComponentHandler{}

to make both code more readable and have a basic guard against any future breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

agree

t.SetNamespace(namespace)
}

func (r *components) getTraitDefinition(ctx context.Context, t *unstructured.Unstructured) (v1alpha2.TraitDefinition, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use the utility function in the addon-k8s now

func setTraitProperties(t *unstructured.Unstructured, componentName, namespace string, ref *metav1.OwnerReference) {
// Set metadata name for `Trait` if the metadata name is NOT set.
if t.GetName() == "" {
t.SetName(componentName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's at least make the name look like it's a "trait"

Comment on lines +190 to 194
group, _ := addon.ApiVersion2GroupVersion(u.GetAPIVersion())
resources := []string{addon.Kind2Resource(u.GetKind())}
if group != "" {
resources = append(resources, group)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there is a new function called GetGVResource that one can use now instead of calling two functions.

@resouer
Copy link
Contributor

resouer commented Jul 5, 2020

What will happen if user set parameterValues and then update it thru kubectl apply -f appconfig.yaml?

@wonderflow
Copy link
Member Author

@resouer parameterValues will be regarded as trait, values from parameterValues will finnally cover data of component.

@wonderflow wonderflow deleted the component branch July 6, 2020 06:19
wonderflow added a commit to wonderflow/oam-kubernetes-runtime that referenced this pull request Jul 21, 2020
1. component versioning implemented by crossplane#35
2. dependency implemented by crossplane#74 and crossplane#53
3. rollout model don't need any change, it's best practice

Signed-off-by: 天元 <[email protected]>
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.

Can not create appconfig when "instance-name" parameter removed

5 participants