Skip to content

Commit c238f71

Browse files
committed
fix(service): include lastest revision in kn service export
1 parent 1c3b47c commit c238f71

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/commands/service/export.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ func exportLatestService(latestSvc *servingv1.Service, withRoutes bool) *serving
177177

178178
if withRoutes {
179179
exportedSvc.Spec.RouteSpec = latestSvc.Spec.RouteSpec
180+
for i := range exportedSvc.Spec.RouteSpec.Traffic {
181+
if exportedSvc.Spec.RouteSpec.Traffic[i].LatestRevision != nil && *exportedSvc.Spec.RouteSpec.Traffic[i].LatestRevision {
182+
exportedSvc.Spec.RouteSpec.Traffic[i].RevisionName = latestSvc.Status.LatestReadyRevisionName
183+
}
184+
}
180185
}
181186

182187
stripIgnoredAnnotationsFromService(&exportedSvc)

0 commit comments

Comments
 (0)