11import { Chain , StarshipConfig } from '@starship-ci/types' ;
22import { Service } from 'kubernetesjs' ;
33
4- import {
5- getChainId ,
6- getCommonLabels ,
7- getHostname ,
8- TemplateHelpers
9- } from '../../../helpers' ;
4+ import * as helpers from '../../../helpers' ;
105import { IGenerator , Manifest } from '../../../types' ;
116
127class CosmosGenesisServiceGenerator implements IGenerator {
@@ -20,18 +15,18 @@ class CosmosGenesisServiceGenerator implements IGenerator {
2015
2116 labels ( ) : Record < string , string > {
2217 return {
23- ...getCommonLabels ( this . config ) ,
18+ ...helpers . getCommonLabels ( this . config ) ,
2419 'app.kubernetes.io/component' : 'chain' ,
25- 'app.kubernetes.io/name' : `${ getHostname ( this . chain ) } -genesis` ,
26- 'app.kubernetes.io/type' : `${ getChainId ( this . chain ) } -service` ,
20+ 'app.kubernetes.io/name' : `${ helpers . getHostname ( this . chain ) } -genesis` ,
21+ 'app.kubernetes.io/type' : `${ helpers . getChainId ( this . chain ) } -service` ,
2722 'app.kubernetes.io/role' : 'genesis' ,
2823 'starship.io/chain-name' : this . chain . name ,
29- 'starship.io/chain-id' : getChainId ( this . chain )
24+ 'starship.io/chain-id' : helpers . getChainId ( this . chain )
3025 } ;
3126 }
3227
3328 generate ( ) : Array < Service > {
34- const portMap = TemplateHelpers . getPortMap ( ) ;
29+ const portMap = helpers . getPortMap ( ) ;
3530 const ports = Object . entries ( portMap ) . map ( ( [ name , port ] ) => ( {
3631 name,
3732 port,
@@ -54,14 +49,14 @@ class CosmosGenesisServiceGenerator implements IGenerator {
5449 apiVersion : 'v1' ,
5550 kind : 'Service' ,
5651 metadata : {
57- name : `${ getHostname ( this . chain ) } -genesis` ,
52+ name : `${ helpers . getHostname ( this . chain ) } -genesis` ,
5853 labels : this . labels ( )
5954 } ,
6055 spec : {
6156 clusterIP : 'None' ,
6257 ports,
6358 selector : {
64- 'app.kubernetes.io/name' : `${ getHostname ( this . chain ) } -genesis`
59+ 'app.kubernetes.io/name' : `${ helpers . getHostname ( this . chain ) } -genesis`
6560 }
6661 }
6762 }
@@ -80,18 +75,18 @@ class CosmosValidatorServiceGenerator implements IGenerator {
8075
8176 labels ( ) : Record < string , string > {
8277 return {
83- ...getCommonLabels ( this . config ) ,
78+ ...helpers . getCommonLabels ( this . config ) ,
8479 'app.kubernetes.io/component' : 'chain' ,
85- 'app.kubernetes.io/name' : `${ getHostname ( this . chain ) } -validator` ,
80+ 'app.kubernetes.io/name' : `${ helpers . getHostname ( this . chain ) } -validator` ,
8681 'app.kubernetes.io/role' : 'validator' ,
87- 'app.kubernetes.io/type' : `${ getChainId ( this . chain ) } -service` ,
82+ 'app.kubernetes.io/type' : `${ helpers . getChainId ( this . chain ) } -service` ,
8883 'starship.io/chain-name' : this . chain . name ,
89- 'starship.io/chain-id' : getChainId ( this . chain )
84+ 'starship.io/chain-id' : helpers . getChainId ( this . chain )
9085 } ;
9186 }
9287
9388 generate ( ) : Array < Service > {
94- const portMap = TemplateHelpers . getPortMap ( ) ;
89+ const portMap = helpers . getPortMap ( ) ;
9590 const ports = Object . entries ( portMap ) . map ( ( [ name , port ] ) => ( {
9691 name,
9792 port,
@@ -113,14 +108,14 @@ class CosmosValidatorServiceGenerator implements IGenerator {
113108 apiVersion : 'v1' ,
114109 kind : 'Service' ,
115110 metadata : {
116- name : `${ getHostname ( this . chain ) } -validator` ,
111+ name : `${ helpers . getHostname ( this . chain ) } -validator` ,
117112 labels : this . labels ( )
118113 } ,
119114 spec : {
120115 clusterIP : 'None' ,
121116 ports,
122117 selector : {
123- 'app.kubernetes.io/name' : `${ getHostname ( this . chain ) } -validator`
118+ 'app.kubernetes.io/name' : `${ helpers . getHostname ( this . chain ) } -validator`
124119 }
125120 }
126121 }
0 commit comments