-
Notifications
You must be signed in to change notification settings - Fork 80
implementation of component mutable and versioning mechanism #35
Conversation
f27fcd9 to
e9b8821
Compare
febc501 to
3a06cf7
Compare
apis/core/v1alpha2/core_types.go
Outdated
| // affect from the prior revision to the new one. This is mutually exclusive | ||
| // with RevisionName. | ||
| // +optional | ||
| ComponentName string `json:"componentName"` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
pkg/controller/oam/applicationconfiguration/applicationconfiguration.go
Outdated
Show resolved
Hide resolved
74cfac6 to
8d85905
Compare
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]>
Signed-off-by: 天元 <[email protected]>
Signed-off-by: 天元 <[email protected]>
Signed-off-by: 天元 <[email protected]>
Signed-off-by: 天元 <[email protected]>
aa1a35c to
e117df1
Compare
a09ccd0 to
b343bdb
Compare
Signed-off-by: 天元 <[email protected]>
hongchaodeng
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]>
resouer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LGTM |
| l logging.Logger | ||
| } | ||
|
|
||
| // Create implements EventHandler |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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"
| group, _ := addon.ApiVersion2GroupVersion(u.GetAPIVersion()) | ||
| resources := []string{addon.Kind2Resource(u.GetKind())} | ||
| if group != "" { | ||
| resources = append(resources, group) | ||
| } |
There was a problem hiding this comment.
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.
|
What will happen if user set |
|
@resouer parameterValues will be regarded as trait, values from parameterValues will finnally cover data of component. |
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]>
ref: #29
fixes #34