Skip to content

Commit 9217ed9

Browse files
bump kube client
1 parent f6eec85 commit 9217ed9

File tree

10 files changed

+191
-527
lines changed

10 files changed

+191
-527
lines changed

tests/@setup/src/buckets.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ async function setupAWSBuckets(k8s: KubernetesClient, options: BucketsOptions):
3333
const awsSecret = await k8s.coreApi.readNamespacedSecret('aws-mock-credentials', options.namespace);
3434
const awsConfig = {
3535
credentials: {
36-
accessKeyId: Buffer.from(awsSecret.body.data!['aws-access-key-id'], 'base64').toString(),
37-
secretAccessKey: Buffer.from(awsSecret.body.data!['aws-secret-access-key'], 'base64').toString()
38-
},
39-
region: Buffer.from(awsSecret.body.data!['aws-region'], 'base64').toString(),
40-
endpoint: Buffer.from(awsSecret.body.data!['aws-endpoint'], 'base64').toString(),
36+
accessKeyId: Buffer.from(awsSecret.data!['aws-access-key-id'], 'base64').toString(),
37+
secretAccessKey: Buffer.from(awsSecret.data!['aws-secret-access-key'], 'base64').toString()
38+
},
39+
region: Buffer.from(awsSecret.data!['aws-region'], 'base64').toString(),
40+
endpoint: Buffer.from(awsSecret.data!['aws-endpoint'], 'base64').toString(),
4141
forcePathStyle: true
4242
};
4343

@@ -105,10 +105,10 @@ async function setupAzureBuckets(k8s: KubernetesClient, options: BucketsOptions)
105105

106106
// Get Azure credentials from mock service
107107
const azureSecret = await k8s.coreApi.readNamespacedSecret('azure-mock-credentials', options.namespace);
108-
const accountName = Buffer.from(azureSecret.body.data!['account-name'], 'base64').toString();
109-
const accountKey = Buffer.from(azureSecret.body.data!['account-key'], 'base64').toString();
110-
const blobEndpoint = Buffer.from(azureSecret.body.data!['blob-endpoint'], 'base64').toString();
111-
const queueEndpoint = Buffer.from(azureSecret.body.data!['queue-endpoint'], 'base64').toString();
108+
const accountName = Buffer.from(azureSecret.data!['account-name'], 'base64').toString();
109+
const accountKey = Buffer.from(azureSecret.data!['account-key'], 'base64').toString();
110+
const blobEndpoint = Buffer.from(azureSecret.data!['blob-endpoint'], 'base64').toString();
111+
const queueEndpoint = Buffer.from(azureSecret.data!['queue-endpoint'], 'base64').toString();
112112

113113
const blobSharedKeyCredential = new BlobStorageSharedKeyCredential(accountName, accountKey);
114114
const queueSharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey);

tests/@setup/src/dns.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function setupDNS(options: DNSOptions): Promise<void> {
4545
}
4646

4747
// Parse current Corefile
48-
const currentCorefile = coreDnsConfigMap.body.data?.['Corefile'] || '';
48+
const currentCorefile = coreDnsConfigMap.data?.['Corefile'] || '';
4949

