Skip to content

Commit

Permalink
check ingress type for site create (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajssmith authored Feb 26, 2021
1 parent 2419a8f commit 938b972
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/router_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ func (cli *VanClient) GetRouterSpecFromOpts(options types.SiteConfigSpec, siteId
func (cli *VanClient) RouterCreate(ctx context.Context, options types.SiteConfig) error {
// todo return error
if options.Spec.IsIngressRoute() && cli.RouteClient == nil {
return fmt.Errorf("Routes client had not been initialized, is this an OCP cluster?")
return fmt.Errorf("OpenShift cluster not detected for --ingress type route")
}

if options.Spec.EnableRouterConsole || options.Spec.EnableConsole {
Expand Down
6 changes: 6 additions & 0 deletions client/site_config_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"context"
"fmt"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -74,6 +75,11 @@ func (cli *VanClient) SiteConfigCreate(ctx context.Context, spec types.SiteConfi
"internal.skupper.io/site-controller-ignore": "true",
}
}

if spec.IsIngressRoute() && cli.RouteClient == nil {
return nil, fmt.Errorf("OpenShift cluster not detected for --ingress type route")
}

actual, err := cli.KubeClient.CoreV1().ConfigMaps(cli.Namespace).Create(siteConfig)
if err != nil {
return nil, err
Expand Down

0 comments on commit 938b972

Please sign in to comment.