Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Sep 10, 2024
1 parent 6dd4e5b commit 176fc97
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/api/kube-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,13 +1038,13 @@ export class KubeClient {
}
}

async replaceCustomResourceDefinition(name: string, crd: V1CustomResourceDefinition): Promise<void> {
async replaceCustomResourceDefinition(crd: V1CustomResourceDefinition): Promise<void> {
const k8sApi = this.kubeConfig.makeApiClient(ApiextensionsV1Api)
try {
const response = await k8sApi.readCustomResourceDefinition(name)
const response = await k8sApi.readCustomResourceDefinition(crd.metadata?.name!)

Check failure on line 1044 in src/api/kube-client.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong

Check failure on line 1044 in src/api/kube-client.ts

View workflow job for this annotation

GitHub Actions / release-test

Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong

crd.metadata!.resourceVersion = (response.body as any).metadata.resourceVersion
await k8sApi.replaceCustomResourceDefinition(name, crd)
await k8sApi.replaceCustomResourceDefinition(crd.metadata?.name!, crd)

Check failure on line 1047 in src/api/kube-client.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong

Check failure on line 1047 in src/api/kube-client.ts

View workflow job for this annotation

GitHub Actions / release-test

Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong
} catch (e: any) {
throw this.wrapK8sClientError(e)
}
Expand Down Expand Up @@ -1099,7 +1099,7 @@ export class KubeClient {

// 1. Disable conversion webhook
crd.spec.conversion = null
await this.replaceCustomResourceDefinition(crdName, crd)
await this.replaceCustomResourceDefinition(crd)

// 2. Patch CRD to unblock potential invalid resource error
crd = await this.getCustomResourceDefinition(crdName)
Expand All @@ -1109,7 +1109,7 @@ export class KubeClient {
}
}

await this.replaceCustomResourceDefinition(crdName, crd)
await this.replaceCustomResourceDefinition(crd)

// 3. Delete resources
let resources = await this.listClusterCustomObject(apiGroup, version, plural)
Expand Down

0 comments on commit 176fc97

Please sign in to comment.