5050
// Generate rewrite rules for test domains
5151
const rewriteRules = generateRewriteRules(options.subdomain, options.namespace);
@@ -63,7 +63,7 @@ export async function setupDNS(options: DNSOptions): Promise<void> {
6363
const updatedConfigMap = {
6464
...coreDnsConfigMap.body,
6565
data: {
66-
...coreDnsConfigMap.body.data,
66+
...coreDnsConfigMap.data,
6767
'Corefile': newCorefile
6868
}
6969
};
@@ -179,10 +179,10 @@ async function restartCoreDNS(k8s: KubernetesClient): Promise<void> {
179179
const deployment = await k8s.appsApi.readNamespacedDeployment('coredns', 'kube-system');
180180

181181
// Add/update restart annotation to trigger rolling restart
182-
const annotations = deployment.body.spec?.template.metadata?.annotations || {};
182+
const annotations = deployment.spec?.template.metadata?.annotations || {};
183183
annotations['kubectl.kubernetes.io/restartedAt'] = new Date().toISOString();
184184

185-
deployment.body.spec!.template.metadata!.annotations = annotations;
185+
deployment.spec!.template.metadata!.annotations = annotations;
186186

187187
await k8s.appsApi.replaceNamespacedDeployment('coredns', 'kube-system', deployment.body);
188188

tests/@setup/src/keycloak.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function getKeycloakConfig(k8s: KubernetesClient, namespace: string): Prom
3939
try {
4040
// Look for Keycloak service
4141
const services = await k8s.coreApi.listNamespacedService(namespace);
42-
const keycloakService = services.body.items.find(svc =>
42+
const keycloakService = services.items.find(svc =>
4343
svc.metadata?.name?.toLowerCase().includes('keycloak') ||
4444
svc.metadata?.name?.toLowerCase().includes('auth')
4545
);
@@ -50,7 +50,7 @@ async function getKeycloakConfig(k8s: KubernetesClient, namespace: string): Prom
5050

5151
// Look for Keycloak admin credentials
5252
const secrets = await k8s.coreApi.listNamespacedSecret(namespace);
53-
const keycloakSecret = secrets.body.items.find(secret =>
53+
const keycloakSecret = secrets.items.find(secret =>
5454
secret.metadata?.name?.toLowerCase().includes('keycloak') &&
5555
(secret.metadata?.name?.toLowerCase().includes('admin') ||
5656
secret.metadata?.name?.toLowerCase().includes('credentials'))

tests/@setup/src/locations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async function getManagementEndpoint(k8s: KubernetesClient, namespace: string):
8282
try {
8383
// Try to find Management API service
8484
const services = await k8s.coreApi.listNamespacedService(namespace);
85-
const mgmtService = services.body.items.find(svc =>
85+
const mgmtService = services.items.find(svc =>
8686
svc.metadata?.name?.includes('management') ||
8787
svc.metadata?.name?.includes('api') ||
8888
svc.metadata?.name?.includes('zenko-management')
@@ -106,7 +106,7 @@ async function getManagementCredentials(k8s: KubernetesClient, namespace: string
106106
try {
107107
// Look for admin credentials in secrets
108108
const secrets = await k8s.coreApi.listNamespacedSecret(namespace);
109-
const adminSecret = secrets.body.items.find(secret =>
109+
const adminSecret = secrets.items.find(secret =>
110110
secret.metadata?.name?.includes('admin') ||
111111
secret.metadata?.name?.includes('management') ||
112112
secret.metadata?.name?.includes('credentials')

tests/@setup/src/rbac.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function setupRBAC(options: RBACOptions): Promise<void> {
3030

3131
// Get all service accounts in the namespace
3232
const serviceAccounts = await k8s.coreApi.listNamespacedServiceAccount(options.namespace);
33-
const zenkoServiceAccounts = serviceAccounts.body.items.filter(sa =>
33+
const zenkoServiceAccounts = serviceAccounts.items.filter(sa =>
3434
sa.metadata?.name?.includes('zenko') ||
3535
sa.metadata?.name?.includes('cloudserver') ||
3636
sa.metadata?.name?.includes('backbeat') ||

tests/@setup/src/utils/k8s.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class KubernetesClient {
173173
while (Date.now() - startTime < timeoutMs) {
174174
try {
175175
const deployment = await this.appsApi.readNamespacedDeployment(name, namespace);
176-
const status = deployment.body.status;
176+
const status = deployment.status;
177177

178178
if (status?.readyReplicas === status?.replicas && status?.replicas && status.replicas > 0) {
179179
logger.debug(`Deployment ${name} is ready`);

tests/ctst/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "ISC",
99
"private": true,
1010
"dependencies": {
11-
"@kubernetes/client-node": "^0.21.0",
11+
"@kubernetes/client-node": "^1.3.0",
1212
"@types/node": "^18.19.121",
1313
"@types/proper-lockfile": "^4.1.4",
1414
"@types/qs": "^6.9.15",

0 commit comments

Comments
 (0)