mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
Feat: versioned the context backend values to the app revision (#5231)
Signed-off-by: barnettZQG <barnett.zqg@gmail.com> Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
@@ -135,6 +135,8 @@ type ApplicationRevisionStatus struct {
|
||||
Succeeded bool `json:"succeeded"`
|
||||
// Workflow the running status of the workflow
|
||||
Workflow *common.WorkflowStatus `json:"workflow,omitempty"`
|
||||
// Record the context values to the revision.
|
||||
WorkflowContext map[string]string `json:"workflowContext,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@@ -293,6 +293,13 @@ func (in *ApplicationRevisionStatus) DeepCopyInto(out *ApplicationRevisionStatus
|
||||
*out = new(common.WorkflowStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.WorkflowContext != nil {
|
||||
in, out := &in.WorkflowContext, &out.WorkflowContext
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevisionStatus.
|
||||
|
||||
@@ -5042,6 +5042,11 @@ spec:
|
||||
- suspend
|
||||
- terminated
|
||||
type: object
|
||||
workflowContext:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Record the context values to the revision.
|
||||
type: object
|
||||
required:
|
||||
- succeeded
|
||||
type: object
|
||||
|
||||
@@ -5042,6 +5042,11 @@ spec:
|
||||
- suspend
|
||||
- terminated
|
||||
type: object
|
||||
workflowContext:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Record the context values to the revision.
|
||||
type: object
|
||||
required:
|
||||
- succeeded
|
||||
type: object
|
||||
|
||||
@@ -5042,6 +5042,11 @@ spec:
|
||||
- suspend
|
||||
- terminated
|
||||
type: object
|
||||
workflowContext:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Record the context values to the revision.
|
||||
type: object
|
||||
required:
|
||||
- succeeded
|
||||
type: object
|
||||
|
||||
@@ -1025,6 +1025,16 @@ func (h *AppHandler) UpdateApplicationRevisionStatus(ctx context.Context, appRev
|
||||
}
|
||||
appRev.Status.Succeeded = succeed
|
||||
appRev.Status.Workflow = wfStatus
|
||||
|
||||
// Versioned the context backend values.
|
||||
if wfStatus.ContextBackend != nil {
|
||||
var cm corev1.ConfigMap
|
||||
if err := h.r.Client.Get(ctx, ktypes.NamespacedName{Namespace: wfStatus.ContextBackend.Namespace, Name: wfStatus.ContextBackend.Name}, &cm); err != nil {
|
||||
klog.Error(err, "[UpdateApplicationRevisionStatus] failed to load the context values", "ApplicationRevision", appRev.Name)
|
||||
}
|
||||
appRev.Status.WorkflowContext = cm.Data
|
||||
}
|
||||
|
||||
if err := h.r.Client.Status().Update(ctx, appRev); err != nil {
|
||||
if logCtx, ok := ctx.(monitorContext.Context); ok {
|
||||
logCtx.Error(err, "[UpdateApplicationRevisionStatus] failed to update application revision status", "ApplicationRevision", appRev.Name)
|
||||
|
||||
Reference in New Issue
Block a user