perf: 更新k8s底层api库

This commit is contained in:
xiaojunnuo
2024-08-14 15:10:55 +08:00
parent 7b451bbf6e
commit 746bb9d385
8 changed files with 85 additions and 64 deletions

View File

@@ -0,0 +1 @@
alter table cd_access alter column setting type text using setting::text;

View File

@@ -4,3 +4,4 @@ export * from './plugin-tencent/index.js';
export * from './plugin-host/index.js';
export * from './plugin-huawei/index.js';
export * from './plugin-demo/index.js';
export * from './plugin-other/index.js';

View File

@@ -115,7 +115,10 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
const kubeConfigStr = await this.getKubeConfig(client, clusterId, isPrivateIpAddress);
this.logger.info('kubeconfig已成功获取');
const k8sClient = new K8sClient(kubeConfigStr, this.logger);
const k8sClient = new K8sClient({
kubeConfigStr,
logger: this.logger,
});
const ingressType = ingressClass || 'qcloud';
if (ingressType === 'qcloud') {
throw new Error('暂未实现');
@@ -128,7 +131,7 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
// await this.restartIngress({ k8sClient, props })
}
async restartIngress(options: { k8sClient: any }) {
async restartIngress(options: { k8sClient: K8sClient }) {
const { k8sClient } = options;
const { namespace } = this;
@@ -141,10 +144,10 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
};
const ingressList = await k8sClient.getIngressList({ namespace });
console.log('ingressList:', ingressList);
if (!ingressList || !ingressList.body || !ingressList.body.items) {
if (!ingressList || !ingressList.items) {
return;
}
const ingressNames = ingressList.body.items
const ingressNames = ingressList.items
.filter((item: any) => {
if (!item.spec.tls) {
return false;
@@ -165,7 +168,7 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
}
}
async patchNginxCertSecret(options: { cert: any; k8sClient: any }) {
async patchNginxCertSecret(options: { cert: CertInfo; k8sClient: K8sClient }) {
const { cert, k8sClient } = options;
const crt = cert.crt;
const key = cert.key;

View File

@@ -9,6 +9,8 @@ export class K8sAccess {
@AccessInput({
title: 'kubeconfig',
component: {
name: 'a-textarea',
vModel: 'value',
placeholder: 'kubeconfig',
},
required: true,

View File

@@ -97,7 +97,10 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
const kubeConfigStr = await this.getTkeKubeConfig(tkeClient, this.clusterId);
this.logger.info('kubeconfig已成功获取');
const k8sClient = new K8sClient(kubeConfigStr, this.logger);
const k8sClient = new K8sClient({
kubeConfigStr,
logger: this.logger,
});
if (this.clusterIp != null) {
if (!this.clusterDomain) {
this.clusterDomain = `${this.clusterId}.ccs.tencent-cloud.com`;