fix: Configure webhook handler to use in-cluster service account

- Remove kubeconfig file mounting to use in-cluster service account
- Remove Docker socket mount (not needed for Knative deployments)
- Fix Kubernetes API connectivity issues
- Webhook deployment now working successfully with proper RBAC
This commit is contained in:
Greg
2025-07-01 12:11:50 -07:00
parent 6f57651f92
commit 524f44b023
2 changed files with 7 additions and 19 deletions

View File

@@ -38,8 +38,13 @@ def verify_signature(payload, signature):
def run_command(cmd, **kwargs):
"""Run shell command with logging"""
logger.info(f"Running command: {' '.join(cmd)}")
# Set up environment for kubectl to use in-cluster config
env = os.environ.copy()
env['KUBECONFIG'] = '' # Force kubectl to use in-cluster config
try:
result = subprocess.run(cmd, check=True, capture_output=True, text=True, **kwargs)
result = subprocess.run(cmd, check=True, capture_output=True, text=True, env=env, **kwargs)
logger.info(f"Command output: {result.stdout}")
return result
except subprocess.CalledProcessError as e: