File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 1
1
const k8s = require ( '@kubernetes/client-node' ) ;
2
2
3
3
const kc = new k8s . KubeConfig ( ) ;
4
- kc . loadFromFile ( './config' ) ;
4
+ kc . loadFromDefault ( ) ;
5
5
6
6
const k8sApi = kc . makeApiClient ( k8s . AppsV1Api ) ;
7
7
8
8
const targetDeploymentName = 'docker-test-deployment' ;
9
9
10
10
async function scale ( namespace , name , replicas ) {
11
11
// find the particular deployment
12
- const res = await k8sApi . listNamespacedDeployment ( namespace ) ;
13
-
14
- let deployment = null ;
15
- for ( const d of res . body . items ) {
16
- if ( d . metadata . name === targetDeploymentName ) {
17
- deployment = d ;
18
- break ;
19
- }
20
- }
12
+ const res = await k8sApi . readNamespacedDeployment ( name , namespace ) ;
13
+ let deployment = res . body ;
21
14
22
15
// edit
23
16
deployment . spec . replicas = replicas ;
You can’t perform that action at this time.
0 commit comments