@@ -15,7 +15,10 @@ export async function setupDNS(options: DNSOptions): Promise<void> {
1515 // Get the current CoreDNS ConfigMap
1616 let coreDnsConfigMap ;
1717 try {
18- coreDnsConfigMap = await k8s . coreApi . readNamespacedConfigMap ( 'coredns' , 'kube-system' ) ;
18+ coreDnsConfigMap = await k8s . coreApi . readNamespacedConfigMap ( {
19+ name : 'coredns' ,
20+ namespace : 'kube-system' ,
21+ } ) ;
1922 } catch ( error : any ) {
2023 if ( error . response ?. statusCode === 404 ) {
2124 logger . warn ( 'CoreDNS ConfigMap not found, attempting to find alternative' ) ;
@@ -27,7 +30,10 @@ export async function setupDNS(options: DNSOptions): Promise<void> {
2730
2831 for ( const alt of alternatives ) {
2932 try {
30- coreDnsConfigMap = await k8s . coreApi . readNamespacedConfigMap ( alt . name , alt . namespace ) ;
33+ coreDnsConfigMap = await k8s . coreApi . readNamespacedConfigMap ( {
34+ name : alt . name ,
35+ namespace : alt . namespace ,
36+ } ) ;
3137 break ;
3238 } catch ( e ) {
3339 continue ;
@@ -61,14 +67,18 @@ export async function setupDNS(options: DNSOptions): Promise<void> {
6167
6268 // Update the ConfigMap
6369 const updatedConfigMap = {
64- ...coreDnsConfigMap . body ,
70+ ...coreDnsConfigMap ,
6571 data : {
6672 ...coreDnsConfigMap . data ,
6773 'Corefile' : newCorefile
6874 }
6975 } ;
7076
71- await k8s . coreApi . replaceNamespacedConfigMap ( 'coredns' , 'kube-system' , updatedConfigMap ) ;
77+ await k8s . coreApi . replaceNamespacedConfigMap ( {
78+ name : 'coredns' ,
79+ namespace : 'kube-system' ,
80+ body : updatedConfigMap ,
81+ } ) ;
7282
7383 // Restart CoreDNS deployment to pick up changes
7484 await restartCoreDNS ( k8s ) ;
@@ -176,15 +186,22 @@ function addRewriteRules(currentCorefile: string, rewriteRules: string, subdomai
176186async function restartCoreDNS ( k8s : KubernetesClient ) : Promise < void > {
177187 try {
178188 // Get CoreDNS deployment
179- const deployment = await k8s . appsApi . readNamespacedDeployment ( 'coredns' , 'kube-system' ) ;
189+ const deployment = await k8s . appsApi . readNamespacedDeployment ( {
190+ name : 'coredns' ,
191+ namespace : 'kube-system' ,
192+ } ) ;
180193
181194 // Add/update restart annotation to trigger rolling restart
182195 const annotations = deployment . spec ?. template . metadata ?. annotations || { } ;
183196 annotations [ 'kubectl.kubernetes.io/restartedAt' ] = new Date ( ) . toISOString ( ) ;
184197
185198 deployment . spec ! . template . metadata ! . annotations = annotations ;
186199
187- await k8s . appsApi . replaceNamespacedDeployment ( 'coredns' , 'kube-system' , deployment . body ) ;
200+ await k8s . appsApi . replaceNamespacedDeployment ( {
201+ name : 'coredns' ,
202+ namespace : 'kube-system' ,
203+ body : deployment ,
204+ } ) ;
188205
189206 logger . debug ( 'CoreDNS deployment restart triggered' ) ;
190207
0 commit comments