mirror of
https://github.com/certd/certd.git
synced 2026-07-19 13:17:33 +08:00
chore: vke kubeconfig 有效期校验
This commit is contained in:
+13
-2
@@ -268,7 +268,7 @@ export class VolcengineDeployToVKE extends AbstractPlusTaskPlugin {
|
|||||||
body: {
|
body: {
|
||||||
ClusterId: clusterId,
|
ClusterId: clusterId,
|
||||||
Type: this.kubeconfigType,
|
Type: this.kubeconfigType,
|
||||||
ValidDuration: 3600,
|
ValidDuration: 26280, //3年
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const kubeconfigId = res.Result?.Id || res.Id;
|
const kubeconfigId = res.Result?.Id || res.Id;
|
||||||
@@ -303,7 +303,18 @@ export class VolcengineDeployToVKE extends AbstractPlusTaskPlugin {
|
|||||||
PageSize: 10,
|
PageSize: 10,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const items = res.Result?.Items || res.Items || [];
|
let items = res.Result?.Items || res.Items || [];
|
||||||
|
if (items.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const now = new Date();
|
||||||
|
items = items.filter((it: any) => {
|
||||||
|
if (!it.ExpireTime) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const expireTime = new Date(it.ExpireTime);
|
||||||
|
return expireTime > now;
|
||||||
|
});
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user