Read all env vars from pod spec instead of static allowlist
- Remove INHERITED_ENV_KEYS; read directly from mainContainer.env - Any Deployment env var is now forwarded automatically to Job pods - Layer ordering preserved: pod spec → paperclip vars → agent config env Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@farhoodliquor/paperclip-adapter-opencode-k8s",
|
"name": "@farhoodliquor/paperclip-adapter-opencode-k8s",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Paperclip adapter plugin that runs OpenCode agents as Kubernetes Jobs",
|
"description": "Paperclip adapter plugin that runs OpenCode agents as Kubernetes Jobs",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -20,20 +20,10 @@ export interface SelfPodInfo {
|
|||||||
dnsConfig: k8s.V1PodDNSConfig | undefined;
|
dnsConfig: k8s.V1PodDNSConfig | undefined;
|
||||||
pvcClaimName: string | null;
|
pvcClaimName: string | null;
|
||||||
secretVolumes: SelfPodSecretVolume[];
|
secretVolumes: SelfPodSecretVolume[];
|
||||||
/** Env vars inherited from the Deployment container. */
|
/** Env vars read directly from the pod spec's container definition. */
|
||||||
inheritedEnv: Record<string, string>;
|
inheritedEnv: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Keys forwarded from the Deployment container env into Job pods. */
|
|
||||||
const INHERITED_ENV_KEYS = [
|
|
||||||
"CLAUDE_CODE_USE_BEDROCK",
|
|
||||||
"AWS_REGION",
|
|
||||||
"AWS_BEARER_TOKEN_BEDROCK",
|
|
||||||
"ANTHROPIC_API_KEY",
|
|
||||||
"OPENAI_API_KEY",
|
|
||||||
"PAPERCLIP_API_URL",
|
|
||||||
];
|
|
||||||
|
|
||||||
let cachedSelfPod: SelfPodInfo | null = null;
|
let cachedSelfPod: SelfPodInfo | null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,13 +131,12 @@ export async function getSelfPodInfo(kubeconfigPath?: string): Promise<SelfPodIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect inherited env vars from process.env (these came from the Deployment spec)
|
// Collect all env vars directly from the pod spec container definition.
|
||||||
|
// This gives the authoritative env the container was configured with in K8s —
|
||||||
|
// no static allowlist needed; any env var from the Deployment is forwarded.
|
||||||
const inheritedEnv: Record<string, string> = {};
|
const inheritedEnv: Record<string, string> = {};
|
||||||
for (const key of INHERITED_ENV_KEYS) {
|
for (const envVar of mainContainer.env ?? []) {
|
||||||
const value = process.env[key];
|
if (envVar.value) inheritedEnv[envVar.name] = envVar.value;
|
||||||
if (value !== undefined) {
|
|
||||||
inheritedEnv[key] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cachedSelfPod = {
|
cachedSelfPod = {
|
||||||
|
|||||||
Reference in New Issue
Block a user