Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Nov 5, 2024
1 parent 0a1f5f7 commit f9438b3
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions src/api/kube-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ export class KubeClient {
try {
const {body} = await k8sApi.readNamespace(namespace)
return body
} catch {
}
} catch {}
}

async patchNamespacedCustomObject(name: string, namespace: string, patch: any, resourceAPIGroup: string, resourceAPIVersion: string, resourcePlural: string): Promise<any | undefined> {
Expand Down Expand Up @@ -1095,7 +1094,7 @@ export class KubeClient {
async deleteAllCustomResourcesAndCrd(crdName: string, apiGroup: string, version: string, plural: string): Promise<void> {
const customObjectsApi = this.kubeConfig.makeApiClient(CustomObjectsApi)

let crd = await this.getCustomResourceDefinition(crdName)
const crd = await this.getCustomResourceDefinition(crdName)
if (!crd) {
return
}
Expand Down Expand Up @@ -1766,14 +1765,14 @@ export class KubeClient {
// Set up watcher
const watcher = new Watch(this.kubeConfig)
const request = await watcher
.watch(`/api/v1/namespaces/${namespace}/configmaps/`, {fieldSelector: `metadata.name=${name}`}, (_phase: string, _obj: any) => {
request.abort()
resolve()
}, error => {
if (error) {
reject(error)
}
})
.watch(`/api/v1/namespaces/${namespace}/configmaps/`, {fieldSelector: `metadata.name=${name}`}, (_phase: string, _obj: any) => {
request.abort()
resolve()
}, error => {
if (error) {
reject(error)
}
})

// Automatically stop watching after timeout
const timeoutHandler = setTimeout(() => {
Expand All @@ -1799,31 +1798,31 @@ export class KubeClient {
// Set up watcher
const watcher = new Watch(this.kubeConfig)
const request = await watcher
.watch(`/api/v1/namespaces/${namespace}/secrets/`, {fieldSelector: `metadata.name=${name}`}, (_phase: string, obj: any) => {
const secret = obj as V1Secret

// Check all required data fields to be present
if (dataKeys.length > 0 && secret.data) {
for (const key of dataKeys) {
if (!secret.data[key]) {
// Key is missing or empty
return
}
.watch(`/api/v1/namespaces/${namespace}/secrets/`, {fieldSelector: `metadata.name=${name}`}, (_phase: string, obj: any) => {
const secret = obj as V1Secret

// Check all required data fields to be present
if (dataKeys.length > 0 && secret.data) {
for (const key of dataKeys) {
if (!secret.data[key]) {
// Key is missing or empty
return
}
}
}

// The secret with all specified fields is present, stop watching
if (request) {
request.abort()
}
// The secret with all specified fields is present, stop watching
if (request) {
request.abort()
}

// Release awaiter
resolve()
}, error => {
if (error) {
reject(error)
}
})
// Release awaiter
resolve()
}, error => {
if (error) {
reject(error)
}
})

// Automatically stop watching after timeout
const timeoutHandler = setTimeout(() => {
Expand Down

0 comments on commit f9438b3

Please sign in to comment.