typekro 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/alchemy/deployers.d.ts +2 -2
- package/dist/alchemy/deployers.d.ts.map +1 -1
- package/dist/alchemy/deployers.js +12 -5
- package/dist/alchemy/deployers.js.map +1 -1
- package/dist/alchemy/index.d.ts +4 -2
- package/dist/alchemy/index.d.ts.map +1 -1
- package/dist/alchemy/index.js +4 -3
- package/dist/alchemy/index.js.map +1 -1
- package/dist/alchemy/resource-registration.d.ts +81 -19
- package/dist/alchemy/resource-registration.d.ts.map +1 -1
- package/dist/alchemy/resource-registration.js +296 -147
- package/dist/alchemy/resource-registration.js.map +1 -1
- package/dist/alchemy/types.d.ts +76 -8
- package/dist/alchemy/types.d.ts.map +1 -1
- package/dist/alchemy/wrapper.d.ts +0 -9
- package/dist/alchemy/wrapper.d.ts.map +1 -1
- package/dist/alchemy/wrapper.js +0 -15
- package/dist/alchemy/wrapper.js.map +1 -1
- package/dist/core/deployment/direct-factory.d.ts +14 -2
- package/dist/core/deployment/direct-factory.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.js +117 -14
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/engine.d.ts +8 -5
- package/dist/core/deployment/engine.d.ts.map +1 -1
- package/dist/core/deployment/engine.js +36 -12
- package/dist/core/deployment/engine.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts +35 -9
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +132 -150
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/deployment/shared-utilities.d.ts +15 -4
- package/dist/core/deployment/shared-utilities.d.ts.map +1 -1
- package/dist/core/deployment/shared-utilities.js +47 -14
- package/dist/core/deployment/shared-utilities.js.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.js +1 -2
- package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
- package/dist/core/deployment/strategies/index.d.ts +0 -1
- package/dist/core/deployment/strategies/index.d.ts.map +1 -1
- package/dist/core/deployment/strategies/index.js +0 -1
- package/dist/core/deployment/strategies/index.js.map +1 -1
- package/dist/core/types/deployment.d.ts +28 -42
- package/dist/core/types/deployment.d.ts.map +1 -1
- package/dist/core/types/resource-graph.d.ts +2 -6
- package/dist/core/types/resource-graph.d.ts.map +1 -1
- package/dist/core/types/schema.d.ts +0 -1
- package/dist/core/types/schema.d.ts.map +1 -1
- package/dist/core/types/serialization.d.ts +3 -7
- package/dist/core/types/serialization.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-directory.js +2 -13
- package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.js +2 -18
- package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
- package/package.json +6 -3
- package/dist/alchemy/deployment.d.ts +0 -12
- package/dist/alchemy/deployment.d.ts.map +0 -1
- package/dist/alchemy/deployment.js +0 -12
- package/dist/alchemy/deployment.js.map +0 -1
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts +0 -109
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts.map +0 -1
- package/dist/core/deployment/strategies/alchemy-strategy.js +0 -556
- package/dist/core/deployment/strategies/alchemy-strategy.js.map +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alchemy Deployment Strategy
|
|
3
|
-
*
|
|
4
|
-
* This module provides the alchemy deployment strategy that wraps deployments
|
|
5
|
-
* in alchemy resources with individual resource registration.
|
|
6
|
-
*/
|
|
7
|
-
import type { DeploymentResult, FactoryOptions } from '../../types/deployment.js';
|
|
8
|
-
import type { KubernetesResource } from '../../types/kubernetes.js';
|
|
9
|
-
import type { KroCompatibleType, SchemaDefinition, Scope, StatusBuilder } from '../../types/serialization.js';
|
|
10
|
-
import { BaseDeploymentStrategy, type DeploymentStrategy } from './base-strategy.js';
|
|
11
|
-
/**
|
|
12
|
-
* Alchemy deployment strategy - wraps deployments in alchemy resources with individual resource registration
|
|
13
|
-
*
|
|
14
|
-
* This strategy implements individual resource registration for Direct mode Alchemy integration.
|
|
15
|
-
* Unlike Kro mode which registers RGDs and instances, Direct mode registers each individual
|
|
16
|
-
* Kubernetes resource (Deployment, Service, ConfigMap, etc.) as separate Alchemy resource types.
|
|
17
|
-
*
|
|
18
|
-
* ## Resource Registration Pattern
|
|
19
|
-
*
|
|
20
|
-
* **Direct Mode (this strategy):**
|
|
21
|
-
* - Each individual Kubernetes resource gets its own Alchemy resource type registration
|
|
22
|
-
* - Resource types are named using the pattern `kubernetes::{Kind}` (e.g., `kubernetes::Deployment`)
|
|
23
|
-
* - Each instance of each resource gets a separate Alchemy resource registered
|
|
24
|
-
* - Example: A webapp with Deployment + Service creates 2 Alchemy resource types and 2 resource instances
|
|
25
|
-
*
|
|
26
|
-
* **Kro Mode (for comparison):**
|
|
27
|
-
* - Each RGD gets one Alchemy resource type registered (`kro::ResourceGraphDefinition`)
|
|
28
|
-
* - Each instance of each RGD gets a separate Alchemy resource registered (`kro::{Kind}`)
|
|
29
|
-
* - Example: A webapp RGD creates 1 RGD type + 1 instance type = 2 Alchemy resources total
|
|
30
|
-
*
|
|
31
|
-
* ## Error Handling
|
|
32
|
-
*
|
|
33
|
-
* The strategy implements robust error handling for individual resource failures:
|
|
34
|
-
* - Continues processing remaining resources when individual resources fail
|
|
35
|
-
* - Collects all errors and includes them in the final DeploymentResult
|
|
36
|
-
* - Sets deployment status to 'partial' when some resources succeed and others fail
|
|
37
|
-
* - Provides resource-specific error context including kind, name, namespace, and Alchemy resource type
|
|
38
|
-
*
|
|
39
|
-
* ## Integration with DirectTypeKroDeployer
|
|
40
|
-
*
|
|
41
|
-
* This strategy integrates with DirectTypeKroDeployer for actual resource deployment:
|
|
42
|
-
* - Extracts DirectDeploymentEngine from the base DirectDeploymentStrategy
|
|
43
|
-
* - Creates DirectTypeKroDeployer instance for individual resource deployments
|
|
44
|
-
* - Passes deployer to each Alchemy resource provider for deployment execution
|
|
45
|
-
*
|
|
46
|
-
* @template TSpec - The specification type for the resource
|
|
47
|
-
* @template TStatus - The status type for the resource
|
|
48
|
-
*/
|
|
49
|
-
export declare class AlchemyDeploymentStrategy<TSpec extends KroCompatibleType, TStatus extends KroCompatibleType> extends BaseDeploymentStrategy<TSpec, TStatus> {
|
|
50
|
-
private alchemyScope;
|
|
51
|
-
private baseStrategy;
|
|
52
|
-
protected readonly alchemyLogger: import("../../logging/types.js").TypeKroLogger;
|
|
53
|
-
constructor(factoryName: string, namespace: string, schemaDefinition: SchemaDefinition<TSpec, TStatus>, statusBuilder: StatusBuilder<TSpec, TStatus, any> | undefined, resourceKeys: Record<string, KubernetesResource> | undefined, factoryOptions: FactoryOptions, alchemyScope: Scope, baseStrategy: DeploymentStrategy<TSpec, TStatus>);
|
|
54
|
-
/**
|
|
55
|
-
* Execute deployment with individual resource registration for Alchemy integration
|
|
56
|
-
*
|
|
57
|
-
* This method implements the core logic for Direct mode Alchemy integration:
|
|
58
|
-
*
|
|
59
|
-
* ## Process Overview
|
|
60
|
-
* 1. **Validation**: Validates the Alchemy scope is available and properly configured
|
|
61
|
-
* 2. **Resource Graph Creation**: Gets the resource graph from the base strategy using createResourceGraphForInstance
|
|
62
|
-
* 3. **Deployer Setup**: Creates DirectTypeKroDeployer instance using DirectDeploymentEngine from base strategy
|
|
63
|
-
* 4. **Individual Registration**: Processes each resource in the resource graph individually for Alchemy registration
|
|
64
|
-
* 5. **Error Collection**: Continues processing remaining resources when individual resources fail
|
|
65
|
-
* 6. **Result Creation**: Creates comprehensive DeploymentResult with individual resource tracking
|
|
66
|
-
*
|
|
67
|
-
* ## Individual Resource Processing
|
|
68
|
-
*
|
|
69
|
-
* For each resource in the resource graph:
|
|
70
|
-
* - **Type Inference**: Infers Alchemy resource type from Kubernetes kind (e.g., `kubernetes::Deployment`)
|
|
71
|
-
* - **Type Registration**: Calls ensureResourceTypeRegistered to register the resource type (shared across instances)
|
|
72
|
-
* - **ID Generation**: Creates unique resource ID using createAlchemyResourceId with namespace and resource info
|
|
73
|
-
* - **Deployment**: Deploys the resource through Alchemy using the resource provider and DirectTypeKroDeployer
|
|
74
|
-
* - **Tracking**: Tracks deployed resource with Alchemy metadata (resource ID, type, etc.)
|
|
75
|
-
*
|
|
76
|
-
* ## Error Handling Strategy
|
|
77
|
-
*
|
|
78
|
-
* The method implements robust error handling:
|
|
79
|
-
* - **Continue on Failure**: Individual resource failures don't stop processing of remaining resources
|
|
80
|
-
* - **Error Collection**: All errors are collected with detailed context about which resource failed
|
|
81
|
-
* - **Resource Context**: Error messages include resource kind, name, namespace, and Alchemy resource type
|
|
82
|
-
* - **Partial Status**: Deployment status is set to 'partial' when some resources succeed and others fail
|
|
83
|
-
*
|
|
84
|
-
* ## Resource Type Naming
|
|
85
|
-
*
|
|
86
|
-
* Resource types follow consistent naming patterns:
|
|
87
|
-
* - **Kubernetes Resources**: `kubernetes::{Kind}` (e.g., `kubernetes::Deployment`, `kubernetes::Service`)
|
|
88
|
-
* - **Shared Types**: Multiple instances of the same resource type share the same Alchemy resource type registration
|
|
89
|
-
* - **Unique IDs**: Each resource instance gets a unique Alchemy resource ID for individual tracking
|
|
90
|
-
*
|
|
91
|
-
* @param spec - The resource specification to deploy
|
|
92
|
-
* @param instanceName - The name of this specific instance
|
|
93
|
-
* @returns Promise<DeploymentResult> - Comprehensive deployment result with individual resource tracking
|
|
94
|
-
* @throws Error - If Alchemy scope validation fails or critical deployment errors occur
|
|
95
|
-
*/
|
|
96
|
-
protected executeDeployment(spec: TSpec, instanceName: string, opts?: import('./base-strategy.js').DeployStrategyOptions): Promise<DeploymentResult>;
|
|
97
|
-
private executeBaseDirectDeployment;
|
|
98
|
-
private rollbackBaseDirectDeployment;
|
|
99
|
-
protected getStrategyMode(): 'direct' | 'kro';
|
|
100
|
-
/**
|
|
101
|
-
* Create resource graph for instance using base strategy logic
|
|
102
|
-
*/
|
|
103
|
-
private createResourceGraphForInstance;
|
|
104
|
-
/**
|
|
105
|
-
* Extract serializable kubeConfig options from factory options
|
|
106
|
-
*/
|
|
107
|
-
private extractKubeConfigOptions;
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=alchemy-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alchemy-strategy.d.ts","sourceRoot":"","sources":["../../../../src/core/deployment/strategies/alchemy-strategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,aAAa,EACd,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,sBAAsB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,yBAAyB,CACpC,KAAK,SAAS,iBAAiB,EAC/B,OAAO,SAAS,iBAAiB,CACjC,SAAQ,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC;IAW5C,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,YAAY;IAXtB,SAAS,CAAC,QAAQ,CAAC,aAAa,iDAAqD;gBAGnF,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,EAElD,aAAa,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,SAAS,EAC7D,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,EAC5D,cAAc,EAAE,cAAc,EACtB,YAAY,EAAE,KAAK,EACnB,YAAY,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC;IAK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;cACa,iBAAiB,CAC/B,IAAI,EAAE,KAAK,EACX,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,OAAO,oBAAoB,EAAE,qBAAqB,GACxD,OAAO,CAAC,gBAAgB,CAAC;YA0Pd,2BAA2B;YAoB3B,4BAA4B;IA+B1C,SAAS,CAAC,eAAe,IAAI,QAAQ,GAAG,KAAK;IAI7C;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAuDtC;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAwKjC"}
|
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alchemy Deployment Strategy
|
|
3
|
-
*
|
|
4
|
-
* This module provides the alchemy deployment strategy that wraps deployments
|
|
5
|
-
* in alchemy resources with individual resource registration.
|
|
6
|
-
*/
|
|
7
|
-
import { DEFAULT_READINESS_TIMEOUT } from '../../config/defaults.js';
|
|
8
|
-
import { DependencyGraph } from '../../dependencies/graph.js';
|
|
9
|
-
import { ensureError } from '../../errors.js';
|
|
10
|
-
import { getComponentLogger } from '../../logging/index.js';
|
|
11
|
-
import { hasResourceMetadata } from '../../metadata/index.js';
|
|
12
|
-
import { ensureReadinessEvaluator } from '../../readiness/index.js';
|
|
13
|
-
import { getEffectiveScopes } from '../resource-tagging.js';
|
|
14
|
-
import { validateAlchemyScope } from '../shared-utilities.js';
|
|
15
|
-
import { BaseDeploymentStrategy } from './base-strategy.js';
|
|
16
|
-
import { DirectDeploymentStrategy } from './direct-strategy.js';
|
|
17
|
-
/**
|
|
18
|
-
* Alchemy deployment strategy - wraps deployments in alchemy resources with individual resource registration
|
|
19
|
-
*
|
|
20
|
-
* This strategy implements individual resource registration for Direct mode Alchemy integration.
|
|
21
|
-
* Unlike Kro mode which registers RGDs and instances, Direct mode registers each individual
|
|
22
|
-
* Kubernetes resource (Deployment, Service, ConfigMap, etc.) as separate Alchemy resource types.
|
|
23
|
-
*
|
|
24
|
-
* ## Resource Registration Pattern
|
|
25
|
-
*
|
|
26
|
-
* **Direct Mode (this strategy):**
|
|
27
|
-
* - Each individual Kubernetes resource gets its own Alchemy resource type registration
|
|
28
|
-
* - Resource types are named using the pattern `kubernetes::{Kind}` (e.g., `kubernetes::Deployment`)
|
|
29
|
-
* - Each instance of each resource gets a separate Alchemy resource registered
|
|
30
|
-
* - Example: A webapp with Deployment + Service creates 2 Alchemy resource types and 2 resource instances
|
|
31
|
-
*
|
|
32
|
-
* **Kro Mode (for comparison):**
|
|
33
|
-
* - Each RGD gets one Alchemy resource type registered (`kro::ResourceGraphDefinition`)
|
|
34
|
-
* - Each instance of each RGD gets a separate Alchemy resource registered (`kro::{Kind}`)
|
|
35
|
-
* - Example: A webapp RGD creates 1 RGD type + 1 instance type = 2 Alchemy resources total
|
|
36
|
-
*
|
|
37
|
-
* ## Error Handling
|
|
38
|
-
*
|
|
39
|
-
* The strategy implements robust error handling for individual resource failures:
|
|
40
|
-
* - Continues processing remaining resources when individual resources fail
|
|
41
|
-
* - Collects all errors and includes them in the final DeploymentResult
|
|
42
|
-
* - Sets deployment status to 'partial' when some resources succeed and others fail
|
|
43
|
-
* - Provides resource-specific error context including kind, name, namespace, and Alchemy resource type
|
|
44
|
-
*
|
|
45
|
-
* ## Integration with DirectTypeKroDeployer
|
|
46
|
-
*
|
|
47
|
-
* This strategy integrates with DirectTypeKroDeployer for actual resource deployment:
|
|
48
|
-
* - Extracts DirectDeploymentEngine from the base DirectDeploymentStrategy
|
|
49
|
-
* - Creates DirectTypeKroDeployer instance for individual resource deployments
|
|
50
|
-
* - Passes deployer to each Alchemy resource provider for deployment execution
|
|
51
|
-
*
|
|
52
|
-
* @template TSpec - The specification type for the resource
|
|
53
|
-
* @template TStatus - The status type for the resource
|
|
54
|
-
*/
|
|
55
|
-
export class AlchemyDeploymentStrategy extends BaseDeploymentStrategy {
|
|
56
|
-
alchemyScope;
|
|
57
|
-
baseStrategy;
|
|
58
|
-
alchemyLogger = getComponentLogger('alchemy-deployment-strategy');
|
|
59
|
-
constructor(factoryName, namespace, schemaDefinition,
|
|
60
|
-
// biome-ignore lint/suspicious/noExplicitAny: alchemy strategy must preserve the generic status-builder resource map contract.
|
|
61
|
-
statusBuilder, resourceKeys, factoryOptions, alchemyScope, baseStrategy) {
|
|
62
|
-
super(factoryName, namespace, schemaDefinition, statusBuilder, resourceKeys, factoryOptions);
|
|
63
|
-
this.alchemyScope = alchemyScope;
|
|
64
|
-
this.baseStrategy = baseStrategy;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Execute deployment with individual resource registration for Alchemy integration
|
|
68
|
-
*
|
|
69
|
-
* This method implements the core logic for Direct mode Alchemy integration:
|
|
70
|
-
*
|
|
71
|
-
* ## Process Overview
|
|
72
|
-
* 1. **Validation**: Validates the Alchemy scope is available and properly configured
|
|
73
|
-
* 2. **Resource Graph Creation**: Gets the resource graph from the base strategy using createResourceGraphForInstance
|
|
74
|
-
* 3. **Deployer Setup**: Creates DirectTypeKroDeployer instance using DirectDeploymentEngine from base strategy
|
|
75
|
-
* 4. **Individual Registration**: Processes each resource in the resource graph individually for Alchemy registration
|
|
76
|
-
* 5. **Error Collection**: Continues processing remaining resources when individual resources fail
|
|
77
|
-
* 6. **Result Creation**: Creates comprehensive DeploymentResult with individual resource tracking
|
|
78
|
-
*
|
|
79
|
-
* ## Individual Resource Processing
|
|
80
|
-
*
|
|
81
|
-
* For each resource in the resource graph:
|
|
82
|
-
* - **Type Inference**: Infers Alchemy resource type from Kubernetes kind (e.g., `kubernetes::Deployment`)
|
|
83
|
-
* - **Type Registration**: Calls ensureResourceTypeRegistered to register the resource type (shared across instances)
|
|
84
|
-
* - **ID Generation**: Creates unique resource ID using createAlchemyResourceId with namespace and resource info
|
|
85
|
-
* - **Deployment**: Deploys the resource through Alchemy using the resource provider and DirectTypeKroDeployer
|
|
86
|
-
* - **Tracking**: Tracks deployed resource with Alchemy metadata (resource ID, type, etc.)
|
|
87
|
-
*
|
|
88
|
-
* ## Error Handling Strategy
|
|
89
|
-
*
|
|
90
|
-
* The method implements robust error handling:
|
|
91
|
-
* - **Continue on Failure**: Individual resource failures don't stop processing of remaining resources
|
|
92
|
-
* - **Error Collection**: All errors are collected with detailed context about which resource failed
|
|
93
|
-
* - **Resource Context**: Error messages include resource kind, name, namespace, and Alchemy resource type
|
|
94
|
-
* - **Partial Status**: Deployment status is set to 'partial' when some resources succeed and others fail
|
|
95
|
-
*
|
|
96
|
-
* ## Resource Type Naming
|
|
97
|
-
*
|
|
98
|
-
* Resource types follow consistent naming patterns:
|
|
99
|
-
* - **Kubernetes Resources**: `kubernetes::{Kind}` (e.g., `kubernetes::Deployment`, `kubernetes::Service`)
|
|
100
|
-
* - **Shared Types**: Multiple instances of the same resource type share the same Alchemy resource type registration
|
|
101
|
-
* - **Unique IDs**: Each resource instance gets a unique Alchemy resource ID for individual tracking
|
|
102
|
-
*
|
|
103
|
-
* @param spec - The resource specification to deploy
|
|
104
|
-
* @param instanceName - The name of this specific instance
|
|
105
|
-
* @returns Promise<DeploymentResult> - Comprehensive deployment result with individual resource tracking
|
|
106
|
-
* @throws Error - If Alchemy scope validation fails or critical deployment errors occur
|
|
107
|
-
*/
|
|
108
|
-
async executeDeployment(spec, instanceName, opts) {
|
|
109
|
-
try {
|
|
110
|
-
// Validate alchemy scope is available and properly configured
|
|
111
|
-
validateAlchemyScope(this.alchemyScope, 'Alchemy deployment');
|
|
112
|
-
// Use static imports for registration functions
|
|
113
|
-
const { ensureResourceTypeRegistered, createAlchemyResourceId } = await import('../../../alchemy/deployment.js');
|
|
114
|
-
// Get resource graph from base strategy using createResourceGraphForInstance
|
|
115
|
-
// This provides the individual Kubernetes resources that need to be registered with Alchemy
|
|
116
|
-
this.logger.info('About to create resource graph for instance', {
|
|
117
|
-
instanceName,
|
|
118
|
-
hasBaseStrategy: !!this.baseStrategy,
|
|
119
|
-
baseStrategyType: this.baseStrategy?.constructor?.name,
|
|
120
|
-
});
|
|
121
|
-
const resourceGraph = this.createResourceGraphForInstance(spec, instanceName);
|
|
122
|
-
this.logger.info('Resource graph created', {
|
|
123
|
-
resourceCount: resourceGraph.resources.length,
|
|
124
|
-
graphName: resourceGraph.name,
|
|
125
|
-
});
|
|
126
|
-
let directResult;
|
|
127
|
-
try {
|
|
128
|
-
directResult = await this.executeBaseDirectDeployment(spec, instanceName, opts);
|
|
129
|
-
}
|
|
130
|
-
catch (directDeploymentError) {
|
|
131
|
-
const error = ensureError(directDeploymentError);
|
|
132
|
-
this.logger.warn('Base direct deployment failed; preserving failure in Alchemy result', {
|
|
133
|
-
error: error.message,
|
|
134
|
-
resourceCount: resourceGraph.resources.length,
|
|
135
|
-
});
|
|
136
|
-
directResult = {
|
|
137
|
-
status: 'failed',
|
|
138
|
-
deploymentId: `alchemy-direct-failed-${instanceName}-${Date.now()}`,
|
|
139
|
-
resources: [],
|
|
140
|
-
dependencyGraph: resourceGraph.dependencyGraph,
|
|
141
|
-
duration: 0,
|
|
142
|
-
errors: resourceGraph.resources.map((resource) => ({
|
|
143
|
-
resourceId: resource.id,
|
|
144
|
-
phase: 'deployment',
|
|
145
|
-
error: new Error(`Direct deployment failed for ${resource.manifest.kind || 'Unknown'}/${resource.manifest.metadata?.name || 'unnamed'}: ${error.message}`),
|
|
146
|
-
timestamp: new Date(),
|
|
147
|
-
})),
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
const directResourcesById = new Map(directResult.resources.map((resource) => [resource.id, resource]));
|
|
151
|
-
const trackingDeployer = {
|
|
152
|
-
deploy: async (resource) => resource,
|
|
153
|
-
delete: async () => {
|
|
154
|
-
// Alchemy direct mode is only registering state here; the base direct
|
|
155
|
-
// deployment already performed Kubernetes mutations.
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
// Process each actually deployed resource in the graph for Alchemy state registration.
|
|
159
|
-
const deployedResources = [];
|
|
160
|
-
const errors = [];
|
|
161
|
-
const startTime = Date.now();
|
|
162
|
-
this.logger.info('Processing resource graph for alchemy deployment', {
|
|
163
|
-
resourceCount: resourceGraph.resources.length,
|
|
164
|
-
resourceIds: resourceGraph.resources.map((r) => r.id),
|
|
165
|
-
resourceKinds: resourceGraph.resources.map((r) => r.manifest.kind),
|
|
166
|
-
});
|
|
167
|
-
// Continue processing remaining resources when individual resources fail
|
|
168
|
-
for (const resource of resourceGraph.resources) {
|
|
169
|
-
const directDeployedResource = directResourcesById.get(resource.id);
|
|
170
|
-
if (!directDeployedResource) {
|
|
171
|
-
this.logger.debug('Skipping Alchemy state registration for undeployed resource', {
|
|
172
|
-
resourceId: resource.id,
|
|
173
|
-
resourceScopes: getEffectiveScopes(resource.manifest),
|
|
174
|
-
targetScopes: opts?.targetScopes,
|
|
175
|
-
});
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
this.logger.info('Processing resource for alchemy deployment', {
|
|
180
|
-
resourceId: resource.id,
|
|
181
|
-
resourceKind: resource.manifest.kind,
|
|
182
|
-
resourceName: resource.manifest.metadata?.name,
|
|
183
|
-
hasReadinessEvaluator: hasResourceMetadata(resource.manifest),
|
|
184
|
-
});
|
|
185
|
-
const resourceWithEvaluator = ensureReadinessEvaluator(resource.manifest);
|
|
186
|
-
// Register resource type dynamically (shared across instances)
|
|
187
|
-
const ResourceProvider = ensureResourceTypeRegistered(resourceWithEvaluator);
|
|
188
|
-
// Create unique resource ID for this instance
|
|
189
|
-
const resourceId = createAlchemyResourceId(resourceWithEvaluator, this.namespace);
|
|
190
|
-
// Deploy individual resource through Alchemy within the scope
|
|
191
|
-
await this.alchemyScope.run(async () => {
|
|
192
|
-
try {
|
|
193
|
-
// Extract serializable kubeConfig options
|
|
194
|
-
const kubeConfigOptions = this.extractKubeConfigOptions();
|
|
195
|
-
// Create the resource through Alchemy
|
|
196
|
-
const _alchemyResource = await ResourceProvider(resourceId, {
|
|
197
|
-
resource: resourceWithEvaluator,
|
|
198
|
-
namespace: this.namespace,
|
|
199
|
-
deploymentStrategy: 'direct',
|
|
200
|
-
kubeConfigOptions,
|
|
201
|
-
deployer: trackingDeployer,
|
|
202
|
-
options: {
|
|
203
|
-
waitForReady: this.factoryOptions.waitForReady ?? false, // Default to false for faster tests
|
|
204
|
-
timeout: this.factoryOptions.timeout ?? DEFAULT_READINESS_TIMEOUT,
|
|
205
|
-
factoryName: this.factoryName,
|
|
206
|
-
instanceName,
|
|
207
|
-
...(opts?.singletonSpecFingerprint && { singletonSpecFingerprint: opts.singletonSpecFingerprint }),
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
// Track the deployed resource
|
|
211
|
-
deployedResources.push({
|
|
212
|
-
...directDeployedResource,
|
|
213
|
-
alchemyResourceId: resourceId,
|
|
214
|
-
alchemyResourceType: ResourceProvider.name || 'unknown',
|
|
215
|
-
});
|
|
216
|
-
this.logger.debug('Successfully deployed resource through Alchemy', {
|
|
217
|
-
resourceKind: resource.manifest.kind,
|
|
218
|
-
resourceName: resource.manifest.metadata?.name,
|
|
219
|
-
alchemyResourceId: resourceId,
|
|
220
|
-
alchemyResourceType: ResourceProvider.name,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
catch (deployError) {
|
|
224
|
-
const error = ensureError(deployError);
|
|
225
|
-
this.logger.error('Failed to deploy individual resource through Alchemy', error, {
|
|
226
|
-
resourceKind: resource.manifest.kind,
|
|
227
|
-
resourceName: resource.manifest.metadata?.name,
|
|
228
|
-
resourceId: resource.id,
|
|
229
|
-
namespace: this.namespace,
|
|
230
|
-
});
|
|
231
|
-
// Collect error but continue processing other resources
|
|
232
|
-
errors.push({
|
|
233
|
-
resourceId: resource.id,
|
|
234
|
-
error,
|
|
235
|
-
phase: 'deployment',
|
|
236
|
-
timestamp: new Date(),
|
|
237
|
-
resourceKind: resource.manifest.kind || 'Unknown',
|
|
238
|
-
resourceName: resource.manifest.metadata?.name || 'unnamed',
|
|
239
|
-
alchemyResourceType: ResourceProvider.name || 'unknown',
|
|
240
|
-
namespace: this.namespace,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
catch (registrationError) {
|
|
246
|
-
const error = ensureError(registrationError);
|
|
247
|
-
this.logger.error('Failed to register resource type with Alchemy', error, {
|
|
248
|
-
resourceKind: resource.manifest.kind,
|
|
249
|
-
resourceName: resource.manifest.metadata?.name,
|
|
250
|
-
resourceId: resource.id,
|
|
251
|
-
});
|
|
252
|
-
// Collect error but continue processing other resources
|
|
253
|
-
errors.push({
|
|
254
|
-
resourceId: resource.id,
|
|
255
|
-
error,
|
|
256
|
-
phase: 'deployment',
|
|
257
|
-
timestamp: new Date(),
|
|
258
|
-
resourceKind: resource.manifest.kind || 'Unknown',
|
|
259
|
-
resourceName: resource.manifest.metadata?.name || 'unnamed',
|
|
260
|
-
alchemyResourceType: 'registration-failed',
|
|
261
|
-
namespace: this.namespace,
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// Create comprehensive deployment result
|
|
266
|
-
const duration = Date.now() - startTime;
|
|
267
|
-
const allErrors = [
|
|
268
|
-
...(directResult.errors ?? []).map((error) => ({
|
|
269
|
-
...error,
|
|
270
|
-
resourceKind: 'Unknown',
|
|
271
|
-
resourceName: error.resourceId,
|
|
272
|
-
alchemyResourceType: 'direct-deployment',
|
|
273
|
-
namespace: this.namespace,
|
|
274
|
-
})),
|
|
275
|
-
...errors,
|
|
276
|
-
];
|
|
277
|
-
const hasErrors = allErrors.length > 0;
|
|
278
|
-
let hasSuccesses = deployedResources.length > 0;
|
|
279
|
-
let rolledBackAfterAlchemyFailure = false;
|
|
280
|
-
if (hasErrors && directResult.resources.length > 0) {
|
|
281
|
-
await this.rollbackBaseDirectDeployment(directResult);
|
|
282
|
-
deployedResources.length = 0;
|
|
283
|
-
hasSuccesses = false;
|
|
284
|
-
rolledBackAfterAlchemyFailure = true;
|
|
285
|
-
}
|
|
286
|
-
let status;
|
|
287
|
-
if (rolledBackAfterAlchemyFailure) {
|
|
288
|
-
status = 'failed';
|
|
289
|
-
}
|
|
290
|
-
else if (hasSuccesses && !hasErrors) {
|
|
291
|
-
status = 'success';
|
|
292
|
-
}
|
|
293
|
-
else if (!hasSuccesses && hasErrors) {
|
|
294
|
-
status = 'failed';
|
|
295
|
-
}
|
|
296
|
-
else if (!hasSuccesses && !hasErrors) {
|
|
297
|
-
status = directResult.status;
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
status = 'partial';
|
|
301
|
-
}
|
|
302
|
-
this.logger.info('Alchemy deployment completed', {
|
|
303
|
-
status,
|
|
304
|
-
successfulResources: deployedResources.length,
|
|
305
|
-
failedResources: allErrors.length,
|
|
306
|
-
totalResources: resourceGraph.resources.length,
|
|
307
|
-
duration,
|
|
308
|
-
});
|
|
309
|
-
return {
|
|
310
|
-
status,
|
|
311
|
-
deploymentId: directResult.deploymentId,
|
|
312
|
-
resources: deployedResources,
|
|
313
|
-
dependencyGraph: resourceGraph.dependencyGraph,
|
|
314
|
-
duration,
|
|
315
|
-
errors: allErrors.map((e) => ({
|
|
316
|
-
resourceId: e.resourceId,
|
|
317
|
-
error: e.error,
|
|
318
|
-
phase: e.phase,
|
|
319
|
-
timestamp: e.timestamp,
|
|
320
|
-
})),
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
catch (error) {
|
|
324
|
-
this.logger.error('Alchemy deployment strategy failed', ensureError(error));
|
|
325
|
-
throw error;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
async executeBaseDirectDeployment(spec, instanceName, opts) {
|
|
329
|
-
const strategy = this.baseStrategy;
|
|
330
|
-
if (typeof strategy.executeDeployment !== 'function') {
|
|
331
|
-
throw new Error('Alchemy direct deployment requires a direct base strategy');
|
|
332
|
-
}
|
|
333
|
-
return strategy.executeDeployment(spec, instanceName, opts);
|
|
334
|
-
}
|
|
335
|
-
async rollbackBaseDirectDeployment(directResult) {
|
|
336
|
-
const strategy = this.baseStrategy;
|
|
337
|
-
if (typeof strategy.rollbackDeployment !== 'function') {
|
|
338
|
-
this.logger.warn('Alchemy registration failed after direct deployment, but base strategy cannot rollback', {
|
|
339
|
-
deploymentId: directResult.deploymentId,
|
|
340
|
-
resourceCount: directResult.resources.length,
|
|
341
|
-
});
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
try {
|
|
345
|
-
const scopes = [...new Set(directResult.resources.flatMap((resource) => getEffectiveScopes(resource.manifest)))];
|
|
346
|
-
await strategy.rollbackDeployment(directResult.deploymentId, scopes.length > 0 ? { scopes } : undefined);
|
|
347
|
-
this.logger.info('Rolled back direct resources after Alchemy registration failure', {
|
|
348
|
-
deploymentId: directResult.deploymentId,
|
|
349
|
-
resourceCount: directResult.resources.length,
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
catch (rollbackError) {
|
|
353
|
-
this.logger.error('Failed to rollback direct resources after Alchemy registration failure', ensureError(rollbackError), {
|
|
354
|
-
deploymentId: directResult.deploymentId,
|
|
355
|
-
});
|
|
356
|
-
throw rollbackError;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
getStrategyMode() {
|
|
360
|
-
return 'direct'; // Alchemy strategy uses direct mode for individual resource registration
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Create resource graph for instance using base strategy logic
|
|
364
|
-
*/
|
|
365
|
-
createResourceGraphForInstance(spec, instanceName) {
|
|
366
|
-
// Delegate to the base strategy's resource resolution logic
|
|
367
|
-
if (this.baseStrategy instanceof DirectDeploymentStrategy) {
|
|
368
|
-
const baseStrategy = this.baseStrategy;
|
|
369
|
-
if (baseStrategy.resourceResolver &&
|
|
370
|
-
typeof baseStrategy.resourceResolver.createResourceGraphForInstance === 'function') {
|
|
371
|
-
this.logger.info('Calling createResourceGraphForInstance on resource resolver', {
|
|
372
|
-
hasResourceResolver: !!baseStrategy.resourceResolver,
|
|
373
|
-
resolverType: baseStrategy.resourceResolver.constructor?.name,
|
|
374
|
-
});
|
|
375
|
-
const resourceGraph = baseStrategy.resourceResolver.createResourceGraphForInstance(spec, instanceName);
|
|
376
|
-
this.logger.info('Created resource graph from base strategy', {
|
|
377
|
-
resourceCount: resourceGraph.resources.length,
|
|
378
|
-
resourceIds: resourceGraph.resources.map((r) => r.id),
|
|
379
|
-
resourceKinds: resourceGraph.resources.map((r) => r.manifest?.kind),
|
|
380
|
-
});
|
|
381
|
-
return { ...resourceGraph, name: instanceName };
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
this.logger.warn('Base strategy does not have resourceResolver or createResourceGraphForInstance method', {
|
|
385
|
-
hasResourceResolver: !!baseStrategy.resourceResolver,
|
|
386
|
-
resolverType: baseStrategy.resourceResolver?.constructor?.name,
|
|
387
|
-
hasMethod: baseStrategy.resourceResolver
|
|
388
|
-
? typeof baseStrategy.resourceResolver.createResourceGraphForInstance
|
|
389
|
-
: 'no resolver',
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
this.logger.warn('Base strategy is not DirectDeploymentStrategy', {
|
|
395
|
-
baseStrategyType: this.baseStrategy?.constructor?.name,
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
// Fallback implementation - this should not happen in normal operation
|
|
399
|
-
this.logger.error('Falling back to empty resource graph - this indicates a configuration issue');
|
|
400
|
-
return {
|
|
401
|
-
name: instanceName,
|
|
402
|
-
resources: [],
|
|
403
|
-
dependencyGraph: new DependencyGraph(),
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Extract serializable kubeConfig options from factory options
|
|
408
|
-
*/
|
|
409
|
-
extractKubeConfigOptions() {
|
|
410
|
-
let kubeConfigOptions = {};
|
|
411
|
-
if (this.factoryOptions.kubeConfig) {
|
|
412
|
-
const kc = this.factoryOptions.kubeConfig;
|
|
413
|
-
const cluster = kc.getCurrentCluster();
|
|
414
|
-
const user = kc.getCurrentUser();
|
|
415
|
-
const context = kc.getCurrentContext();
|
|
416
|
-
this.logger.debug('Extracting kubeconfig options for alchemy', {
|
|
417
|
-
hasCluster: !!cluster,
|
|
418
|
-
clusterSkipTLS: cluster?.skipTLSVerify,
|
|
419
|
-
clusterServer: cluster?.server,
|
|
420
|
-
hasUser: !!user,
|
|
421
|
-
context,
|
|
422
|
-
});
|
|
423
|
-
// SECURITY: Prioritize user's explicit skipTLSVerify choice over cluster config
|
|
424
|
-
const userSkipTLS = this.factoryOptions.skipTLSVerify;
|
|
425
|
-
const clusterSkipTLS = cluster?.skipTLSVerify;
|
|
426
|
-
const finalSkipTLS = userSkipTLS === true ? true : (clusterSkipTLS ?? false);
|
|
427
|
-
// Log security warning when TLS is disabled
|
|
428
|
-
if (finalSkipTLS) {
|
|
429
|
-
this.logger.warn('TLS verification disabled - this is insecure and should only be used in development', {
|
|
430
|
-
component: 'alchemy-deployment-strategy',
|
|
431
|
-
security: 'tls-disabled',
|
|
432
|
-
userExplicit: userSkipTLS === true,
|
|
433
|
-
fromClusterConfig: clusterSkipTLS === true,
|
|
434
|
-
server: cluster?.server,
|
|
435
|
-
recommendation: userSkipTLS === true
|
|
436
|
-
? 'Remove skipTLSVerify: true from factory options for production'
|
|
437
|
-
: 'Update cluster configuration to enable TLS verification',
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
kubeConfigOptions = {
|
|
441
|
-
skipTLSVerify: finalSkipTLS,
|
|
442
|
-
...(cluster?.server && { server: cluster.server }),
|
|
443
|
-
...(context && { context }),
|
|
444
|
-
// Include complete cluster configuration
|
|
445
|
-
...(cluster && {
|
|
446
|
-
cluster: {
|
|
447
|
-
name: cluster.name,
|
|
448
|
-
server: cluster.server,
|
|
449
|
-
skipTLSVerify: finalSkipTLS,
|
|
450
|
-
...(cluster.caData && { caData: cluster.caData }),
|
|
451
|
-
...(cluster.caFile && { caFile: cluster.caFile }),
|
|
452
|
-
},
|
|
453
|
-
}),
|
|
454
|
-
// Include complete user configuration
|
|
455
|
-
...(user && {
|
|
456
|
-
user: {
|
|
457
|
-
name: user.name,
|
|
458
|
-
...(user.token && { token: user.token }),
|
|
459
|
-
...(user.certData && { certData: user.certData }),
|
|
460
|
-
...(user.certFile && { certFile: user.certFile }),
|
|
461
|
-
...(user.keyData && { keyData: user.keyData }),
|
|
462
|
-
...(user.keyFile && { keyFile: user.keyFile }),
|
|
463
|
-
...(user.exec ? { exec: user.exec } : {}),
|
|
464
|
-
...(user.authProvider
|
|
465
|
-
? { authProvider: user.authProvider }
|
|
466
|
-
: {}),
|
|
467
|
-
},
|
|
468
|
-
}),
|
|
469
|
-
};
|
|
470
|
-
this.logger.debug('Extracted kubeconfig options', {
|
|
471
|
-
server: cluster?.server ?? '(default)',
|
|
472
|
-
hasToken: !!user?.token,
|
|
473
|
-
hasCertData: !!user?.certData,
|
|
474
|
-
hasKeyData: !!user?.keyData,
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
// Try extracting from the base strategy's factory options (common in tests)
|
|
479
|
-
try {
|
|
480
|
-
if (this.baseStrategy instanceof DirectDeploymentStrategy) {
|
|
481
|
-
const bs = this.baseStrategy;
|
|
482
|
-
const baseFactoryOptions = bs?.factoryOptions;
|
|
483
|
-
const baseKc = baseFactoryOptions?.kubeConfig;
|
|
484
|
-
const cluster = baseKc?.getCurrentCluster();
|
|
485
|
-
const user = baseKc?.getCurrentUser();
|
|
486
|
-
const context = baseKc?.getCurrentContext();
|
|
487
|
-
this.logger.debug('Extracting kubeconfig options from base strategy for alchemy', {
|
|
488
|
-
hasBaseFactoryOptions: !!baseFactoryOptions,
|
|
489
|
-
hasBaseKubeConfig: !!baseKc,
|
|
490
|
-
hasCluster: !!cluster,
|
|
491
|
-
clusterSkipTLS: cluster?.skipTLSVerify,
|
|
492
|
-
clusterServer: cluster?.server,
|
|
493
|
-
hasUser: !!user,
|
|
494
|
-
context,
|
|
495
|
-
});
|
|
496
|
-
if (baseKc && cluster) {
|
|
497
|
-
// SECURITY: Prioritize user's explicit skipTLSVerify choice over cluster config
|
|
498
|
-
const userSkipTLS = this.factoryOptions.skipTLSVerify;
|
|
499
|
-
const clusterSkipTLS = cluster.skipTLSVerify;
|
|
500
|
-
const finalSkipTLS = userSkipTLS === true ? true : (clusterSkipTLS ?? false);
|
|
501
|
-
// Log security warning when TLS is disabled
|
|
502
|
-
if (finalSkipTLS) {
|
|
503
|
-
this.logger.warn('TLS verification disabled - this is insecure and should only be used in development', {
|
|
504
|
-
component: 'alchemy-deployment-strategy',
|
|
505
|
-
security: 'tls-disabled',
|
|
506
|
-
userExplicit: userSkipTLS === true,
|
|
507
|
-
fromClusterConfig: clusterSkipTLS === true,
|
|
508
|
-
server: cluster?.server,
|
|
509
|
-
recommendation: userSkipTLS === true
|
|
510
|
-
? 'Remove skipTLSVerify: true from factory options for production'
|
|
511
|
-
: 'Update cluster configuration to enable TLS verification',
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
kubeConfigOptions = {
|
|
515
|
-
skipTLSVerify: finalSkipTLS,
|
|
516
|
-
...(cluster.server && { server: cluster.server }),
|
|
517
|
-
...(context && { context }),
|
|
518
|
-
cluster: {
|
|
519
|
-
name: cluster.name,
|
|
520
|
-
server: cluster.server,
|
|
521
|
-
skipTLSVerify: finalSkipTLS,
|
|
522
|
-
...(cluster.caData && { caData: cluster.caData }),
|
|
523
|
-
...(cluster.caFile && { caFile: cluster.caFile }),
|
|
524
|
-
},
|
|
525
|
-
...(user && {
|
|
526
|
-
user: {
|
|
527
|
-
name: user.name,
|
|
528
|
-
...(user.token && { token: user.token }),
|
|
529
|
-
...(user.certData && { certData: user.certData }),
|
|
530
|
-
...(user.certFile && { certFile: user.certFile }),
|
|
531
|
-
...(user.keyData && { keyData: user.keyData }),
|
|
532
|
-
...(user.keyFile && { keyFile: user.keyFile }),
|
|
533
|
-
...(user.exec ? { exec: user.exec } : {}),
|
|
534
|
-
...(user.authProvider
|
|
535
|
-
? { authProvider: user.authProvider }
|
|
536
|
-
: {}),
|
|
537
|
-
},
|
|
538
|
-
}),
|
|
539
|
-
};
|
|
540
|
-
this.logger.debug('Extracted kubeconfig options from base strategy', {
|
|
541
|
-
hasCluster: !!kubeConfigOptions.cluster,
|
|
542
|
-
hasUser: !!kubeConfigOptions.user,
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
catch (extractionError) {
|
|
548
|
-
this.logger.debug('Could not extract kubeconfig from base strategy, using default', {
|
|
549
|
-
error: ensureError(extractionError).message,
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
return kubeConfigOptions;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
//# sourceMappingURL=alchemy-strategy.js.map
|