1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix webhook field scoping

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2023-04-07 10:51:58 +03:00
parent 9c2884a671
commit 02e24735b8

View File

@ -2,10 +2,11 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import type { LabelSelector, NamespaceScopedMetadata } from "../kube-object"; import type { LabelSelector, NamespaceScopedMetadata, KubeObjectMetadata, KubeObjectScope } from "../kube-object";
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import type { DerivedKubeApiOptions, KubeApiDependencies } from "../kube-api"; import type { DerivedKubeApiOptions, KubeApiDependencies } from "../kube-api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api";
interface MutatingWebhookConfigurationStatus { interface MutatingWebhookConfigurationStatus {
// The latest generation observed by the webhook. // The latest generation observed by the webhook.
@ -203,6 +204,10 @@ interface MutatingWebhookConfigurationSpec {
reinvocationPolicy?: string; reinvocationPolicy?: string;
} }
interface MutatingWebhookConfigurationData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, MutatingWebhookConfigurationStatus, MutatingWebhookConfigurationSpec> {
webhooks?: MutatingWebhook[];
}
export class MutatingWebhookConfiguration extends KubeObject< export class MutatingWebhookConfiguration extends KubeObject<
NamespaceScopedMetadata, NamespaceScopedMetadata,
MutatingWebhookConfigurationStatus, MutatingWebhookConfigurationStatus,
@ -212,8 +217,15 @@ export class MutatingWebhookConfiguration extends KubeObject<
static namespaced = true; static namespaced = true;
static apiBase = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations"; static apiBase = "/apis/admissionregistration.k8s.io/v1/mutatingwebhookconfigurations";
webhooks?: MutatingWebhook[];
constructor({ webhooks, ...rest }: MutatingWebhookConfigurationData) {
super(rest);
this.webhooks = webhooks;
}
getWebhooks(): MutatingWebhook[] { getWebhooks(): MutatingWebhook[] {
return this.spec?.webhooks ?? []; return this.webhooks ?? [];
} }
getClientConfig(serviceName: string, serviceNamespace: string): WebhookClientConfig | undefined { getClientConfig(serviceName: string, serviceNamespace: string): WebhookClientConfig | undefined {