Utilities for writing Kubernetes controllers in JavaScript.
- NamespacedName
-
NamespacedName comprises a resource name and namespace rendered as "namespace/name".
- AdmissionRequest
- AdmissionResponse
- AdmissionReview
- Server
-
reasonForError(err) ⇒
string
-
reasonForError() returns the reason for a particular error.
-
isAlreadyExists(err) ⇒
boolean
-
isAlreadyExists() determines if the err is an error which indicates that a specified resource already exists.
-
isBadRequest(err) ⇒
boolean
-
isBadRequest() determines if err is an error which indicates that the request is invalid.
-
isConflict(err) ⇒
boolean
-
isConflict() determines if the err is an error which indicates the provided update conflicts.
-
isForbidden(err) ⇒
boolean
-
isForbidden() determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.
-
isGone(err) ⇒
boolean
-
isGone() is true if the error indicates the requested resource is no longer available.
-
isInternalError(err) ⇒
boolean
-
isInternalError() determines if err is an error which indicates an internal server error.
-
isInvalid(err) ⇒
boolean
-
isInvalid() determines if the err is an error which indicates the provided resource is not valid.
-
isMethodNotSupported(err) ⇒
boolean
-
isMethodNotSupported() determines if the err is an error which indicates the provided action could not be performed because it is not supported by the server.
-
isNotAcceptable(err) ⇒
boolean
-
isNotAcceptable() determines if err is an error which indicates that the request failed due to an invalid Accept header.
-
isNotFound(err) ⇒
boolean
-
isNotFound() determines if an err indicating that a resource could not be found.
-
isRequestEntityTooLargeError(err) ⇒
boolean
-
isRequestEntityTooLargeError() determines if err is an error which indicates the request entity is too large.
-
isResourceExpired(err) ⇒
boolean
-
isResourceExpired() is true if the error indicates the resource has expired and the current action is no longer possible.
-
isServerTimeout(err) ⇒
boolean
-
isServerTimeout() determines if err is an error which indicates that the request needs to be retried by the client.
-
isServiceUnavailable(err) ⇒
boolean
-
isServiceUnavailable() is true if the error indicates the underlying service is no longer available.
-
isTimeout(err) ⇒
boolean
-
isTimeout() determines if err is an error which indicates that request times out due to long processing.
-
isTooManyRequests(err) ⇒
boolean
-
isTooManyRequests() determines if err is an error which indicates that there are too many requests that the server cannot handle.
-
isUnauthorized(err) ⇒
boolean
-
isUnauthorized() determines if err is an error which indicates that the request is unauthorized and requires authentication by the user.
-
isUnsupportedMediaType(err) ⇒
boolean
-
isUnsupportedMediaType() determines if err is an error which indicates that the request failed due to an invalid Content-Type header.
-
allowed([message]) ⇒
AdmissionResponse
-
allowed() constructs a response indicating that the given operation is allowed.
-
denied([message]) ⇒
AdmissionResponse
-
denied() constructs a response indicating that the given operation is denied.
-
errored(code, [err]) ⇒
AdmissionResponse
-
errored() creates a new response for error-handling a request.
-
validationResponse(allowed, [message]) ⇒
AdmissionResponse
-
validationResponse() returns a response for admitting a request.
-
withResolvers() ⇒
PromiseWithResolvers
-
withResolvers() works like Promise.withResolvers().
-
AdmissionRequestOptions :
Object
-
AdmissionResponseOptions :
Object
-
AdmissionReviewOptions :
Object
-
ServerOptions :
Object
-
PromiseWithResolvers :
Object
NamespacedName comprises a resource name and namespace rendered as "namespace/name".
Kind: global class
Construct a NamespacedName.
Param | Type | Description |
---|---|---|
name | string |
Resource name. |
[namespace] | string |
Resource namespace. |
Converts a NamespacedName to a string of the form "namespace/name".
Kind: instance method of NamespacedName
Returns: string
- A string representation of the NamespacedName.
Creates a new AdmissionRequest instance.
Param | Type | Description |
---|---|---|
options | AdmissionRequestOptions |
Options used to construct instance. |
Kind: global class
Creates a new AdmissionResponse instance.
Param | Type | Description |
---|---|---|
options | AdmissionResponseOptions |
Options used to construct instance. |
complete() populates any fields that are yet to be set in the underlying response.
Kind: instance method of AdmissionResponse
Param | Type | Description |
---|---|---|
req | AdmissionRequest |
The request corresponding to this response. |
Creates a new AdmissionReview instance.
Param | Type | Description |
---|---|---|
options | AdmissionReviewOptions |
Options used to construct instance. |
Kind: global class
-
Server
- new Server([options])
-
.inject(settings) ⇒
Promise
- .register(path, hook)
-
.start(ctx) ⇒
Promise
Creates a new Server instance.
Param | Type | Description |
---|---|---|
[options] | ServerOptions |
Options used to construct instance. |
inject() creates a simulated request in the server.
Kind: instance method of Server
Param | Type | Description |
---|---|---|
settings | Object |
Simulated request configuration. |
register() marks the given webhook as being served at the given path.
Kind: instance method of Server
Param | Type | Description |
---|---|---|
path | string |
The path to serve the webhook from. |
hook | function |
The webhook to serve. |
start() runs the server.
Kind: instance method of Server
Param | Type | Description |
---|---|---|
ctx | Object |
The context object. |
reasonForError() returns the reason for a particular error.
Kind: global function
Returns: string
- A StatusReason representing the cause of the error.
Param | Type |
---|---|
err | Error |
isAlreadyExists() determines if the err is an error which indicates that a specified resource already exists.
Kind: global function
Param | Type |
---|---|
err | Error |
isBadRequest() determines if err is an error which indicates that the request is invalid.
Kind: global function
Param | Type |
---|---|
err | Error |
isConflict() determines if the err is an error which indicates the provided update conflicts.
Kind: global function
Param | Type |
---|---|
err | Error |
isForbidden() determines if err is an error which indicates that the request is forbidden and cannot be completed as requested.
Kind: global function
Param | Type |
---|---|
err | Error |
isGone() is true if the error indicates the requested resource is no longer available.
Kind: global function
Param | Type |
---|---|
err | Error |
isInternalError() determines if err is an error which indicates an internal server error.
Kind: global function
Param | Type |
---|---|
err | Error |
isInvalid() determines if the err is an error which indicates the provided resource is not valid.
Kind: global function
Param | Type |
---|---|
err | Error |
isMethodNotSupported() determines if the err is an error which indicates the provided action could not be performed because it is not supported by the server.
Kind: global function
Param | Type |
---|---|
err | Error |
isNotAcceptable() determines if err is an error which indicates that the request failed due to an invalid Accept header.
Kind: global function
Param | Type |
---|---|
err | Error |
isNotFound() determines if an err indicating that a resource could not be found.
Kind: global function
Param | Type |
---|---|
err | Error |
isRequestEntityTooLargeError() determines if err is an error which indicates the request entity is too large.
Kind: global function
Param | Type |
---|---|
err | Error |
isResourceExpired() is true if the error indicates the resource has expired and the current action is no longer possible.
Kind: global function
Param | Type |
---|---|
err | Error |
isServerTimeout() determines if err is an error which indicates that the request needs to be retried by the client.
Kind: global function
Param | Type |
---|---|
err | Error |
isServiceUnavailable() is true if the error indicates the underlying service is no longer available.
Kind: global function
Param | Type |
---|---|
err | Error |
isTimeout() determines if err is an error which indicates that request times out due to long processing.
Kind: global function
Param | Type |
---|---|
err | Error |
isTooManyRequests() determines if err is an error which indicates that there are too many requests that the server cannot handle.
Kind: global function
Param | Type |
---|---|
err | Error |
isUnauthorized() determines if err is an error which indicates that the request is unauthorized and requires authentication by the user.
Kind: global function
Param | Type |
---|---|
err | Error |
isUnsupportedMediaType() determines if err is an error which indicates that the request failed due to an invalid Content-Type header.
Kind: global function
Param | Type |
---|---|
err | Error |
allowed([message]) ⇒ AdmissionResponse
allowed() constructs a response indicating that the given operation is allowed.
Kind: global function
Param | Type | Description |
---|---|---|
[message] | string |
additional message to attach to the response. |
denied([message]) ⇒ AdmissionResponse
denied() constructs a response indicating that the given operation is denied.
Kind: global function
Param | Type | Description |
---|---|---|
[message] | string |
additional message to attach to the response. |
errored(code, [err]) ⇒ AdmissionResponse
errored() creates a new response for error-handling a request.
Kind: global function
Param | Type | Description |
---|---|---|
code | number |
error code to return. |
[err] | Error |
an error whose message is included in the response. |
validationResponse(allowed, [message]) ⇒ AdmissionResponse
validationResponse() returns a response for admitting a request.
Kind: global function
Param | Type | Description |
---|---|---|
allowed | boolean |
allowed indicates whether or not the admission request was permitted. |
[message] | string |
additional message to attach to the response. |
withResolvers() ⇒ PromiseWithResolvers
withResolvers() works like Promise.withResolvers().
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
uid | string |
uid is an identifier for the individual request/response. |
kind | Object |
kind is the fully-qualified type of object being submitted. |
resource | Object |
resource is the fully-qualified resource being requested. |
[subResource] | string |
subResource is the subresource being requested, if any. |
requestKind | Object |
requestKind is the fully-qualified type of the original API request |
requestResource | Object |
requestResource is the fully-qualified resource of the original API request. |
[requestSubResource] | string |
requestSubResource is the name of the subresource of the original API request, if any. |
name | string |
name is the name of the object as presented in the request. |
[namespace] | string |
namespace is the namespace associated with the request, if any. |
operation | string |
operation is the operation being performed. |
userInfo | Object |
userInfo is information about the requesting user. |
object | Object |
object is the object from the incoming request. |
[oldObject] | Object |
oldObject is the existing object. Only populated for DELETE and UPDATE requests. |
[dryRun] | Object |
dryRun indicates that modifications will definitely not be persisted for this request. |
[options] | Object |
options is the operation option structure of the operation being performed. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
[uid] | string |
uid is an identifier for the individual request/response. |
allowed | boolean |
allowed indicates whether or not the admission request was permitted. |
[status] | Object |
status contains extra details into why an admission request was denied. |
[patch] | Object |
The patch body. |
[patches] | Array.<Object> |
patches are the JSON patches for mutating webhooks. |
[auditAnnotations] | Object |
auditAnnotations is an unstructured key value map set by remote admission controller |
[warnings] | Array.<string> |
warnings is a list of warning messages to return to the requesting API client. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
[request] | Object |
Object used to create an AdmissionRequest. |
[response] | Object |
Object used to create an AdmissionResponse. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
[certDir] | string |
The directory that contains the server key and certificate. |
[certName] | string |
The server certificate name. Defaults to tls.crt. |
[insecure] | boolean |
If true, the server uses HTTP instead of HTTPS. |
[keyName] | string |
The server key name. Defaults to tls.key. |
[port] | number |
The port number that the server will bind to. |