mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-18 08:58:30 +00:00
Add option to force namespace
This commit is contained in:
parent
0e58d6e9d3
commit
ccba0d90ca
@ -34,6 +34,9 @@ import os from 'os';
|
||||
|
||||
export function svcName(svc, protocol) {
|
||||
let env = process.env['BYC_ENV'];
|
||||
if (!env) {
|
||||
env = 'dev';
|
||||
}
|
||||
return `${svc}-${protocol}-${env}-service`;
|
||||
}
|
||||
|
||||
@ -42,6 +45,10 @@ export function svcNameHttp(svc) {
|
||||
}
|
||||
|
||||
export function endpoint(generatedServiceName, ns, port) {
|
||||
const forceNs = process.env['BYC_FORCE_NS'];
|
||||
if (forceNs) {
|
||||
ns = forceNs;
|
||||
}
|
||||
return `${generatedServiceName}.${ns}.svc.cluster.local${port}`;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,9 @@ func SvcNameGrpc(svc string) string {
|
||||
}
|
||||
|
||||
func Endpoint(svcName string, ns string, port string) string {
|
||||
if forceNs := os.Getenv("BYC_FORCE_NS"); forceNs != "" {
|
||||
ns = forceNs
|
||||
}
|
||||
return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user