-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/javascript/jsdom-21.1.2
- Loading branch information
Showing
11 changed files
with
1,307 additions
and
223 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
javascript/packages/orchestrator/src/providers/k8s/resources/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { BootNodeResource } from "./bootnodeResource"; | ||
export { BootNodeResource } from "./bootNodeResource"; | ||
export { NodeResource } from "./nodeResource"; | ||
export { ServiceResource } from "./serviceResource"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
javascript/packages/orchestrator/src/providers/k8s/resources/serviceResource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { | ||
JAEGER_AGENT_SERVE_CONFIGS_PORT, | ||
JAEGER_AGENT_THRIFT_BINARY_PORT, | ||
JAEGER_AGENT_THRIFT_COMPACT_PORT, | ||
JAEGER_AGENT_ZIPKIN_COMPACT_PORT, | ||
P2P_PORT, | ||
PROMETHEUS_PORT, | ||
RPC_HTTP_PORT, | ||
RPC_WS_PORT, | ||
} from "../../../constants"; | ||
import { PodSpec, ServiceSpec } from "./types"; | ||
|
||
export class ServiceResource { | ||
constructor(private readonly podSpec: PodSpec) {} | ||
|
||
public generateSpec() { | ||
const ports = this.generatePorts(); | ||
const name = this.podSpec.metadata.name; | ||
|
||
return this.generateServiceSpec(name, ports); | ||
} | ||
|
||
private shouldExposeJaegerPorts(): boolean { | ||
return this.podSpec.spec.containers.some( | ||
(container) => container.name === "jaeger-agent", | ||
); | ||
} | ||
|
||
private generatePorts(): ServiceSpec["spec"]["ports"] { | ||
let ports: ServiceSpec["spec"]["ports"] = [ | ||
{ | ||
name: "prometheus", | ||
protocol: "TCP", | ||
port: PROMETHEUS_PORT, | ||
targetPort: PROMETHEUS_PORT, | ||
}, | ||
{ | ||
name: "rpc-http", | ||
protocol: "TCP", | ||
port: RPC_HTTP_PORT, | ||
targetPort: RPC_HTTP_PORT, | ||
}, | ||
{ | ||
name: "rpc-ws", | ||
protocol: "TCP", | ||
port: RPC_WS_PORT, | ||
targetPort: RPC_WS_PORT, | ||
}, | ||
{ | ||
name: "p2p", | ||
protocol: "TCP", | ||
port: P2P_PORT, | ||
targetPort: P2P_PORT, | ||
}, | ||
]; | ||
|
||
if (this.shouldExposeJaegerPorts()) { | ||
ports = ports.concat([ | ||
{ | ||
name: "jaeger-agent-zipkin-compact", | ||
protocol: "UDP", | ||
port: JAEGER_AGENT_ZIPKIN_COMPACT_PORT, | ||
targetPort: JAEGER_AGENT_ZIPKIN_COMPACT_PORT, | ||
}, | ||
{ | ||
name: "jaeger-agent-serve-configs", | ||
protocol: "TCP", | ||
port: JAEGER_AGENT_SERVE_CONFIGS_PORT, | ||
targetPort: JAEGER_AGENT_SERVE_CONFIGS_PORT, | ||
}, | ||
{ | ||
name: "jaeger-agent-thrift-compact", | ||
protocol: "UDP", | ||
port: JAEGER_AGENT_THRIFT_COMPACT_PORT, | ||
targetPort: JAEGER_AGENT_THRIFT_COMPACT_PORT, | ||
}, | ||
{ | ||
name: "jaeger-agent-thrift-binary", | ||
protocol: "UDP", | ||
port: JAEGER_AGENT_THRIFT_BINARY_PORT, | ||
targetPort: JAEGER_AGENT_THRIFT_BINARY_PORT, | ||
}, | ||
]); | ||
} | ||
|
||
return ports; | ||
} | ||
|
||
private generateServiceSpec( | ||
name: string, | ||
ports: ServiceSpec["spec"]["ports"], | ||
): ServiceSpec { | ||
return { | ||
apiVersion: "v1", | ||
kind: "Service", | ||
metadata: { name }, | ||
spec: { | ||
selector: { "app.kubernetes.io/instance": name }, | ||
ports, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters