MCPcopy Index your code
hub / github.com/cloudtty/cloudtty / SetRouteRulePath

Function SetRouteRulePath

pkg/controllers/cloudshell_controller.go:1005–1021  ·  view source on GitHub ↗

SetRouteRulePath return access url according to cloudshell.

(cloudshell *cloudshellv1alpha1.CloudShell)

Source from the content-addressed store, hash-verified

1003
1004// SetRouteRulePath return access url according to cloudshell.
1005func 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.
1024func IngressNamespacedName(cloudshell *cloudshellv1alpha1.CloudShell) types.NamespacedName {

Callers 4

CreateRouteRuleMethod · 0.85
removeCloudshellRouteMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected