Skip to content

Commit

Permalink
Prefix route with namespace
Browse files Browse the repository at this point in the history
Signed-off-by: João Vilaça <[email protected]>
  • Loading branch information
machadovilaca authored and vladikr committed Nov 20, 2023
1 parent 6c22aa4 commit 7b5136c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
8 changes: 5 additions & 3 deletions frontend/src/app/Workloads/Migrations/Migrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ const Migrations: React.FunctionComponent<VmiMigrationsTableProps> = ({name, nam
const hostnameParts = hostname.split('.');
const ingress = hostnameParts.slice(1).join('.');
const appNameParts = hostnameParts.slice(0, 1)[0].split('-');
let prefix = ""
let suffix = ""
if (appNameParts.length > 1) {
suffix = "-" + appNameParts.slice(1);
prefix = appNameParts[0] + "-";
suffix = "-" + appNameParts.slice(2);
}
const kibanaHostname = "kibana" + suffix + "." + ingress;
const kibanaHostname = prefix + "kibana" + suffix + "." + ingress;

window.open(`http://${kibanaHostname}/app/discover#/?${resp.data.dslQuery}`, '_blank', 'noopener,noreferrer');
return {
query: resp.data.dslQuery,
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/app/Workloads/Pods/Pods.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ const VirtualMachineInstances: React.FunctionComponent = () => {
const hostnameParts = hostname.split('.');
const ingress = hostnameParts.slice(1).join('.');
const appNameParts = hostnameParts.slice(0, 1)[0].split('-');
let prefix = ""
let suffix = ""
if (appNameParts.length > 1) {
suffix = "-" + appNameParts.slice(1);
prefix = appNameParts[0] + "-";
suffix = "-" + appNameParts.slice(2);
}
const kibanaHostname = "kibana" + suffix + "." + ingress;
const kibanaHostname = prefix + "kibana" + suffix + "." + ingress;

window.open(`http://${kibanaHostname}/app/discover#/?${resp.data.dslQuery}`, '_blank', 'noopener,noreferrer');
return {
query: resp.data.dslQuery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ const VirtualMachines: React.FunctionComponent = () => {
const hostnameParts = hostname.split('.');
const ingress = hostnameParts.slice(1).join('.');
const appNameParts = hostnameParts.slice(0, 1)[0].split('-');
let prefix = ""
let suffix = ""
if (appNameParts.length > 1) {
suffix = "-" + appNameParts.slice(1);
prefix = appNameParts[0] + "-";
suffix = "-" + appNameParts.slice(2);
}
const kibanaHostname = "kibana" + suffix + "." + ingress;
const kibanaHostname = prefix + "kibana" + suffix + "." + ingress;

window.open(`http://${kibanaHostname}/app/discover#/?${resp.data.dslQuery}`, '_blank', 'noopener,noreferrer');
return {
query: resp.data.dslQuery,
Expand Down
7 changes: 5 additions & 2 deletions tools/lvctl/pkg/lvctl/resources/elk_pod_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ objects:
metadata:
name: logsviewer-${SUFFIX}
spec:
subdomain: logsviewer-${SUFFIX}
subdomain: ${NAMESPACE}-logsviewer-${SUFFIX}
port:
targetPort: 8080
tls:
Expand All @@ -52,7 +52,7 @@ objects:
metadata:
name: kibana-${SUFFIX}
spec:
subdomain: kibana-${SUFFIX}
subdomain: ${NAMESPACE}-kibana-${SUFFIX}
port:
targetPort: 5601
tls:
Expand Down Expand Up @@ -357,6 +357,9 @@ parameters:
from: '[a-z0-9]{6}'
generate: expression
name: SUFFIX
- description: Namespace to deploy to
value: ''
name: NAMESPACE
- description: Storage class to use
value: ocs-storagecluster-ceph-rbd
name: STORAGE_CLASS
Expand Down
6 changes: 5 additions & 1 deletion tools/lvctl/pkg/lvctl/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (lg *LogsViewer) setup() {
klog.Exit("failed to get route: ", err)
}

klog.Infof("logsViewer %s is available at %s", lg.instanceID, route.Status.Ingress[0].Host)
klog.Infof("logsViewer %s is available at https://%s", lg.instanceID, route.Status.Ingress[0].Host)
klog.Infof("logsViewer %s setup complete", lg.instanceID)
}

Expand All @@ -77,6 +77,10 @@ func (lg *LogsViewer) createTemplateInstance(template *templatev1.Template) (*te
Name: "SUFFIX",
Value: lg.instanceID,
},
{
Name: "NAMESPACE",
Value: lg.namespace,
},
{
Name: "STORAGE_CLASS",
Value: lg.storageClass,
Expand Down

0 comments on commit 7b5136c

Please sign in to comment.