SetRouteRulePath return access url according to cloudshell.
(cloudshell *cloudshellv1alpha1.CloudShell)
| 1003 | |
| 1004 | // SetRouteRulePath return access url according to cloudshell. |
| 1005 | func SetRouteRulePath(cloudshell *cloudshellv1alpha1.CloudShell) string { |
| 1006 | var pathPrefix string |
| 1007 | if len(cloudshell.Spec.PathPrefix) != 0 { |
| 1008 | pathPrefix = cloudshell.Spec.PathPrefix |
| 1009 | } |
| 1010 | |
| 1011 | if strings.HasSuffix(pathPrefix, "/") { |
| 1012 | pathPrefix = pathPrefix[:len(pathPrefix)-1] + constants.DefaultPathPrefix |
| 1013 | } else { |
| 1014 | pathPrefix += constants.DefaultPathPrefix |
| 1015 | } |
| 1016 | |
| 1017 | if len(cloudshell.Spec.PathSuffix) > 0 { |
| 1018 | return fmt.Sprintf("%s/%s/%s", pathPrefix, cloudshell.Name, cloudshell.Spec.PathSuffix) |
| 1019 | } |
| 1020 | return fmt.Sprintf("%s/%s", pathPrefix, cloudshell.Name) |
| 1021 | } |
| 1022 | |
| 1023 | // IngressNamespacedName return a namespacedName according to ingressConfig. |
| 1024 | func IngressNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName { |
no outgoing calls
no test coverage detected