mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
New resource view: ValidatingWebhookConfigurations (#7552)
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
1 parent
e5eb709e66
commit
3baa42e17b
24 files changed
+1200
-152
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 validatingWebhookConfigurationsRouteInjectable from "./validating-webhook-configurations-route.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
|
||||
|
||||
const navigateToValidatingWebhookConfigurationsInjectable = getInjectable({
|
||||
id: "navigate-to-validating-webhook-configurations",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const route = di.inject(validatingWebhookConfigurationsRouteInjectable);
|
||||
|
||||
return () => navigateToRoute(route);
|
||||
},
|
||||
});
|
||||
|
||||
export default navigateToValidatingWebhookConfigurationsInjectable;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { shouldShowResourceInjectionToken } from "../../../../../../features/cluster/showing-kube-resources/common/allowed-resources-injection-token";
|
||||
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
const validatingWebhookConfigurationsRouteInjectable = getInjectable({
|
||||
id: "validatingwebhookconfigurations",
|
||||
|
||||
instantiate: (di) => ({
|
||||
path: "/validatingwebhookconfigurations",
|
||||
clusterFrame: true,
|
||||
isEnabled: di.inject(shouldShowResourceInjectionToken, {
|
||||
apiName: "validatingwebhookconfigurations",
|
||||
group: "admissionregistration.k8s.io",
|
||||
}),
|
||||
}),
|
||||
|
||||
injectionToken: frontEndRouteInjectionToken,
|
||||
});
|
||||
|
||||
export default validatingWebhookConfigurationsRouteInjectable;
|
||||
@@ -23,6 +23,7 @@ export * from "./job.api";
|
||||
export * from "./lease.api";
|
||||
export * from "./limit-range.api";
|
||||
export * from "./mutating-webhook-configuration.api";
|
||||
export * from "./validating-webhook-configuration.api";
|
||||
export * from "./namespace.api";
|
||||
export * from "./network-policy.api";
|
||||
export * from "./node.api";
|
||||
|
||||
@@ -43,7 +43,7 @@ interface RuleWithOperations {
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
interface MutatingWebhook {
|
||||
export interface Webhook {
|
||||
// The name of the webhook configuration.
|
||||
name: string;
|
||||
|
||||
@@ -94,6 +94,9 @@ interface MutatingWebhook {
|
||||
reinvocationPolicy?: "Never" | "IfNeeded";
|
||||
}
|
||||
|
||||
export interface MutatingWebhook extends Webhook {
|
||||
}
|
||||
|
||||
interface ServiceReference {
|
||||
// `namespace` is the namespace of the service.
|
||||
namespace: string;
|
||||
|
||||
+27
@@ -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 { ValidatingWebhookConfigurationApi } from "./validating-webhook-configuration.api";
|
||||
|
||||
const validatingWebhookConfigurationApiInjectable = getInjectable({
|
||||
id: "validating-webhook-configuration",
|
||||
instantiate: (di) => {
|
||||
assert(di.inject(storesAndApisCanBeCreatedInjectionToken), "validatingWebhookApi is only available in certain environments");
|
||||
|
||||
return new ValidatingWebhookConfigurationApi({
|
||||
logger: di.inject(loggerInjectable),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: kubeApiInjectionToken,
|
||||
});
|
||||
|
||||
export default validatingWebhookConfigurationApiInjectable;
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { NamespaceScopedMetadata, KubeObjectMetadata, KubeObjectScope } from "../kube-object";
|
||||
import { KubeObject } from "../kube-object";
|
||||
import type { DerivedKubeApiOptions, KubeApiDependencies } from "../kube-api";
|
||||
import { KubeApi } from "../kube-api";
|
||||
import type { KubeJsonApiData } from "../kube-json-api";
|
||||
import type { Webhook } from "./mutating-webhook-configuration.api";
|
||||
|
||||
export interface ValidatingWebhook extends Webhook {
|
||||
}
|
||||
|
||||
interface ValidatingWebhookConfigurationData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, void, void> {
|
||||
webhooks?: ValidatingWebhook[];
|
||||
}
|
||||
|
||||
export class ValidatingWebhookConfiguration extends KubeObject<
|
||||
NamespaceScopedMetadata,
|
||||
void,
|
||||
void
|
||||
> {
|
||||
static kind = "ValidatingWebhookConfiguration";
|
||||
static namespaced = false;
|
||||
static apiBase = "/apis/admissionregistration.k8s.io/v1/validatingwebhookconfigurations";
|
||||
|
||||
webhooks?: ValidatingWebhook[];
|
||||
|
||||
constructor({ webhooks, ...rest }: ValidatingWebhookConfigurationData) {
|
||||
super(rest);
|
||||
this.webhooks = webhooks;
|
||||
}
|
||||
|
||||
getWebhooks(): ValidatingWebhook[] {
|
||||
return this.webhooks ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
export class ValidatingWebhookConfigurationApi extends KubeApi<ValidatingWebhookConfiguration> {
|
||||
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
|
||||
super(deps, {
|
||||
...opts ?? {},
|
||||
objectConstructor: ValidatingWebhookConfiguration,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ export type KubeResource =
|
||||
"pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "replicationcontrollers" | "jobs" | "cronjobs" |
|
||||
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "verticalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets" |
|
||||
"priorityclasses" | "runtimeclasses" |
|
||||
"roles" | "clusterroles" | "rolebindings" | "clusterrolebindings" | "serviceaccounts" | "mutatingwebhookconfigurations";
|
||||
"roles" | "clusterroles" | "rolebindings" | "clusterrolebindings" | "serviceaccounts" | "mutatingwebhookconfigurations" | "validatingwebhookconfigurations";
|
||||
|
||||
export interface KubeApiResource {
|
||||
kind: string;
|
||||
@@ -119,7 +119,12 @@ export const apiResourceRecord: Record<KubeResource, KubeApiResourceData> = {
|
||||
mutatingwebhookconfigurations: {
|
||||
kind: "MutatingWebhookConfiguration",
|
||||
group: "admissionregistration.k8s.io/v1",
|
||||
namespaced: true,
|
||||
namespaced: false,
|
||||
},
|
||||
validatingwebhookconfigurations: {
|
||||
kind: "ValidatingWebhookConfiguration",
|
||||
group: "admissionregistration.k8s.io/v1",
|
||||
namespaced: false,
|
||||
},
|
||||
networkpolicies: {
|
||||
kind: "NetworkPolicy",
|
||||
|
||||
Reference in new issue
Block a user