Skip to content

Commit

Permalink
e2e for service export (knative#739)
Browse files Browse the repository at this point in the history
* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/service_export_import_apply_test.go
  • Loading branch information
itsmurugappan authored and rhuss committed Apr 15, 2020
1 parent c0d2832 commit bda69ba
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 208 deletions.
2 changes: 1 addition & 1 deletion docs/cmd/kn_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kn service [flags]
* [kn service create](kn_service_create.md) - Create a service.
* [kn service delete](kn_service_delete.md) - Delete a service.
* [kn service describe](kn_service_describe.md) - Show details of a service
* [kn service export](kn_service_export.md) - export a service
* [kn service export](kn_service_export.md) - Export a service.
* [kn service list](kn_service_list.md) - List available services.
* [kn service update](kn_service_update.md) - Update a service.

4 changes: 2 additions & 2 deletions docs/cmd/kn_service_export.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## kn service export

export a service
Export a service.

### Synopsis

export a service
Export a service.

```
kn service export NAME [flags]
Expand Down
10 changes: 6 additions & 4 deletions pkg/kn/commands/service/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewServiceExportCommand(p *commands.KnParams) *cobra.Command {

command := &cobra.Command{
Use: "export NAME",
Short: "export a service",
Short: "Export a service.",
Example: `
# Export a service in yaml format
kn service export foo -n bar -o yaml
Expand Down Expand Up @@ -125,7 +125,7 @@ func constructServicefromRevision(latestSvc *servingv1.Service, revision serving
TypeMeta: latestSvc.TypeMeta,
}

exportedSvc.Spec.Template = servingv1.RevisionTemplateSpec{
exportedSvc.Spec.ConfigurationSpec.Template = servingv1.RevisionTemplateSpec{
Spec: revision.Spec,
ObjectMeta: latestSvc.Spec.ConfigurationSpec.Template.ObjectMeta,
}
Expand Down Expand Up @@ -164,8 +164,10 @@ func exportServiceWithActiveRevisions(latestSvc *servingv1.Service, client clien
return nil, fmt.Errorf("no revisions found for service %s", latestSvc.ObjectMeta.Name)
}

//set traffic in the latest revision
exportedSvcItems[len(exportedSvcItems)-1] = setTrafficSplit(latestSvc, exportedSvcItems[len(exportedSvcItems)-1])
//set traffic in the latest revision on if there is traffic split
if len(latestSvc.Spec.RouteSpec.Traffic) > 1 {
exportedSvcItems[len(exportedSvcItems)-1] = setTrafficSplit(latestSvc, exportedSvcItems[len(exportedSvcItems)-1])
}

typeMeta := metav1.TypeMeta{
APIVersion: "v1",
Expand Down
Loading

0 comments on commit bda69ba

Please sign in to comment.