Class ResourceAdapter<T>
- java.lang.Object
-
- io.fabric8.kubernetes.client.extension.ResourceAdapter<T>
-
- Type Parameters:
T- the resource type
- All Implemented Interfaces:
CreateOrReplaceable<T>,Deletable,DeletableWithOptions,DryRunable<WritableOperation<T>>,EditReplacePatchable<T>,FieldValidateable<NonDeletingOperation<T>>,Gettable<T>,Informable<T>,ItemReplacable<T>,ItemWritableOperation<T>,NonDeletingOperation<T>,Replaceable<T>,ReplaceDeletable<T>,Resource<T>,Scalable<T>,ServerSideApplicable<T>,Timeoutable,Updatable<T>,Waitable<T,T>,Watchable<T>,WatchAndWaitable<T>,WritableOperation<T>,FromServerGettable<T>,GracePeriodConfigurable<PropagationPolicyConfigurable<? extends Deletable>>,PropagationPolicyConfigurable<GracePeriodConfigurable<? extends Deletable>>
- Direct Known Subclasses:
ExtensibleResourceAdapter
public class ResourceAdapter<T> extends Object implements Resource<T>
Base for overriding a Resource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.fabric8.kubernetes.client.dsl.FieldValidateable
FieldValidateable.Validation
-
-
Constructor Summary
Constructors Constructor Description ResourceAdapter()ResourceAdapter(Resource<T> resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Taccept(Consumer<T> function)Issues a JSON patch against the item based upon the changes made by the function provided as argumentTcreate()Creates an itemTcreate(T item)Creates an itemTcreateOr(Function<NonDeletingOperation<T>,T> conflictAction)Alternative toCreateOrReplaceable.createOrReplace().TcreateOrReplace()Creates a provided resource in a Kubernetes Cluster.TcreateOrReplace(T item)Creates a provided resource in a Kubernetes Cluster.List<io.fabric8.kubernetes.api.model.StatusDetails>delete()Deletes the resources at this context and returns theStatusDetailsof resources marked for deletion as determined by the api server response(s).List<io.fabric8.kubernetes.api.model.StatusDetails>delete(T item)Deletes an itemWritableOperation<T>dryRun()Indicates that modifications should not be persisted.WritableOperation<T>dryRun(boolean isDryRun)Indicates whether modifications should not be persisted or not.Tedit(io.fabric8.kubernetes.api.builder.Visitor... visitors)Issues a JSON patch against the item based upon the changes made to the object by the visitors.<V> Tedit(Class<V> visitorType, io.fabric8.kubernetes.api.builder.Visitor<V> visitor)Issues a JSON patch against the item based upon the changes made to the object by the visitor.Tedit(UnaryOperator<T> function)Issues a JSON patch against the item based upon the changes made to the object returned by the function.TeditStatus(UnaryOperator<T> function)Edit the status subresourceServerSideApplicable<T>fieldManager(String manager)FieldManager is a name associated with the actor or entity that is making these changes.NonDeletingOperation<T>fieldValidation(FieldValidateable.Validation fieldValidation)Instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled.ServerSideApplicable<T>forceConflicts()Force this request / fieldManager to take ownership over conflicting fields.Gettable<T>fromServer()Tget()Get the current state from the api server.Resource<T>getResource()SharedIndexInformer<T>inform()Similar to aWatch, but will attempt to handle failures after successfully started.SharedIndexInformer<T>inform(ResourceEventHandler<? super T> handler)Similar to aWatch, but will attempt to handle failures after successfully started.SharedIndexInformer<T>inform(ResourceEventHandler<? super T> handler, long resync)Similar to aWatch, but will attempt to handle failures after successfully started.CompletableFuture<List<T>>informOnCondition(Predicate<List<T>> condition)booleanisReady()Check if the resource is ready.Titem()Get the item used to create the current operation context if available.ReplaceDeletable<T>lockResourceVersion()ReplaceDeletable<T>lockResourceVersion(String resourceVersion)Tpatch()Update field(s) of a resource using a JSON patch which will be computed using the latest server state as the base.Tpatch(PatchContext patchContext)Update field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).Tpatch(PatchContext patchContext, String patch)Update field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).Tpatch(PatchContext patchContext, T item)Update field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).Tpatch(String patch)Update field(s) of a resource using strategic merge patch.Tpatch(T item)Deprecated.TpatchStatus()Does a PATCH request to the /status subresource ignoring changes to anything except the status stanza.TpatchStatus(T item)Treplace()Replace the server's state with the given item.Treplace(T item)TreplaceStatus()Similar toUpdatable.replace(), but only affects the status subresourceTreplaceStatus(T item)Trequire()Perform aGettable.get(), but throws an exception if the server resource does not exist.SharedIndexInformer<T>runnableInformer(long resync)Similar to aWatch, but will attempt to handle failures after successfully started.io.fabric8.kubernetes.api.model.autoscaling.v1.Scalescale()Tscale(int count)Scale the resource to given countTscale(int count, boolean wait)Scale the resource to given countio.fabric8.kubernetes.api.model.autoscaling.v1.Scalescale(io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scale)TserverSideApply()Perform a Kubernetes server-side apply operation.EditReplacePatchable<T>subresource(String subresource)Provides edit, patch, and replace methods for the given subresourceNonDeletingOperation<T>unlock()Removes the resource version from the current item.Tupdate()Update the server's state with the given item (PUT).TupdateStatus()Similar toUpdatable.update(), but only affects the status subresourceTupdateStatus(T item)When the status subresource is enabled, the /status subresource for the custom resource is exposed.TwaitUntilCondition(Predicate<T> condition, long amount, TimeUnit timeUnit)Wait for the given condition to be true.TwaitUntilReady(long amount, TimeUnit timeUnit)For resources other than Node, Deployment, ReplicaSet, StatefulSet, Pod, ReplicationController, and DeploymentConfig readiness is simply an existence check.Watchwatch(io.fabric8.kubernetes.api.model.ListOptions options, Watcher<T> watcher)Watch returnsWatchinterface that watches requested resourceWatchwatch(Watcher<T> watcher)Watch returnsWatchinterface that watches requested resourceWatchwatch(String resourceVersion, Watcher<T> watcher)Watch returnsWatchinterface that watches requested resource from specified resourceVersionPropagationPolicyConfigurable<? extends Deletable>withGracePeriod(long gracePeriodSeconds)The duration in seconds before the object should be deleted.Informable<T>withIndexers(Map<String,Function<T,List<String>>> indexers)The indexers to add toSharedIndexInformers created by subsequent inform calls;Informable<T>withLimit(Long limit)Set the limit to the number of resources to list at one time.GracePeriodConfigurable<? extends Deletable>withPropagationPolicy(io.fabric8.kubernetes.api.model.DeletionPropagation propagationPolicy)Whether and how garbage collection will be performed.Watchable<T>withResourceVersion(String resourceVersion)DeletablewithTimeout(long timeout, TimeUnit unit)Perform the delete operation as blocking, waiting for finalizers, for up to the given timeoutDeletablewithTimeoutInMillis(long timeoutInMillis)Perform the delete operation as blocking, waiting for finalizers, for up to the given timeout
-
-
-
Method Detail
-
delete
public List<io.fabric8.kubernetes.api.model.StatusDetails> delete()
Description copied from interface:DeletableDeletes the resources at this context and returns theStatusDetailsof resources marked for deletion as determined by the api server response(s).It is not guaranteed that the returned list will contain all values marked for deletion - see Issue #3058
To make sure that a resource is completely deleted and not only marked for deletion, use
Deletable.withTimeout(long, TimeUnit)to perform a blocking delete operation.client.pods().inNamespace("ns").withName("pod1").withTimeout(10, TimeUnit.SECONDS).delete();
-
isReady
public boolean isReady()
Description copied from interface:ResourceCheck if the resource is ready. If no readiness check exists, this is just an existence check.Note: for resources other than Node, Deployment, ReplicaSet, StatefulSet, Pod, ReplicationController, and DeploymentConfig readiness is simply an existence check.
Also note this obtains the latest version of the resource from the server even if the context item is present.
-
get
public T get()
Description copied from interface:GettableGet the current state from the api server. See alsoResource.item()
-
lockResourceVersion
public ReplaceDeletable<T> lockResourceVersion(String resourceVersion)
- Specified by:
lockResourceVersionin interfaceResource<T>
-
dryRun
public WritableOperation<T> dryRun()
Description copied from interface:DryRunableIndicates that modifications should not be persisted. All dry run stages will be processed. the request is still processed as typical request: the fields are defaulted, the object is validated, it goes through the validation admission chain, and through the mutating admission chain, and then the final object is returned to the user as it normally would, without being persisted.- Specified by:
dryRunin interfaceDryRunable<T>- Returns:
- write operations which are applicable for dry run
-
withResourceVersion
public Watchable<T> withResourceVersion(String resourceVersion)
- Specified by:
withResourceVersionin interfaceWatchAndWaitable<T>
-
fromServer
public Gettable<T> fromServer()
- Specified by:
fromServerin interfaceFromServerGettable<T>
-
replaceStatus
public T replaceStatus()
Description copied from interface:ReplaceableSimilar toUpdatable.replace(), but only affects the status subresource- Specified by:
replaceStatusin interfaceReplaceable<T>- Returns:
- returns deserialized version of api server response
- See Also:
- Migration FAQ
-
create
public T create()
Description copied from interface:CreateOrReplaceableCreates an item- Specified by:
createin interfaceCreateOrReplaceable<T>- Returns:
- the item from the api server
-
withGracePeriod
public PropagationPolicyConfigurable<? extends Deletable> withGracePeriod(long gracePeriodSeconds)
Description copied from interface:GracePeriodConfigurableThe duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.- Specified by:
withGracePeriodin interfaceGracePeriodConfigurable<T>- Parameters:
gracePeriodSeconds- grace period integer value in seconds- Returns:
- the object for which grace period is configured
-
createOrReplace
public T createOrReplace()
Description copied from interface:CreateOrReplaceableCreates a provided resource in a Kubernetes Cluster. If creation fails with a HTTP_CONFLICT, it tries to replace resource.- Specified by:
createOrReplacein interfaceCreateOrReplaceable<T>- Returns:
- created item returned in kubernetes api response
- See Also:
- Migration FAQ
-
editStatus
public T editStatus(UnaryOperator<T> function)
Description copied from interface:NonDeletingOperationEdit the status subresource- Specified by:
editStatusin interfaceNonDeletingOperation<T>- Parameters:
function- to produce a modified status- Returns:
- updated object
-
require
public T require() throws ResourceNotFoundException
Description copied from interface:ResourcePerform aGettable.get(), but throws an exception if the server resource does not exist.- Specified by:
requirein interfaceResource<T>- Returns:
- the item or throws an exception if the item doesn't exist.
- Throws:
ResourceNotFoundException- if resource is absent
-
withPropagationPolicy
public GracePeriodConfigurable<? extends Deletable> withPropagationPolicy(io.fabric8.kubernetes.api.model.DeletionPropagation propagationPolicy)
Description copied from interface:PropagationPolicyConfigurableWhether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both.The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.
Acceptable values are:
'Orphan' - orphan the dependents;
'Background' - allow the garbage collector to delete the dependents in the background;
'Foreground' - a cascading policy that deletes all dependents in the foreground.- Specified by:
withPropagationPolicyin interfacePropagationPolicyConfigurable<T>- Parameters:
propagationPolicy- propagation policy in form of stringDeletionPropagation- Returns:
- resource
-
watch
public Watch watch(Watcher<T> watcher)
Description copied from interface:WatchableWatch returnsWatchinterface that watches requested resource
-
patch
@Deprecated public T patch(T item)
Deprecated.Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using a JSON patch. The patch is computed against the context item.It is the same as calling
EditReplacePatchable.patch(PatchContext, Object)withPatchType.JSONspecified.WARNING: If no context item is available the latest version of that resource will be used as the base to compute the diff. If you did not intend for the latest version to be your base, this may overwrite concurrent changes (between when you obtained your item and the current state) in an unexpected way.
Consider using edit, which allows for a known base, and a builder instead.
WARNING: For some resource types there is an attempt to make this operation more like an apply by considering implicit server side state as not being part of the patch. This behavior will be removed in future versions, you should instead construct the resource to be patched from a resource obtained from the api server or use patch method that is tolerant to missing state, or
ServerSideApplicable.serverSideApply()- Specified by:
patchin interfaceEditReplacePatchable<T>- Parameters:
item- to be patched with patched values- Returns:
- returns deserialized version of api server response
-
patchStatus
public T patchStatus(T item)
Description copied from interface:ItemWritableOperation- Specified by:
patchStatusin interfaceItemWritableOperation<T>- Parameters:
item- kubernetes object- Returns:
- updated object
-
edit
public T edit(UnaryOperator<T> function)
Description copied from interface:EditReplacePatchableIssues a JSON patch against the item based upon the changes made to the object returned by the function.It is generally convenient to use a Builder constructed off of the item.
- Specified by:
editin interfaceEditReplacePatchable<T>- Parameters:
function- to modify the item- Returns:
- returns deserialized version of api server response
-
waitUntilReady
public T waitUntilReady(long amount, TimeUnit timeUnit)
Description copied from interface:WaitableFor resources other than Node, Deployment, ReplicaSet, StatefulSet, Pod, ReplicationController, and DeploymentConfig readiness is simply an existence check.
Consider using the more generalWaitable.waitUntilCondition(Predicate, long, TimeUnit)when dealing with more complex situations or other types.- Specified by:
waitUntilReadyin interfaceWaitable<T,T>
-
watch
public Watch watch(io.fabric8.kubernetes.api.model.ListOptions options, Watcher<T> watcher)
Description copied from interface:WatchableWatch returnsWatchinterface that watches requested resourceThe passed in options may be modified as a side-effect of this call.
Values that already exist at this context, such as the labels, fields, and resourceVersion will be overridden on the passed in options regardless of initial values.
-
waitUntilCondition
public T waitUntilCondition(Predicate<T> condition, long amount, TimeUnit timeUnit)
Description copied from interface:WaitableWait for the given condition to be true.The processing of events will be in the IO thread, blocking operations should be avoided.
If nothing exists, the condition will be tested with a null value.
- Specified by:
waitUntilConditionin interfaceWaitable<T,T>- Returns:
- the result that passes the given condition
-
withIndexers
public Informable<T> withIndexers(Map<String,Function<T,List<String>>> indexers)
Description copied from interface:InformableThe indexers to add toSharedIndexInformers created by subsequent inform calls;- Specified by:
withIndexersin interfaceInformable<T>- Parameters:
indexers- to customize the indexing- Returns:
- the current
Informable
-
dryRun
public WritableOperation<T> dryRun(boolean isDryRun)
Description copied from interface:DryRunableIndicates whether modifications should not be persisted or not. If enabled, All dry run stages will be processed. the request is still processed as typical request: the fields are defaulted, the object is validated, it goes through the validation admission chain, and through the mutating admission chain, and then the final object is returned to the user as it normally would, without being persisted.- Specified by:
dryRunin interfaceDryRunable<T>- Parameters:
isDryRun- whether dry run is enabled or disabled- Returns:
- write operations which are applicable for dry run
-
edit
public T edit(io.fabric8.kubernetes.api.builder.Visitor... visitors)
Description copied from interface:EditReplacePatchableIssues a JSON patch against the item based upon the changes made to the object by the visitors.- Specified by:
editin interfaceEditReplacePatchable<T>- Parameters:
visitors- to modify the Builder- Returns:
- returns deserialized version of api server response
-
patch
public T patch(PatchContext patchContext, T item)
Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).PatchType.JSON- will create a JSON patch against the current itemPatchType.JSON_MERGE- will send the serialization of the item as a JSON MERGE patch. Set the resourceVersion to null to prevent optimistic locking.PatchType.STRATEGIC_MERGE- will send the serialization of the item as a STRATEGIC MERGE patch. Set the resourceVersion to null to prevent optimistic locking.PatchType.SERVER_SIDE_APPLY- will send the serialization of the item as a SERVER SIDE APPLY patch. You may explicitly set thePatchContext.getFieldManager()as well to override the default.
ServerSideApplicable.serverSideApply()- Specified by:
patchin interfaceEditReplacePatchable<T>- Parameters:
patchContext-PatchContextfor patch requestitem- to be patched with patched values- Returns:
- returns deserialized version of api server response
-
withLimit
public Informable<T> withLimit(Long limit)
Description copied from interface:InformableSet the limit to the number of resources to list at one time. This means that longer lists will take multiple requests to fetch.If the list fails to complete it will be re-attempted with this limit, rather than falling back to the full list. You should ensure that your handlers are either async or fast acting to prevent long delays in list processing that may cause results to expire before reaching the end of the list.
WARNING As noted in the go client: "paginated lists are always served directly from etcd, which is significantly less efficient and may lead to serious performance and scalability problems."
- Specified by:
withLimitin interfaceInformable<T>- Parameters:
limit- of a items in a list fetch- Returns:
- the current
Informable
-
edit
public <V> T edit(Class<V> visitorType, io.fabric8.kubernetes.api.builder.Visitor<V> visitor)
Description copied from interface:EditReplacePatchableIssues a JSON patch against the item based upon the changes made to the object by the visitor.- Specified by:
editin interfaceEditReplacePatchable<T>- Parameters:
visitorType- to create aTypedVisitorvisitor- to modify the Builder- Returns:
- returns deserialized version of api server response
-
watch
public Watch watch(String resourceVersion, Watcher<T> watcher)
Description copied from interface:WatchableWatch returnsWatchinterface that watches requested resource from specified resourceVersion
-
accept
public T accept(Consumer<T> function)
Description copied from interface:EditReplacePatchableIssues a JSON patch against the item based upon the changes made by the function provided as argument- Specified by:
acceptin interfaceEditReplacePatchable<T>- Parameters:
function- to modify the item- Returns:
- returns deserialized version of api server response
-
inform
public SharedIndexInformer<T> inform()
Description copied from interface:InformableSimilar to aWatch, but will attempt to handle failures after successfully started. and provides a store of all the current resources.This returned informer will not support resync.
This call will be blocking for the initial list and watch.
You are expected to call stop to terminate the underlying Watch.
The processing of handler events will be in the client's
Executor.- Specified by:
informin interfaceInformable<T>- Returns:
- a running
SharedIndexInformer
-
patch
public T patch(String patch)
Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using strategic merge patch.- Specified by:
patchin interfaceEditReplacePatchable<T>- Parameters:
patch- The patch to be applied to the resource JSON file.- Returns:
- returns deserialized version of api server response
-
patch
public T patch(PatchContext patchContext, String patch)
Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).- Specified by:
patchin interfaceEditReplacePatchable<T>- Parameters:
patchContext-PatchContextfor patch requestpatch- The patch to be applied to the resource JSON file.- Returns:
- updated object
-
inform
public SharedIndexInformer<T> inform(ResourceEventHandler<? super T> handler)
Description copied from interface:InformableSimilar to aWatch, but will attempt to handle failures after successfully started. and provides a store of all the current resources.This returned informer will not support resync.
This call will be blocking for the initial list and watch.
You are expected to call stop to terminate the underlying Watch.
The processing of handler events will be in the client's
Executor.- Specified by:
informin interfaceInformable<T>- Parameters:
handler- to notify- Returns:
- a running
SharedIndexInformer
-
inform
public SharedIndexInformer<T> inform(ResourceEventHandler<? super T> handler, long resync)
Description copied from interface:InformableSimilar to aWatch, but will attempt to handle failures after successfully started. and provides a store of all the current resources.This call will be blocking for the initial list and watch.
You are expected to call stop to terminate the underlying Watch.
The processing of handler events will be in the client's
Executor.- Specified by:
informin interfaceInformable<T>- Parameters:
handler- to notifyresync- the resync period or 0 for no resync- Returns:
- a running
SharedIndexInformer
-
runnableInformer
public SharedIndexInformer<T> runnableInformer(long resync)
Description copied from interface:InformableSimilar to aWatch, but will attempt to handle failures after successfully started. and provides a store of all the current resources.You are expected to call stop to terminate the underlying Watch.
- Specified by:
runnableInformerin interfaceInformable<T>- Parameters:
resync- the resync period or 0 for no resync- Returns:
- a non-running
SharedIndexInformer
-
informOnCondition
public CompletableFuture<List<T>> informOnCondition(Predicate<List<T>> condition)
Description copied from interface:InformableReturn aFuturewhen the list at this context satisfies the givenPredicate. The predicate will be tested against the state of the underlying informer store on every event. The returned future should be cancelled by the caller if not waiting for completion to close the underlying informerThe processing of events will be in the IO thread, blocking operations should be avoided.
- Specified by:
informOnConditionin interfaceInformable<T>- Parameters:
condition- thePredicateto test- Returns:
- a
CompletableFutureof the list of items after the condition is met
-
replace
public T replace()
Description copied from interface:UpdatableReplace the server's state with the given item.If
Resource.lockResourceVersion(String)has been used to lock the resourceVersion, this operation is effectively a single update attempt against that version.If
Resource.lockResourceVersion(String)has not been called, this operation will be retried a number of times in the event of a conflict. If a resourceVersion has been set on the item, the first update attempt will be made against that version. Subsequent attempts will fetch the latest resourceVersion from the server.- Specified by:
replacein interfaceUpdatable<T>- Returns:
- returns deserialized version of api server response
- See Also:
- Migration FAQ
-
create
public T create(T item)
Description copied from interface:ItemWritableOperationCreates an item- Specified by:
createin interfaceItemWritableOperation<T>- Parameters:
item- to create- Returns:
- the item from the api server
- See Also:
CreateOrReplaceable.create()
-
replace
public T replace(T item)
Description copied from interface:ItemReplacable- Specified by:
replacein interfaceItemReplacable<T>- Parameters:
item- replacement- Returns:
- the replaced item from the api server
-
createOrReplace
public T createOrReplace(T item)
Description copied from interface:ItemWritableOperationCreates a provided resource in a Kubernetes Cluster. If creation fails with a HTTP_CONFLICT, it tries to replace resource.- Specified by:
createOrReplacein interfaceItemWritableOperation<T>- Parameters:
item- to create or replace- Returns:
- created or replaced item returned in kubernetes api response
-
replaceStatus
public T replaceStatus(T item)
Description copied from interface:ItemReplacable- Specified by:
replaceStatusin interfaceItemReplacable<T>- Parameters:
item- replacement- Returns:
- the replaced item from the api server
-
delete
public List<io.fabric8.kubernetes.api.model.StatusDetails> delete(T item)
Description copied from interface:ItemWritableOperationDeletes an item- Specified by:
deletein interfaceItemWritableOperation<T>- Returns:
-
updateStatus
public T updateStatus(T item)
Description copied from interface:ItemWritableOperationWhen the status subresource is enabled, the /status subresource for the custom resource is exposed. It does a PUT requests to the /status subresource take a resource object and ignore changes to anything except the status stanza.- Specified by:
updateStatusin interfaceItemWritableOperation<T>- Parameters:
item- kubernetes object- Returns:
- updated object
-
lockResourceVersion
public ReplaceDeletable<T> lockResourceVersion()
- Specified by:
lockResourceVersionin interfaceResource<T>
-
patchStatus
public T patchStatus()
Description copied from interface:NonDeletingOperationDoes a PATCH request to the /status subresource ignoring changes to anything except the status stanza.This method has the same patching behavior as
EditReplacePatchable.patch(PatchContext), withPatchType.JSON_MERGEbut against the status subresource.Set the resourceVersion to null to prevent optimistic locking.
- Specified by:
patchStatusin interfaceNonDeletingOperation<T>- Returns:
- updated object
-
patch
public T patch()
Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using a JSON patch which will be computed using the latest server state as the base.It is the same as calling
EditReplacePatchable.patch(PatchContext)withPatchType.JSONspecified.WARNING: If you did not intend for the latest version to be your base, this may overwrite concurrent changes (between when you obtained your item and the current state) in an unexpected way.
Consider using edit instead. WARNING: For some resource types there is an attempt to make this operation more like an apply by considering implicit server side state as not being part of the patch. This behavior will be removed in future versions, you should instead construct the resource to be patched from a resource obtained from the api server or use patch method that is tolerant to missing state, or
ServerSideApplicable.serverSideApply()- Specified by:
patchin interfaceEditReplacePatchable<T>- Returns:
- returns deserialized version of api server response
-
patch
public T patch(PatchContext patchContext)
Description copied from interface:EditReplacePatchableUpdate field(s) of a resource using type specified inPatchContext(defaults to strategic merge if not specified).For use when you are providing a complete object to be patched: resource(item).patch(PatchContext.of(PatchType.SERVER_SIDE_APPLY))
PatchType.JSON- will create a JSON patch using the latest server state as the basePatchType.JSON_MERGE- will send the serialization of the item as a JSON MERGE patch. Set the resourceVersion to null to prevent optimistic locking.PatchType.STRATEGIC_MERGE- will send the serialization of the item as a STRATEGIC MERGE patch. Set the resourceVersion to null to prevent optimistic locking.PatchType.SERVER_SIDE_APPLY- will send the serialization of the item as a SERVER SIDE APPLY patch. You may explicitly set thePatchContext.getFieldManager()as well to override the default.
ServerSideApplicable.serverSideApply()- Specified by:
patchin interfaceEditReplacePatchable<T>- Parameters:
patchContext-PatchContextfor patch request- Returns:
- returns deserialized version of api server response
-
fieldValidation
public NonDeletingOperation<T> fieldValidation(FieldValidateable.Validation fieldValidation)
Description copied from interface:FieldValidateableInstructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled.- Specified by:
fieldValidationin interfaceFieldValidateable<T>- Returns:
- write operations where field validation is applicable.
-
fieldManager
public ServerSideApplicable<T> fieldManager(String manager)
Description copied from interface:ServerSideApplicableFieldManager is a name associated with the actor or entity that is making these changes.The value must be less than or 128 characters long, and only contain printable characters
the default value is "fabric8"
- Specified by:
fieldManagerin interfaceServerSideApplicable<T>- Returns:
ServerSideApplicablefor continued operations
-
forceConflicts
public ServerSideApplicable<T> forceConflicts()
Description copied from interface:ServerSideApplicableForce this request / fieldManager to take ownership over conflicting fields.- Specified by:
forceConflictsin interfaceServerSideApplicable<T>- Returns:
ServerSideApplicablefor continued operations
-
serverSideApply
public T serverSideApply()
Description copied from interface:ServerSideApplicablePerform a Kubernetes server-side apply operation. Under the hood it's an HTTP PATCH operation using theapplication/apply-patch+yamlContent-Type.- Specified by:
serverSideApplyin interfaceServerSideApplicable<T>- Returns:
- the patched item from the API server.
- See Also:
- Kubernetes User Guide: Server-Side Apply
-
item
public T item()
Description copied from interface:ResourceGet the item used to create the current operation context if available.
-
withTimeout
public Deletable withTimeout(long timeout, TimeUnit unit)
Description copied from interface:DeletablePerform the delete operation as blocking, waiting for finalizers, for up to the given timeout- Specified by:
withTimeoutin interfaceDeletable- Specified by:
withTimeoutin interfaceTimeoutable- Parameters:
timeout- 0 indicates no wait
-
withTimeoutInMillis
public Deletable withTimeoutInMillis(long timeoutInMillis)
Description copied from interface:DeletablePerform the delete operation as blocking, waiting for finalizers, for up to the given timeout- Specified by:
withTimeoutInMillisin interfaceDeletable- Specified by:
withTimeoutInMillisin interfaceTimeoutable- Parameters:
timeoutInMillis- 0 indicates no wait
-
update
public T update()
Description copied from interface:UpdatableUpdate the server's state with the given item (PUT).If the resourceVersion is on the resource, the update will be performed with optimistic locking, and may result in a conflict (409 error). If no resourceVersion is on the resource, the latest resourceVersion will be obtained from the server prior to the update call - which may still be a conflict in a rare circumstance.
-
updateStatus
public T updateStatus()
Description copied from interface:ReplaceableSimilar toUpdatable.update(), but only affects the status subresource- Specified by:
updateStatusin interfaceReplaceable<T>- Returns:
- returns deserialized version of api server response
-
scale
public io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scale()
-
scale
public T scale(int count)
Description copied from interface:ScalableScale the resource to given count
-
scale
public T scale(int count, boolean wait)
Description copied from interface:ScalableScale the resource to given count
-
scale
public io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scale(io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scale)
-
createOr
public T createOr(Function<NonDeletingOperation<T>,T> conflictAction)
Description copied from interface:NonDeletingOperationAlternative toCreateOrReplaceable.createOrReplace().Will attempt a create, and if that fails will perform the conflictAction.
Most commonly the conflictAction will be NonDeletingOperation::update or NonDeletingOperation::patch, but you are free to provide whatever Function suits your needs.
- Specified by:
createOrin interfaceNonDeletingOperation<T>- Parameters:
conflictAction- to be performed it the create fails with a conflict- Returns:
-
unlock
public NonDeletingOperation<T> unlock()
Description copied from interface:NonDeletingOperationRemoves the resource version from the current item. If the operation context was created by name, and without an item, this will fetch the item from the api server first.- Specified by:
unlockin interfaceNonDeletingOperation<T>- Returns:
- NonDeletingOperation that may act on the unlocked item
-
subresource
public EditReplacePatchable<T> subresource(String subresource)
Description copied from interface:NonDeletingOperationProvides edit, patch, and replace methods for the given subresource- Specified by:
subresourcein interfaceNonDeletingOperation<T>
-
-