Construct Kubernetes resource object for use with client API.
Remove read-only type properties not useful to retain in a resource
specification used for upserting resources. This is probably not
perfect. Add the apiVersion
and kind
properties since the they
are not included in the items returned by the list endpoint,
https://github.com/kubernetes/kubernetes/issues/3030 .
Kubernetes spec to clean
Kubernetes spec with status-like properties removed
Determine all Kuberenetes cluster, i.e., not namespaced, resources
that we should query based on all the selectors and return an array
with each Kubernetes cluster resource type appearing no more than
once. Note that uniqueness of a Kubernetes resource type is
determined solely by the kind
property, apiVersion
is not
considered since the same resource can be found with the same kind
and different API versions.
All the resource selectors
A deduplicated array of Kubernetes cluster resource kinds among the inclusion rules
Determine if Kubernetes resource kind
property is among the kinds
provided. If no kinds are provided, it is considered matching.
Only the resource's kind
property is considered when matching,
apiVersion
is ignored.
Kubernetes resource to check
Return true
if it is a match, false
otherwise
Determine all Kuberenetes resources that we should query based on
all the selectors and return an array with each Kubernetes resource
type appearing no more than once. Note that uniqueness of a
Kubernetes resource type is determined solely by the kind
property, apiVersion
is not considered since the same resource
can be found with the same kind and different API versions.
All the resource selectors
A deduplicated array of Kubernetes resource kinds among the inclusion rules
Determine if Kubernetes resource kind
property is among the kinds
provided. If no kinds are provided, it is considered matching.
Only the resource's kind
property is considered when matching,
apiVersion
is ignored.
Kubernetes resource to check
Kubernetes resource selector kinds
property to use for checking
Return true
if it is a match, false
otherwise
Fetch resource specs from a Kubernetes cluster as directed by the fetch options, removing read-only properties filled by the Kubernetes system.
The inclusion selectors are processed to determine which resources in the Kubernetes cluster to query.
Kubernetes fetch options
Kubernetes resources matching the fetch options
Reduce a Kubernetes resource to its uniquely identifying
properties. Note that apiVersion
is not among them as identical
resources can be access via different API versions, e.g.,
Deployment via app/v1 and extensions/v1beta1.
Kubernetes resource
Stripped down resource for unique identification
For the provided set of selectors, return a deduplicated array of resource kinds that match the provided namespace.
Namespace to check
Selectors to evaluate
A deduplicated array of Kubernetes resource kinds among the inclusion rules for namespace ns
Make sure Kubernetes resource selectors have appropriate properties
populated with default values. If the selector does not have an
action
set, it is set to "include". If the selector does not have
kinds
set and action
is "include", kinds
is set to
defaultKubernetesResourceSelectorKinds. Rules with action
set
to "exclude" and have no selectors are discarded.
Kubernetes resource selectors to ensure have default values
Properly defaulted Kubernetes resource selectors
Filter provided Kubernetes resources according to the provides selectors. Each selector is applied in turn to each spec. The action of the first selector that matches a resource is applied to that resource. If no selector matches a resource, it is not returned, i.e., the default is to exclude.
Kubernetes resources to filter
Filtering rules
Filtered array of Kubernetes resources
Determine if Kubernetes resource is a match against the selector.
If there is a match, return the action of the selector. If there
is not a match, return undefined
.
Kubernetes resource to check
Selector to use for checking
Selector action if there is a match, undefined
otherwise
The default options used when fetching resource from a Kubernetes
cluster. By default it fetches resources whose kind is in the
defaultKubernetesResourceSelectorKinds array, excluding the
resources that look like Kubernetes managed resources like the
kubernetes
service in the default
namespace, resources in
namespaces that starts with "kube-", and system- and cloud-related
cluster roles and cluster role bindings.
Generated using TypeDoc
Useful default set of kinds of Kubernetes resources.