Skip to content

Commit

Permalink
fix: missing svc related feature gates in backup (#7388)
Browse files Browse the repository at this point in the history
Co-authored-by: wusai80 <[email protected]>
  • Loading branch information
shanshanying and wusai80 authored May 20, 2024
1 parent 03e4f29 commit d3d3d75
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions controllers/dataprotection/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,16 @@ func getClusterObjectString(cluster *appsv1alpha1.Cluster) (*string, error) {
constant.ExtraEnvAnnotationKey: v,
}
}

for _, key := range getServiceFeatureGatesAnnotationKeys() {
if v, ok := cluster.Annotations[key]; ok {
if newCluster.Annotations == nil {
newCluster.Annotations = map[string]string{}
}
newCluster.Annotations[key] = v
}
}

clusterBytes, err := json.Marshal(newCluster)
if err != nil {
return nil, err
Expand All @@ -733,3 +743,13 @@ func setClusterSnapshotAnnotation(backup *dpv1alpha1.Backup, cluster *appsv1alph
backup.Annotations[constant.ClusterSnapshotAnnotationKey] = *clusterString
return nil
}

// getServiceFeatureGatesAnnotationKeys returns the keys of the annotations that are used to enable or disable certain service features.
func getServiceFeatureGatesAnnotationKeys() []string {
return []string{
constant.EnabledNodePortSvcAnnotationKey,
constant.EnabledPodOrdinalSvcAnnotationKey,
constant.DisabledClusterIPSvcAnnotationKey,
constant.ShardSvcAnnotationKey,
}
}

0 comments on commit d3d3d75

Please sign in to comment.