This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code optimizations & CiliumNetworkPolicy Support
- Loading branch information
Showing
17 changed files
with
145 additions
and
126 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ owners: | |
|
||
ignore: | ||
- name: bwsm-eso-provider | ||
version: beta* | ||
version: *-beta |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,50 @@ | ||
{{- if .Values.bwsm_eso_provider.network_policy.enabled }} | ||
{{- if and .Values.bwsm_eso_provider.network_policy.enabled (not .Values.bwsm_eso_provider.network_policy.cilium) }} | ||
--- | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
name: external-secrets-operator-ns-to-{{ .Release.Name }}-policy | ||
name: eso-ns-to-{{ .Release.Name }}-policy | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/name: {{ .Release.Name }} | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
- namespaceSelector: | ||
matchExpressions: | ||
- key: namespace | ||
operator: In | ||
values: | ||
- {{ .Values.bwsm_eso_provider.eso_namespace }} | ||
ports: | ||
- port: 8080 | ||
egress: | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
{{ toYaml .Values.bwsm_eso_provider.network_policy.labels | indent 2 }} | ||
{{- end }} | ||
{{- if and .Values.bwsm_eso_provider.network_policy.enabled .Values.bwsm_eso_provider.network_policy.cilium }} | ||
--- | ||
apiVersion: cilium.io/v2 | ||
kind: CiliumNetworkPolicy | ||
metadata: | ||
name: eso-ns-to-{{ .Release.Name }}-policy | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
endpointSelector: {} | ||
ingress: | ||
- fromEndpoints: | ||
- matchLabels: | ||
io.kubernetes.pod.namespace: {{ .Values.bwsm_eso_provider.eso_namespace }} | ||
toPorts: | ||
- ports: | ||
- port: "8080" | ||
egress: | ||
- toEndpoints: | ||
- matchLabels: | ||
{{ toYaml .Values.bwsm_eso_provider.network_policy.labels | indent 2 }} | ||
|
||
{{- end }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import * as service from '../services/bwsService.js'; | ||
|
||
export function getById(req, res, next) { | ||
export async function getById(req, res, next) { | ||
service.getById(req, res); | ||
}; |
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,27 +1,39 @@ | ||
import server from "./server.js"; | ||
|
||
const env = process.env.NODE_ENV ? process.env.NODE_ENV : "production"; | ||
const env = process.env.NODE_ENV || "production"; // Use a default value if NODE_ENV is not set | ||
|
||
server.deploy(env).catch((err) => { | ||
console.log(err); | ||
}); | ||
// Start the server | ||
async function startServer() { | ||
try { | ||
await server.deploy(env); | ||
console.log(`Server deployed successfully in ${env} mode.`); | ||
} catch (error) { | ||
console.error(`Error deploying server: ${error}`); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
startServer(); | ||
|
||
// quit on ctrl-c when running docker in terminal | ||
process.on("SIGINT", function onSigint() { | ||
console.log( | ||
`[${new Date().toISOString()}] Got SIGINT (aka ctrl-c in docker). Graceful shutdown` | ||
); | ||
shutdown(); | ||
// Graceful shutdown on SIGINT (Ctrl+C) or SIGTERM (docker container stop) | ||
process.on("SIGINT", () => { | ||
console.log(`[${new Date().toISOString()}] Got SIGINT (Ctrl+C). Graceful shutdown.`); | ||
shutdown(); | ||
}); | ||
|
||
// quit properly on docker stop | ||
process.on("SIGTERM", function onSigterm() { | ||
console.log( | ||
`[${new Date().toISOString()}] Got SIGTERM (docker container stop). Graceful shutdown` | ||
); | ||
shutdown(); | ||
process.on("SIGTERM", () => { | ||
console.log(`[${new Date().toISOString()}] Got SIGTERM (docker container stop). Graceful shutdown.`); | ||
shutdown(); | ||
}); | ||
|
||
const shutdown = () => { | ||
server.undeploy(); | ||
}; | ||
// Function to gracefully shutdown the server | ||
async function shutdown() { | ||
try { | ||
server.undeploy(); | ||
console.log("Server shutdown completed."); | ||
process.exit(0); | ||
} catch (error) { | ||
console.error(`Error during server shutdown: ${error}`); | ||
process.exit(1); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.