Skip to content

Commit

Permalink
fix: missing some annotation when restoring from ops
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei committed Sep 6, 2024
1 parent a197e16 commit e66473e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions controllers/dataprotection/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,14 +852,19 @@ func getClusterObjectString(cluster *appsv1alpha1.Cluster) (*string, error) {
newCluster := &appsv1alpha1.Cluster{
Spec: cluster.Spec,
ObjectMeta: metav1.ObjectMeta{
Namespace: cluster.Namespace,
Name: cluster.Name,
Namespace: cluster.Namespace,
Name: cluster.Name,
Annotations: map[string]string{},
},
TypeMeta: cluster.TypeMeta,
}
if v, ok := cluster.Annotations[constant.ExtraEnvAnnotationKey]; ok {
newCluster.Annotations = map[string]string{
constant.ExtraEnvAnnotationKey: v,
removedAnnotations := map[string]sets.Empty{
constant.OpsRequestAnnotationKey: {},
corev1.LastAppliedConfigAnnotation: {},
}
for k, v := range cluster.Annotations {
if _, ok := removedAnnotations[k]; !ok {
newCluster.Annotations[k] = v
}
}
clusterBytes, err := json.Marshal(newCluster)
Expand Down

0 comments on commit e66473e

Please sign in to comment.