@starship-ci/generator
Version:
Kubernetes manifest generator for Starship deployments
28 lines (27 loc) • 1.02 kB
JavaScript
import { CosmosGenesisStatefulSetGenerator } from './genesis';
import { CosmosValidatorStatefulSetGenerator } from './validator';
/**
* StatefulSet generator for Cosmos chains
* Handles genesis and validator StatefulSets
*/
export class CosmosStatefulSetGenerator {
config;
chain;
scriptManager;
statefulSetGenerators;
constructor(chain, config, scriptManager) {
this.config = config;
this.chain = chain;
this.scriptManager = scriptManager;
this.statefulSetGenerators = [
new CosmosGenesisStatefulSetGenerator(this.chain, this.config, this.scriptManager)
];
// Add validator StatefulSet if numValidators > 1
if (this.chain.numValidators && this.chain.numValidators > 1) {
this.statefulSetGenerators.push(new CosmosValidatorStatefulSetGenerator(this.chain, this.config, this.scriptManager));
}
}
generate() {
return this.statefulSetGenerators.flatMap((generator) => generator.generate());
}
}