-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(netbird): replace backend helm chart with plain manifests
no need for all the patching anymore
- Loading branch information
Showing
18 changed files
with
570 additions
and
20 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
73 changes: 73 additions & 0 deletions
73
k8s/infra/vpn/netbird/management/cm-management-template.yaml
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,73 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: netbird-backend-management | ||
data: | ||
management.tmpl.json: |- | ||
{ | ||
"Stuns": [ | ||
{ | ||
"Proto": "udp", | ||
"URI": "${NETBIRD_STUN_URI}", | ||
"Username": "", | ||
"Password": null | ||
} | ||
], | ||
"TURNConfig": { | ||
"Turns": [ | ||
{ | ||
"Proto": "udp", | ||
"URI": "${NETBIRD_TURN_URI}", | ||
"Username": "${NETBIRD_TURN_USER}", | ||
"Password": "${NETBIRD_TURN_PASSWORD}" | ||
} | ||
], | ||
"CredentialsTTL": "12h", | ||
"Secret": "secret", | ||
"TimeBasedCredentials": false | ||
}, | ||
"Signal": { | ||
"Proto": "${NETBIRD_SIGNAL_PROTOCOL}", | ||
"URI": "${NETBIRD_SIGNAL_URI}", | ||
"Username": "", | ||
"Password": null | ||
}, | ||
"Datadir": "", | ||
"HttpConfig": { | ||
"Address": "0.0.0.0:80", | ||
"AuthAudience": "${NETBIRD_AUTH_AUDIENCE}", | ||
"AuthUserIDClaim": "${NETBIRD_AUTH_USER_ID_CLAIM:-sub}", | ||
"CertFile": "${NETBIRD_MGMT_API_CERT_FILE}", | ||
"CertKey": "${NETBIRD_MGMT_API_CERT_KEY_FILE}", | ||
"OIDCConfigEndpoint": "${NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT}" | ||
}, | ||
"IdpManagerConfig": { | ||
"ManagerType": "${NETBIRD_IDP_MANAGER_TYPE}", | ||
"${NETBIRD_IDP_MANAGER_TYPE^}ClientCredentials": { | ||
"ClientID": "${NETBIRD_IDP_CLIENT_ID}", | ||
"ClientSecret": "${NETBIRD_IDP_CLIENT_SECRET}", | ||
"GrantType": "${NETBIRD_IDP_GRANT_TYPE}", | ||
"Audience": "${NETBIRD_IDP_AUTH0_AUDIENCE}", | ||
"AuthIssuer": "${NETBIRD_IDP_AUTH0_AUTH_ISSUER}", | ||
"AdminEndpoint": "${NETBIRD_IDP_KEYCLOAK_ADMIN_ENDPOINT}", | ||
"TokenEndpoint": "${NETBIRD_IDP_KEYCLOAK_TOKEN_ENDPOINT}" | ||
} | ||
}, | ||
"DeviceAuthorizationFlow": { | ||
"Provider": "${NETBIRD_AUTH_DEVICE_AUTH_PROVIDER}", | ||
"ProviderConfig": { | ||
"Audience": "${NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE}", | ||
"ClientID": "${NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID}", | ||
"DeviceAuthEndpoint": "${NETBIRD_AUTH_DEVICE_AUTH_DEVICE_AUTHORIZATION_ENDPOINT}", | ||
"Domain": "${NETBIRD_AUTH_DEVICE_AUTH_AUTHORITY}", | ||
"TokenEndpoint": "${NETBIRD_AUTH_DEVICE_AUTH_TOKEN_ENDPOINT}", | ||
"Scope": "${NETBIRD_AUTH_DEVICE_AUTH_SCOPE}", | ||
"UseIDToken": "${NETBIRD_AUTH_DEVICE_AUTH_USE_ID_TOKEN:-false}" | ||
} | ||
}, | ||
"Relay": { | ||
"Addresses": ["${NETBIRD_RELAY_URI}"], | ||
"CredentialsTTL": "24h", | ||
"Secret": "${NETBIRD_RELAY_SECRET}" | ||
} | ||
} |
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,46 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: check-oidc-keys | ||
data: | ||
check-oidc-keys.sh: |- | ||
#!/bin/bash | ||
OIDC_ENDPOINT=$(jq -r '.HttpConfig.OIDCConfigEndpoint' /etc/netbird/management.json) | ||
CHECK_INTERVAL="${CHECK_INTERVAL:-3600}" | ||
KEYS_FILE="/data/oidc_keys.json" | ||
fetch_keys() { | ||
config=$(curl -s "$OIDC_ENDPOINT") | ||
jwks_uri=$(echo "$config" | jq -r '.jwks_uri') | ||
curl -s "$jwks_uri" | ||
} | ||
keys_changed() { | ||
local new_keys="$1" | ||
if [ ! -f "$KEYS_FILE" ]; then | ||
return 0 | ||
fi | ||
local old_keys=$(cat "$KEYS_FILE") | ||
[ "$new_keys" != "$old_keys" ] | ||
} | ||
restart_pod() { | ||
echo "Restarting pod..." | ||
kill 1 | ||
} | ||
while true; do | ||
echo "Fetching OIDC keys..." | ||
new_keys=$(fetch_keys) | ||
if keys_changed "$new_keys"; then | ||
echo "Keys have changed. Updating stored keys..." | ||
echo "$new_keys" > "$KEYS_FILE" | ||
restart_pod | ||
else | ||
echo "Keys have not changed. No action required." | ||
fi | ||
echo "Sleeping for $CHECK_INTERVAL seconds..." | ||
sleep "$CHECK_INTERVAL" | ||
done |
40 changes: 40 additions & 0 deletions
40
k8s/infra/vpn/netbird/management/config/check-oidc-keys.sh
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,40 @@ | ||
#!/bin/bash | ||
OIDC_ENDPOINT=$(jq -r '.HttpConfig.OIDCConfigEndpoint' /etc/netbird/management.json) | ||
CHECK_INTERVAL="${CHECK_INTERVAL:-3600}" | ||
KEYS_FILE="/data/oidc_keys.json" | ||
|
||
fetch_keys() { | ||
config=$(curl -s "$OIDC_ENDPOINT") | ||
jwks_uri=$(echo "$config" | jq -r '.jwks_uri') | ||
curl -s "$jwks_uri" | ||
} | ||
|
||
keys_changed() { | ||
local new_keys="$1" | ||
if [ ! -f "$KEYS_FILE" ]; then | ||
return 0 | ||
fi | ||
local old_keys=$(cat "$KEYS_FILE") | ||
[ "$new_keys" != "$old_keys" ] | ||
} | ||
|
||
restart_pod() { | ||
echo "Restarting pod..." | ||
kill 1 | ||
} | ||
|
||
while true; do | ||
echo "Fetching OIDC keys..." | ||
new_keys=$(fetch_keys) | ||
|
||
if keys_changed "$new_keys"; then | ||
echo "Keys have changed. Updating stored keys..." | ||
echo "$new_keys" > "$KEYS_FILE" | ||
restart_pod | ||
else | ||
echo "Keys have not changed. No action required." | ||
fi | ||
|
||
echo "Sleeping for $CHECK_INTERVAL seconds..." | ||
sleep "$CHECK_INTERVAL" | ||
done |
67 changes: 67 additions & 0 deletions
67
k8s/infra/vpn/netbird/management/config/management.tmpl.json
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,67 @@ | ||
{ | ||
"Stuns": [ | ||
{ | ||
"Proto": "udp", | ||
"URI": "${NETBIRD_STUN_URI}", | ||
"Username": "", | ||
"Password": null | ||
} | ||
], | ||
"TURNConfig": { | ||
"Turns": [ | ||
{ | ||
"Proto": "udp", | ||
"URI": "${NETBIRD_TURN_URI}", | ||
"Username": "${NETBIRD_TURN_USER}", | ||
"Password": "${NETBIRD_TURN_PASSWORD}" | ||
} | ||
], | ||
"CredentialsTTL": "12h", | ||
"Secret": "secret", | ||
"TimeBasedCredentials": false | ||
}, | ||
"Signal": { | ||
"Proto": "${NETBIRD_SIGNAL_PROTOCOL}", | ||
"URI": "${NETBIRD_SIGNAL_URI}", | ||
"Username": "", | ||
"Password": null | ||
}, | ||
"Datadir": "", | ||
"HttpConfig": { | ||
"Address": "0.0.0.0:80", | ||
"AuthAudience": "${NETBIRD_AUTH_AUDIENCE}", | ||
"AuthUserIDClaim": "${NETBIRD_AUTH_USER_ID_CLAIM:-sub}", | ||
"CertFile": "${NETBIRD_MGMT_API_CERT_FILE}", | ||
"CertKey": "${NETBIRD_MGMT_API_CERT_KEY_FILE}", | ||
"OIDCConfigEndpoint": "${NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT}" | ||
}, | ||
"IdpManagerConfig": { | ||
"ManagerType": "${NETBIRD_IDP_MANAGER_TYPE}", | ||
"${NETBIRD_IDP_MANAGER_TYPE^}ClientCredentials": { | ||
"ClientID": "${NETBIRD_IDP_CLIENT_ID}", | ||
"ClientSecret": "${NETBIRD_IDP_CLIENT_SECRET}", | ||
"GrantType": "${NETBIRD_IDP_GRANT_TYPE}", | ||
"Audience": "${NETBIRD_IDP_AUTH0_AUDIENCE}", | ||
"AuthIssuer": "${NETBIRD_IDP_AUTH0_AUTH_ISSUER}", | ||
"AdminEndpoint": "${NETBIRD_IDP_KEYCLOAK_ADMIN_ENDPOINT}", | ||
"TokenEndpoint": "${NETBIRD_IDP_KEYCLOAK_TOKEN_ENDPOINT}" | ||
} | ||
}, | ||
"DeviceAuthorizationFlow": { | ||
"Provider": "${NETBIRD_AUTH_DEVICE_AUTH_PROVIDER}", | ||
"ProviderConfig": { | ||
"Audience": "${NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE}", | ||
"ClientID": "${NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID}", | ||
"DeviceAuthEndpoint": "${NETBIRD_AUTH_DEVICE_AUTH_DEVICE_AUTHORIZATION_ENDPOINT}", | ||
"Domain": "${NETBIRD_AUTH_DEVICE_AUTH_AUTHORITY}", | ||
"TokenEndpoint": "${NETBIRD_AUTH_DEVICE_AUTH_TOKEN_ENDPOINT}", | ||
"Scope": "${NETBIRD_AUTH_DEVICE_AUTH_SCOPE}", | ||
"UseIDToken": "${NETBIRD_AUTH_DEVICE_AUTH_USE_ID_TOKEN:-false}" | ||
} | ||
}, | ||
"Relay": { | ||
"Addresses": ["${NETBIRD_RELAY_URI}"], | ||
"CredentialsTTL": "24h", | ||
"Secret": "${NETBIRD_RELAY_SECRET}" | ||
} | ||
} |
Oops, something went wrong.