Attempting to fix namespace issue
All checks were successful
Build and deploy Bridgeman Accessible Hashicorp Vault Implementation / deploy (push) Successful in 16s
All checks were successful
Build and deploy Bridgeman Accessible Hashicorp Vault Implementation / deploy (push) Successful in 16s
This commit is contained in:
parent
04c850dfb1
commit
7550edb1bc
1 changed files with 10 additions and 1 deletions
|
|
@ -10,7 +10,16 @@ class KubernetesSecretsManager:
|
||||||
self.api_instance = client.CoreV1Api()
|
self.api_instance = client.CoreV1Api()
|
||||||
|
|
||||||
# Read namespace from standard K8s environment variable, default to 'default'
|
# Read namespace from standard K8s environment variable, default to 'default'
|
||||||
self.namespace = os.environ.get('POD_NAMESPACE', 'default')
|
#self.namespace = os.environ.get('POD_NAMESPACE', 'default')
|
||||||
|
self.namespace = self.get_current_namespace()
|
||||||
|
|
||||||
|
def get_current_namespace():
|
||||||
|
try:
|
||||||
|
with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f:
|
||||||
|
return f.read().strip()
|
||||||
|
except Exception:
|
||||||
|
# Fallback for local testing
|
||||||
|
return "default"
|
||||||
|
|
||||||
def publish_unseal_keys_credentials(self, secret_name: str, unseal_keys: list):
|
def publish_unseal_keys_credentials(self, secret_name: str, unseal_keys: list):
|
||||||
"""Publish the unseal keys as a Kubernetes Secret
|
"""Publish the unseal keys as a Kubernetes Secret
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue