Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update virtual services #8

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func virtualServiceName(kfName string, namespace string) string {
func generateVirtualService(instance *v1beta1.Notebook) (*unstructured.Unstructured, error) {
name := instance.Name
namespace := instance.Namespace
clusterDomain := "cluster.local"
// clusterDomain := "cluster.local"
prefix := fmt.Sprintf("/notebook/%s/%s/", namespace, name)

// unpack annotations from Notebook resource
Expand All @@ -486,10 +486,11 @@ func generateVirtualService(instance *v1beta1.Notebook) (*unstructured.Unstructu
rewrite = annotations[AnnotationRewriteURI]
}

if clusterDomainFromEnv, ok := os.LookupEnv("CLUSTER_DOMAIN"); ok {
clusterDomain = clusterDomainFromEnv
}
service := fmt.Sprintf("%s.%s.svc.%s", name, namespace, clusterDomain)
// if clusterDomainFromEnv, ok := os.LookupEnv("CLUSTER_DOMAIN"); ok {
// clusterDomain = clusterDomainFromEnv
// }
// service := fmt.Sprintf("%s.%s.svc.%s", name, namespace, clusterDomain)
service := fmt.Sprintf("%s", name)

vsvc := &unstructured.Unstructured{}
vsvc.SetAPIVersion("networking.istio.io/v1alpha3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ func generateService(tb *tensorboardv1alpha1.Tensorboard) *corev1.Service {
func generateVirtualService(tb *tensorboardv1alpha1.Tensorboard) (*unstructured.Unstructured, error) {
prefix := fmt.Sprintf("/tensorboard/%s/%s/", tb.Namespace, tb.Name)
rewrite := "/"
service := fmt.Sprintf("%s.%s.svc.cluster.local", tb.Name, tb.Namespace)
// service := fmt.Sprintf("%s.%s.svc.cluster.local", tb.Name, tb.Namespace)
service := fmt.Sprintf("%s", tb.Name)
istioGateway, err := getEnvVariable("ISTIO_GATEWAY")
if err != nil {
return nil, err
Expand Down Expand Up @@ -410,8 +411,8 @@ func extractPVCSubPath(path string) string {
}
}

//Searches a corev1.PodList for running pods and returns
//a running corev1.Pod (if exists)
// Searches a corev1.PodList for running pods and returns
// a running corev1.Pod (if exists)
func findRunningPod(pods *corev1.PodList) corev1.Pod {
for _, pod := range pods.Items {
if pod.Status.Phase == "Running" {
Expand Down Expand Up @@ -471,9 +472,9 @@ func generateNodeAffinity(affinity *corev1.Affinity, pvcname string, r *Tensorbo
return nil
}

//Checks the value of 'RWO_PVC_SCHEDULING' env var (if present in the environment) and returns
//'true' or 'false' accordingly. If 'RWO_PVC_SCHEDULING' is NOT present, then the value of the
//returned boolean is set to 'false', so that the scheduling functionality is off by default.
// Checks the value of 'RWO_PVC_SCHEDULING' env var (if present in the environment) and returns
// 'true' or 'false' accordingly. If 'RWO_PVC_SCHEDULING' is NOT present, then the value of the
// returned boolean is set to 'false', so that the scheduling functionality is off by default.
func rwoPVCScheduling() (error, bool) {
if value, exists := os.LookupEnv("RWO_PVC_SCHEDULING"); !exists || value == "false" || value == "False" || value == "FALSE" {
return nil, false
Expand Down
Loading