mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add mutatingWebhookConfigurationApiInjectable
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
626fe1a890
commit
704a642276
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { storesAndApisCanBeCreatedInjectionToken } from "../stores-apis-can-be-created.token";
|
||||||
|
import { kubeApiInjectionToken } from "../kube-api/kube-api-injection-token";
|
||||||
|
import loggerInjectable from "../../logger.injectable";
|
||||||
|
import maybeKubeApiInjectable from "../maybe-kube-api.injectable";
|
||||||
|
import { MutatingWebhookConfigurationApi } from "./mutating-webhook-configuration.api";
|
||||||
|
|
||||||
|
const mutatingWebhookConfigurationApiInjectable = getInjectable({
|
||||||
|
id: "mutating-webhook-configuration",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "mutatingWebhookApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new MutatingWebhookConfigurationApi({
|
||||||
|
logger: di.inject(loggerInjectable),
|
||||||
|
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: kubeApiInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default mutatingWebhookConfigurationApiInjectable;
|
||||||
@ -4,6 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
import type { LabelSelector, NamespaceScopedMetadata } from "../kube-object";
|
import type { LabelSelector, NamespaceScopedMetadata } from "../kube-object";
|
||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
|
import type { DerivedKubeApiOptions, KubeApiDependencies } from "../kube-api";
|
||||||
|
import { KubeApi } from "../kube-api";
|
||||||
|
|
||||||
interface MutatingWebhookConfigurationStatus {
|
interface MutatingWebhookConfigurationStatus {
|
||||||
// The latest generation observed by the webhook.
|
// The latest generation observed by the webhook.
|
||||||
@ -238,3 +240,12 @@ export class MutatingWebhookConfiguration extends KubeObject<
|
|||||||
return this.spec?.reinvocationPolicy;
|
return this.spec?.reinvocationPolicy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MutatingWebhookConfigurationApi extends KubeApi<MutatingWebhookConfiguration> {
|
||||||
|
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||||
|
super(deps, {
|
||||||
|
...opts ?? {},
|
||||||
|
objectConstructor: MutatingWebhookConfiguration,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user