Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #484 - 🔗 Add platform reference to workflow status condition #485

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1alpha08/sonataflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ type SonataFlowStatus struct {
// Services displays which platform services are being used by this workflow
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="services"
Services *PlatformServicesStatus `json:"services,omitempty"`
// Platform displays which platform is being used by this workflow
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="platform"
Platform *SonataFlowPlatformRef `json:"platform,omitempty"`
}

func (s *SonataFlowStatus) GetTopLevelConditionType() api.ConditionType {
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha08/sonataflowplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type SonataFlowClusterPlatformRefStatus struct {
Services *PlatformServicesStatus `json:"services,omitempty"`
}

// PlatformServicesStatus displays which cluster-wide services are being used by a SonataFlowPlatform
// PlatformServicesStatus displays which cluster-wide services are being used by a SonataFlowPlatform or SonataFlow
// +k8s:openapi-gen=true
type PlatformServicesStatus struct {
// DataIndexRef displays information on the cluster-wide Data Index service
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha08/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
- description: Platform displays which platform is being used by this workflow
displayName: platform
path: platform
- description: keeps track of how many failure recovers a given workflow had
so far
displayName: recoverFailureAttempts
Expand Down
14 changes: 14 additions & 0 deletions bundle/manifests/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9461,6 +9461,20 @@ spec:
description: The generation observed by the deployment controller.
format: int64
type: integer
platform:
description: Platform displays which platform is being used by this
workflow
properties:
name:
description: Name of the SonataFlowPlatform
type: string
namespace:
description: Namespace of the SonataFlowPlatform
type: string
required:
- name
- namespace
type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given workflow
had so far
Expand Down
14 changes: 14 additions & 0 deletions config/crd/bases/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9462,6 +9462,20 @@ spec:
description: The generation observed by the deployment controller.
format: int64
type: integer
platform:
description: Platform displays which platform is being used by this
workflow
properties:
name:
description: Name of the SonataFlowPlatform
type: string
namespace:
description: Namespace of the SonataFlowPlatform
type: string
required:
- name
- namespace
type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given workflow
had so far
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ spec:
path: endpoint
- displayName: lastTimeRecoverAttempt
path: lastTimeRecoverAttempt
- description: Platform displays which platform is being used by this workflow
displayName: platform
path: platform
- description: keeps track of how many failure recovers a given workflow had
so far
displayName: recoverFailureAttempts
Expand Down
6 changes: 6 additions & 0 deletions controllers/profiles/common/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func (s *StateSupport) PerformStatusUpdate(ctx context.Context, workflow *operat
}
workflow.Status.ObservedGeneration = workflow.Generation
services.SetServiceUrlsInWorkflowStatus(pl, workflow)
if workflow.Status.Platform == nil {
workflow.Status.Platform = &operatorapi.SonataFlowPlatformRef{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so we introduce the platform in this PR, and it will be correctly populated in #482 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly!

}
workflow.Status.Platform.Name = pl.Name
workflow.Status.Platform.Namespace = pl.Namespace

if err = s.C.Status().Update(ctx, workflow); err != nil {
klog.V(log.E).ErrorS(err, "Failed to update Workflow status")
return false, err
Expand Down
3 changes: 3 additions & 0 deletions controllers/sonataflow_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@ func TestSonataFlowController(t *testing.T) {

assert.True(t, ksw.Spec.Flow.Start.StateName == "ChooseOnLanguage")
assert.True(t, len(ksw.Spec.Flow.States) == 4)

assert.Equal(t, ksp.Name, afterReconcileWorkflow.Status.Platform.Name)
assert.Equal(t, ksp.Namespace, afterReconcileWorkflow.Status.Platform.Namespace)
})
}
14 changes: 14 additions & 0 deletions operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26358,6 +26358,20 @@ spec:
description: The generation observed by the deployment controller.
format: int64
type: integer
platform:
description: Platform displays which platform is being used by this
workflow
properties:
name:
description: Name of the SonataFlowPlatform
type: string
namespace:
description: Namespace of the SonataFlowPlatform
type: string
required:
- name
- namespace
type: object
recoverFailureAttempts:
description: keeps track of how many failure recovers a given workflow
had so far
Expand Down
Loading