Did you know ... | Search Documentation: |
Pack k8s_client -- prolog/k8s_client.pl |
k8s_get_resource(+ApiGroup:atom, +Version:atom, +ResourceTypeName:atom, +InstanceName:atomic, -Instance:dict, +Options:list)
is nondet.
Unifies InstanceName - and Instance with the object representing resource of the kubernetes API. If the InstanceName is not bound
then all instances are retrieved. ApiGroup is either the valid name of the Kubernetes API Group or the core
atom.
The actual cluster address, context, and namespace is provided either options or loaded from the configuration. The below options are supported, in addition to options passed down to the http_open/3 predicate:
k8s_config(Config:dict)
- kubectl configuration - if not provided then the configuation is loaded by first succesfull of the following possibilities
k8s_context(Context:atom)
- name of the context to use from the k8s_config
option. If not specified, then current-context
property of k8s_config
is used as a default valuek8s_namespace(Namespace)
- the namespace from which to load resource instance(s)
. Shall be set to all
if all namespaces shall be listed
(will fail if InstanceName is bound and resource is namespaced). If not specified then the namespace provided as part of the context or the
default
namespace will be used.k8s_resource_types_mode(Mode)
where Mode is one of cache
(default), renew
, remote
, local
. Default to local
. Used when resolving
if the resource is namespaced. See also k8s_resource_types/2k8s_selectors(Selectors:list)
- list of selectors to apply for the resource retrieval(plain, not encoded form)k8s_query(Query:term)
- a query parameter to add to the REST call in form as specified by the predicate uri_query_components/2. This
option is concatenated if used multiple timesadded
, modified
, deleted
atom. Initial list of instances
is provided as sequence of added
callbacks after the call of this predicate.
The call is blocking the caller thread.
Options are same as for the k8s_get_resource/6 with extra option:
k8s_resource_version(ResourceVersion:atom)
- if specified the initial list is retrieved for the changed since the specified resource version.
This option is used primary for internal purposes, and can be reset back to 0. - the
Callback` is invoked each time there is a change, error, or channel timeout occuring during watching the resource.
This may be usefull for healthiness check of the controller. While the loop tends to be robust to typical issue of the errors during watching the callback
may implement additional level of robustness. The failure of the callback is ignored.call(StopWatcher)
. Other arguments are same as for the 'k8s_watch_resources/5`. Be aware that the Callback is invoked from the
different thread than the thread calling this predicate.The following predicates are exported, but not or incorrectly documented.