pepr 0.38.0-rc → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/controller.js +1 -1
- package/dist/fixtures/loader.d.ts +1 -1
- package/dist/fixtures/loader.d.ts.map +1 -1
- package/dist/lib/controller/index.d.ts +2 -1
- package/dist/lib/controller/index.d.ts.map +1 -1
- package/dist/lib/k8s.d.ts +1 -77
- package/dist/lib/k8s.d.ts.map +1 -1
- package/dist/lib.js.map +2 -2
- package/package.json +5 -5
- package/src/fixtures/loader.ts +1 -1
- package/src/lib/capability.test.ts +1 -1
- package/src/lib/controller/index.ts +2 -2
- package/src/lib/k8s.ts +1 -102
- package/src/lib/watch-processor.test.ts +0 -1
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"/dist",
|
|
14
14
|
"/src"
|
|
15
15
|
],
|
|
16
|
-
"version": "0.38.0
|
|
16
|
+
"version": "0.38.0",
|
|
17
17
|
"main": "dist/lib.js",
|
|
18
18
|
"types": "dist/lib.d.ts",
|
|
19
19
|
"scripts": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@types/ramda": "0.30.2",
|
|
42
|
-
"express": "4.21.
|
|
42
|
+
"express": "4.21.1",
|
|
43
43
|
"fast-json-patch": "3.1.1",
|
|
44
44
|
"json-pointer": "^0.6.2",
|
|
45
|
-
"kubernetes-fluent-client": "
|
|
46
|
-
"pino": "9.
|
|
47
|
-
"pino-pretty": "11.
|
|
45
|
+
"kubernetes-fluent-client": "3.1.1",
|
|
46
|
+
"pino": "9.5.0",
|
|
47
|
+
"pino-pretty": "11.3.0",
|
|
48
48
|
"prom-client": "15.1.3",
|
|
49
49
|
"ramda": "0.30.1"
|
|
50
50
|
},
|
package/src/fixtures/loader.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { V1Pod } from "@kubernetes/client-node";
|
|
|
6
6
|
import { expect, describe, jest, beforeEach, it } from "@jest/globals";
|
|
7
7
|
import { PeprMutateRequest } from "./mutate-request";
|
|
8
8
|
import { PeprValidateRequest } from "./validate-request";
|
|
9
|
-
import { Operation, AdmissionRequest } from "./
|
|
9
|
+
import { Operation, AdmissionRequest } from "./types";
|
|
10
10
|
import { WatchPhase } from "kubernetes-fluent-client/dist/fluent/types";
|
|
11
11
|
import { Event } from "./types";
|
|
12
12
|
import { GenericClass } from "kubernetes-fluent-client";
|
|
@@ -6,14 +6,14 @@ import fs from "fs";
|
|
|
6
6
|
import https from "https";
|
|
7
7
|
|
|
8
8
|
import { Capability } from "../capability";
|
|
9
|
-
import { MutateResponse,
|
|
9
|
+
import { MutateResponse, ValidateResponse } from "../k8s";
|
|
10
10
|
import Log from "../logger";
|
|
11
11
|
import { metricsCollector, MetricsCollector } from "../metrics";
|
|
12
12
|
import { ModuleConfig, isWatchMode } from "../module";
|
|
13
13
|
import { mutateProcessor } from "../mutate-processor";
|
|
14
14
|
import { validateProcessor } from "../validate-processor";
|
|
15
15
|
import { PeprControllerStore } from "./store";
|
|
16
|
-
import { ResponseItem } from "../types";
|
|
16
|
+
import { ResponseItem, AdmissionRequest } from "../types";
|
|
17
17
|
|
|
18
18
|
if (!process.env.PEPR_NODE_WARNINGS) {
|
|
19
19
|
process.removeAllListeners("warning");
|
package/src/lib/k8s.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
3
3
|
|
|
4
|
-
import { GenericKind,
|
|
5
|
-
|
|
6
|
-
// DEPRECATED: Use Operation in types.ts instead
|
|
7
|
-
export enum Operation {
|
|
8
|
-
CREATE = "CREATE",
|
|
9
|
-
UPDATE = "UPDATE",
|
|
10
|
-
DELETE = "DELETE",
|
|
11
|
-
CONNECT = "CONNECT",
|
|
12
|
-
}
|
|
4
|
+
import { GenericKind, RegisterKind } from "kubernetes-fluent-client";
|
|
13
5
|
|
|
14
6
|
/**
|
|
15
7
|
* PeprStore for internal use by Pepr. This is used to store arbitrary data in the cluster.
|
|
@@ -28,99 +20,6 @@ export const peprStoreGVK = {
|
|
|
28
20
|
|
|
29
21
|
RegisterKind(PeprStore, peprStoreGVK);
|
|
30
22
|
|
|
31
|
-
// DEPRECATED: Use Operation in types.ts instead
|
|
32
|
-
/**
|
|
33
|
-
* GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
|
|
34
|
-
* to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling
|
|
35
|
-
*/
|
|
36
|
-
export interface GroupVersionResource {
|
|
37
|
-
readonly group: string;
|
|
38
|
-
readonly version: string;
|
|
39
|
-
readonly resource: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// DEPRECATED: Use Operation in types.ts instead
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A Kubernetes admission request to be processed by a capability.
|
|
46
|
-
*/
|
|
47
|
-
export interface AdmissionRequest<T = KubernetesObject> {
|
|
48
|
-
/** UID is an identifier for the individual request/response. */
|
|
49
|
-
readonly uid: string;
|
|
50
|
-
|
|
51
|
-
/** Kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) */
|
|
52
|
-
readonly kind: GroupVersionKind;
|
|
53
|
-
|
|
54
|
-
/** Resource is the fully-qualified resource being requested (for example, v1.pods) */
|
|
55
|
-
readonly resource: GroupVersionResource;
|
|
56
|
-
|
|
57
|
-
/** SubResource is the sub-resource being requested, if any (for example, "status" or "scale") */
|
|
58
|
-
readonly subResource?: string;
|
|
59
|
-
|
|
60
|
-
/** RequestKind is the fully-qualified type of the original API request (for example, v1.Pod or autoscaling.v1.Scale). */
|
|
61
|
-
readonly requestKind?: GroupVersionKind;
|
|
62
|
-
|
|
63
|
-
/** RequestResource is the fully-qualified resource of the original API request (for example, v1.pods). */
|
|
64
|
-
readonly requestResource?: GroupVersionResource;
|
|
65
|
-
|
|
66
|
-
/** RequestSubResource is the sub-resource of the original API request, if any (for example, "status" or "scale"). */
|
|
67
|
-
readonly requestSubResource?: string;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and
|
|
71
|
-
* rely on the server to generate the name. If that is the case, this method will return the empty string.
|
|
72
|
-
*/
|
|
73
|
-
readonly name: string;
|
|
74
|
-
|
|
75
|
-
/** Namespace is the namespace associated with the request (if any). */
|
|
76
|
-
readonly namespace?: string;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Operation is the operation being performed. This may be different than the operation
|
|
80
|
-
* requested. e.g. a patch can result in either a CREATE or UPDATE Operation.
|
|
81
|
-
*/
|
|
82
|
-
readonly operation: Operation;
|
|
83
|
-
|
|
84
|
-
/** UserInfo is information about the requesting user */
|
|
85
|
-
readonly userInfo: {
|
|
86
|
-
/** The name that uniquely identifies this user among all active users. */
|
|
87
|
-
username?: string;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* A unique value that identifies this user across time. If this user is deleted
|
|
91
|
-
* and another user by the same name is added, they will have different UIDs.
|
|
92
|
-
*/
|
|
93
|
-
uid?: string;
|
|
94
|
-
|
|
95
|
-
/** The names of groups this user is a part of. */
|
|
96
|
-
groups?: string[];
|
|
97
|
-
|
|
98
|
-
/** Any additional information provided by the authenticator. */
|
|
99
|
-
extra?: {
|
|
100
|
-
[key: string]: string[];
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** Object is the object from the incoming request prior to default values being applied */
|
|
105
|
-
readonly object: T;
|
|
106
|
-
|
|
107
|
-
/** OldObject is the existing object. Only populated for UPDATE or DELETE requests. */
|
|
108
|
-
readonly oldObject?: T;
|
|
109
|
-
|
|
110
|
-
/** DryRun indicates that modifications will definitely not be persisted for this request. Defaults to false. */
|
|
111
|
-
readonly dryRun?: boolean;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Options contains the options for the operation being performed.
|
|
115
|
-
* e.g. `meta.k8s.io/v1.DeleteOptions` or `meta.k8s.io/v1.CreateOptions`. This may be
|
|
116
|
-
* different than the options the caller provided. e.g. for a patch request the performed
|
|
117
|
-
* Operation might be a CREATE, in which case the Options will a
|
|
118
|
-
* `meta.k8s.io/v1.CreateOptions` even though the caller provided `meta.k8s.io/v1.PatchOptions`.
|
|
119
|
-
*/
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
121
|
-
readonly options?: any;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
23
|
export interface MutateResponse {
|
|
125
24
|
/** UID is an identifier for the individual request/response. This must be copied over from the corresponding AdmissionRequest. */
|
|
126
25
|
uid: string;
|