-
Notifications
You must be signed in to change notification settings - Fork 38
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
add rollout status in app api #520
Conversation
✅ Deploy Preview for kurator-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -419,6 +423,21 @@ type ApplicationSyncStatus struct { | |||
HelmReleaseStatus *helmv2beta1.HelmReleaseStatus `json:"HelmReleaseStatus,omitempty"` | |||
} | |||
|
|||
// RolloutStatus defines the observed state of Rollout. | |||
type RolloutStatus struct { |
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 have defined the RolloutStatus structure, but you haven't specified where it is used.
You might need to declare it in
kurator/pkg/apis/apps/v1alpha1/types.go
Lines 406 to 410 in 34ae6ed
// ApplicationStatus defines the observed state of Application. | |
type ApplicationStatus struct { | |
SourceStatus *ApplicationSourceStatus `json:"sourceStatus,omitempty"` | |
SyncStatus []*ApplicationSyncStatus `json:"syncStatus,omitempty"` | |
} |
34ae6ed
to
e286e76
Compare
pkg/apis/apps/v1alpha1/types.go
Outdated
@@ -417,6 +421,22 @@ type ApplicationSyncStatus struct { | |||
Name string `json:"name,omitempty"` | |||
KustomizationStatus *kustomizev1beta2.KustomizationStatus `json:"kustomizationStatus,omitempty"` | |||
HelmReleaseStatus *helmv2beta1.HelmReleaseStatus `json:"HelmReleaseStatus,omitempty"` | |||
RolloutStatus RolloutStatus `json:"rolloutStatus,omitempty"` |
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.
This is different from fluxCD, which we create CR in management cluster,
But for rolling out we need to create CR in member clusters, i am not sure how can we watch the member cluster CR's status
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.
Yes, this approach differs from FluxCD.
It may not be feasible to directly monitor the status of Custom Resources (CRs) in member clusters.
Instead, we might need to continuously iterate over these CRs, checking them until they achieve the expected state.
see:
kurator/pkg/fleet-manager/backup/backup_controller.go
Lines 166 to 207 in 40eb58e
// reconcileOneTimeBackupStatus updates the status of a one-time Backup object by checking the status of corresponding Velero backup resources in each target cluster. | |
// It determines whether to requeue the reconciliation based on the completion status of all Velero backup resources. | |
func (b *BackupManager) reconcileOneTimeBackupStatus(ctx context.Context, backup *backupapi.Backup, destinationClusters map[fleetmanager.ClusterKey]*fleetmanager.FleetCluster, statusMap map[string]*backupapi.BackupDetails) (ctrl.Result, error) { | |
log := ctrl.LoggerFrom(ctx) | |
// Loop through each target cluster to retrieve the status of Velero backup resources using the client associated with the respective target cluster. | |
for clusterKey, clusterAccess := range destinationClusters { | |
name := generateVeleroResourceName(clusterKey.Name, BackupKind, backup.Namespace, backup.Name) | |
veleroBackup := &velerov1.Backup{} | |
// Use the client of the target cluster to get the status of Velero backup resources | |
err := getResourceFromClusterClient(ctx, name, VeleroNamespace, *clusterAccess, veleroBackup) | |
if err != nil { | |
log.Error(err, "failed to create velero backup instance for sync one time backup status") | |
return ctrl.Result{}, err | |
} | |
key := fmt.Sprintf("%s-%s-%s", clusterKey.Name, clusterKey.Kind, veleroBackup.Name) | |
if detail, exists := statusMap[key]; exists { | |
// If a matching entry is found, update the existing BackupDetails object with the new status. | |
detail.BackupStatusInCluster = &veleroBackup.Status | |
} else { | |
// If no matching entry is found, create a new BackupDetails object and append it to the backup's status details. | |
currentBackupDetails := &backupapi.BackupDetails{ | |
ClusterName: clusterKey.Name, | |
ClusterKind: clusterKey.Kind, | |
BackupNameInCluster: veleroBackup.Name, | |
BackupStatusInCluster: &veleroBackup.Status, | |
} | |
backup.Status.Details = append(backup.Status.Details, currentBackupDetails) | |
} | |
} | |
// Determine whether to requeue the reconciliation based on the completion status of all Velero backup resources. | |
// If all backups are complete, exit directly without requeuing. | |
// Otherwise, requeue the reconciliation after a specified interval (StatusSyncInterval). | |
if allBackupsCompleted(backup.Status) { | |
return ctrl.Result{}, nil | |
} else { | |
return ctrl.Result{RequeueAfter: StatusSyncInterval}, nil | |
} | |
} |
pkg/apis/apps/v1alpha1/types.go
Outdated
@@ -338,6 +352,17 @@ type Metric struct { | |||
ThresholdRange *CanaryThresholdRange `json:"thresholdRange,omitempty"` | |||
} | |||
|
|||
type MetricType string |
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.
From my perspective this is MetricName
Signed-off-by: LiZhenCheng9527 <[email protected]>
Signed-off-by: LiZhenCheng9527 <[email protected]>
0c06748
to
e6c73b4
Compare
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
add rollout status in application api